Program to zoom a rectangle as you drag - visual c++, Visual Basic Programming

Assignment Help:

PROGRAM TO ZOOM A RECTANGLE AS YOU DRAG

1. Generate a SDI application

2. Declare the 2 member variables clicked of Boolean type and m_ptoldpt of CPoint type. Use the class tab page and add member variables on the View Class by right clicking.

3. Using the Class wizard add the messages left button up, left button down and mouse move.

4. Type the below coding in the left button down the event handler.

void CDragView::OnLButtonDown(UINT nFlags, CPoint point)

{

clicked=true;

}

The Boolean variable clicked is put to true.

5. Type the below coding in the left button up event handler.

void CDragView::OnLButtonUp(UINT nFlags, CPoint point)

{

clicked=FALSE;

Invalidate(TRUE);

}

The Boolean variable clicked is set to FALSE and OnDraw() function is called using the Invalidate() function. The TRUE parameter clears the screen by calling the WM_PAINT.

6. Type the below coding in the Mouse Move event handler.

void CDragView::OnMouseMove(UINT nFlags, CPoint point)

{

if(clicked)

{

CDC *dc = GetDC();

dc->Rectangle(oldpt.x,oldpt.y,point.x,point.y);

oldpt=point;

}

}

When the mouse button is released with the end point as first point and where the mouse button was released a rectangle would be drawn.


Related Discussions:- Program to zoom a rectangle as you drag - visual c++

Dictionary, how to make dictionary in vb using ms access

how to make dictionary in vb using ms access

Insertion and deletion in algorithm, translate''Q''for insert into element ...

translate''Q''for insert into element and''Q''delete for deletion element into programming language

Associating images to toolbars - visual basic, Associating Images to Toolba...

Associating Images to Toolbars: 1. Add an Image list to your form from the tool box. 2. Pick the custom property of the image list. 3. Click the images tab. 4. Select

Explain class module and standard module, Difference between Class Module a...

Difference between Class Module and Standard Module? Standard module: -This place for variable declarations,procedures etc.& it can accessed these procedures in whereve

Sum of numbers Calculator with Tryparse, I need assistance with writing the...

I need assistance with writing the Tryparse I have 98% of the assignment done.

Data control, DATA CONTROL The data control is used to connect to the d...

DATA CONTROL The data control is used to connect to the database. Three properties are very necessary to connect to the database. The primary property is the database name. You

Document interfaces - visual basic programming, DOCUMENT INTERFACES   ...

DOCUMENT INTERFACES   A SDI (Single document interface) and the MDI (Multiple document interfaces) are the document interfaces. The MDI based applications can have numerous ch

Vbscript error object clear method, Methods: VBScript Err Object ...

Methods: VBScript Err Object Clear Method Clears every property settings. Raise Method Generate a run-time error.

What is meant by dtd?, Question 1 Design a form based applications using l...

Question 1 Design a form based applications using labels, text boxes, and buttons to perform basic arithmetic operations on integers Question 2 Describe the concept of Except

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd