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

Write a program to sort and display an array, Problem 1. Describe the i...

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

Gdi object cpen, Illustration of GDI object CPen: 1. Generate a SDI ap...

Illustration of GDI object CPen: 1. Generate a SDI application. And name it as gdipen. 2. Press ctrl (control key) and W altogether to invoke the class wizard. 3. Choose

Input box - dialogue box in visual basic , Input Box: To demonstrate t...

Input Box: To demonstrate the use of the Input Box as shown in figure. Now consider the illustration shown below: 1. Initiate a new project 2. Select the standard exe

Vbscript procedures, A Sub procedure is a series of VBScript statements, en...

A Sub procedure is a series of VBScript statements, enclosed through Sub & End Sub statements which perform actions however don't return a value. A Sub procedure can take arguments

Making decisions with select case, The Select Case structure provides an op...

The Select Case structure provides an option to If...Then...Else If for selectively executing one block of statements from amongst multiple blocks of statements. Any Select Case st

Modeless dialog, MODELESS DIALOG The Dialog boxes are either modal or m...

MODELESS DIALOG The Dialog boxes are either modal or modeless. The modal dialog box should be closed (Unloaded or hidden) before you can continue the working with the rest of t

Visual processing - visual interface design, Visual Processing: Our mi...

Visual Processing: Our mind groups the things into patterns and this allows us to process the visual information. Understanding and applying how the human mind processes the v

Program to order a product from inventory, Write a program that permits the...

Write a program that permits the user to order a product from inventory. The user selects the product and enters the quantity. If there is sufficient quantity on hand of the produc

Data types, what are the basic vb data types

what are the basic vb data types

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