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++

Coding, Write an event procedure to automate the billing system of a superm...

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

Dictionary object in vbscript, The Dictionary object stores data as key, it...

The Dictionary object stores data as key, item pairs. A Dictionary object is the corresponding of a PERL associative array. Items, that can be any form of data, are stored in the a

To calculate rectangle, two sides are given of a sheet e.g 23*36 i want hal...

two sides are given of a sheet e.g 23*36 i want half or 1/2 of this sheet next i want 1/4(one fourth) of this sheet if sheet size is 23*36 next i want 1/8 similary as above

Aim - control statement, Aim: To exhibit what is the day when the seco...

Aim: To exhibit what is the day when the second command button is clicked and to clear the screen when the first command button is clicked. The functioning of this program is

Windows programming, WINDOWS PROGRAMMING The Windows programming is a d...

WINDOWS PROGRAMMING The Windows programming is a developing application using the C and the native Win32 application interface (API) or C++ and the class libraries like Microso

Programming, steps of connecting database from vb6.0

steps of connecting database from vb6.0

Kitchen mock, How to pull ordered menu from a cash till to database or disp...

How to pull ordered menu from a cash till to database or display on a computer screen

Visual interface based on visual patterns , Visual Interface  Based On Vis...

Visual Interface  Based On Visual Patterns: The visual user interface should create recognizable patterns and text will be used for differentiating the objects with similar pa

Accelerators - intrinsic control, Accelerators: The Accelerators are s...

Accelerators: The Accelerators are short cut keys. The Accelerators are formed by placing an ampersand before any of the characters of the Caption. As a product the letter fol

Steps for creating a multiple document interface (mdi) form, Steps for Crea...

Steps for Creating A MDI Form: 1. Build a new form and set IsMdiContainer property to true. 2. Build a child form class to add to the form. 3. Now Right click the proj

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