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

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.

Posted Date: 10/10/2012 1:38:19 AM | Location : United States







Related Discussions:- Program to zoom a rectangle as you drag - visual c++, Assignment Help, Ask Question on Program to zoom a rectangle as you drag - visual c++, Get Answer, Expert's Help, Program to zoom a rectangle as you drag - visual c++ Discussions

Write discussion on Program to zoom a rectangle as you drag - visual c++
Your posts are moderated
Related Questions
I would like someone to look at my code and tell me why it''s not working

The Frame: As the name suggests, the frame is a combination of the building blocks, structure and the borders of an item. The frame gives the "physical" presence to a window.

Displaying a file With Scrolling: To display a file with the scrolling option allows the steps as shown below: 1. Generate a SDI application. 2. In the Step 6 of the App

I''m trying to create a program in VB.net that will basically load the page within itself and allow you to input data via the program rather than going to the actual site using you

A constant is a meaningful name which takes the place of a number or string and never alters. VBScript described a number of intrinsic constants. You can get thorough information r

Goal Create a Visual Basic that allows a user to play a variation of Hangman. User Inputs • The user types a letter into the textbox. Functional Items 1. Read a series

Depreciation to a Salvage Value of 0.   For tax purposes an item may be depreciated over a period of several years, n. With the straight-line method of depreciation, each year th


You can employ until keyword in two ways to verify a condition in a Do...Loop statement. You can verify the condition before you enter the loop (as illustrated in the following Chk

Dialog Based Application: (A) Dialog Based Application to demonstrate Animate Control: 1. Build a dialog based application. 2. Design the dialog as shown. 3. Place