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

C#, I HAVE A C# ASSIGNMENT , WILL I FIND SOMEONE PROFESSIONAL HELP HERE ?

I HAVE A C# ASSIGNMENT , WILL I FIND SOMEONE PROFESSIONAL HELP HERE ?

Conditional statements, You can control the flow of your script with condit...

You can control the flow of your script with conditional statements & looping statements.  By using conditional statements, you can write VBScript code which makes decisions and re

Objective of vb script, The objective of this unit is to describe the basic...

The objective of this unit is to describe the basics of VBScript. After completing this unit, you will be capable to write code for Web pages via VBScript. You will be able to unde

Web Scraping via program, I''m trying to create a program in VB.net that wi...

I''m trying to create a program in VB.net that will basically load the page within itself and allow you to input data via the program rather than going to the actual site using you

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

Wage calculator and ta calculations, ( Wage Calculator with Tax Calculation...

( 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

Default values for gdi objects, Default Values for GDI Objects: The de...

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

Application for vehicle dealership, A vehicle dealership has a number of di...

A vehicle dealership has a number of different items for sale: motorbikes, cars, vans and boats. Each class of items for sale has different characteristics that need to be recor

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

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