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
Executesql: The ExecuteSQL is used for executing the query on the database. The CRecordset uses the RFX mechanism to replace data between field data members of the record set

I need to design a logic for a program that allows a user to enter 15 numbers, then displays each number and its difference from the numeric average of the numbers entered

I have a problem with Visual Basic: exchangeable 2 images of place I have 2 picturebox''s placed a button when I click on the button, the 2 pictures of this place change with e

Variable Length Strings: The Strings can be declared using As or $ as shown in the code below; the msg and msg1 are the two strings and they are assigned the values using '='.

Assume you are creating an order entry and editing application for a book store. An order consists of a product, quantity, total price, payment type including Credit/Debit card acc

MESSAGES The Windows-based applications do not make explicit function calls to acquire input. They wait for the system to pass the input to them. The system passes input to the

Default Values for GDI Objects: The default color for the brush is white, pen is black, and default bitmap is null and the default font is system.

Write a XML with database with book details (BOOK ID, Title, Author, subject, published Year, language, vendor, price)

write a detailed account on ADO.net architecture.

how to make dictionary in vb using ms access