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 need a VB6 software for making a soccerboard for 10 teams & automatically generate their fixtures

( Wage Calculator with Tax Calculations) Develop an application that calculates an employee’s earnings, as shown in Fig. 4.23. The user should provide the hourly wage and number of

i need to do my final project for my last year bsc honours degree in Business Information systems. I need to develop a system which is operational for hotel management system. th

DIALOG BOXES IN VB The two dialog boxes, namely, the message box and the input box are usually used in the Visual Basic. The message box is used for displaying the messages to

Variables must always be described with the smallest scope possible. VBScript variables can have the given scope. Scope Where Variable is Declared


HOW TO SOLVE ORDINARY DIFFERENTIAL EQUETION IN VISUAL BASIC PROGRAMMING

DYNAMIC LINK LIBRARY - DLL   The DLL are files which can be called when required by the other program that is running in the computer. The DLL files which support the specific

In VBScript, the While...Wend statement is provided for those who are familiar along its usage. However, due to the lack of flexibility in While...Wend, it is suggested that you us

Databound Controls - A controls use to display the contents of table using Data Control , have to bound each Control to the specific field and the controls are Known as the Data Bo