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 have a database i want mange it network and i want write it with vb.net so how i can do this

Write Visual Basic programs for the following: 1.     Write a program that uses a "For Loop" to generate a list of temperature conversions in one degree increments from a given

Problem 1. Describe the importance and usage of .net framework in visual Studio 2. Write a program to sort and display an array of integers in ascending order using the conc

VBScript Operators VBScript contain a full range of operators, including comparison operators, arithmetic operators, concatenation operators, and logical operators.

i want to use two forms in vb.net. when the progress bar in form1 reaches on a specific value then disable form1 and progress bar will stop and the second Form2 will popup which wi

Write an event procedure to automate the billing system of a supermarket. Give the details of database tables, forms, controls and menu design (if any). Make assumptions, wherever

Hungarian Notation: The Hungarian Notation was invented by Charles Simonyi from Microsoft. It is a naming convention. It is a reminder of the type of a variable. The Handles h

Cdatabase Class: The CDataBase class helps to connect to the data source. The Open member function opens a connection to the data source. CRecordset class is used for performi

Restricting The Vocabulary: The properly formed vocabulary is like an inverted pyramid. All easy to learn communication system follow this pattern. The canonical vocabulary in