Gdi object cpen, Visual Basic Programming

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 the message maps tab into the class wizard.

4. Choose the CGdipenView object id and click the WM_MOUSEMOVE message and then click ok.

5. In response OnMouseMove handler will be inserted in the implementation file gdipenView.cpp as shown below.

6. Now type the coding which is below in the handler.

void CGdipenView::OnMouseMove(UINT nFlags, CPoint point)

{

CPen p(PS_SOLID, 2,

RGB(255,205,255)),pe(PS_DASH,1,RGB(150,200,250));

CClientDC dc(this);

dc.SelectObject(&p);

dc.Rectangle(10,20,50,100);

dc.SelectObject(&pe);

dc.Rectangle(100,20,50,100);

}

7. The PS_SOLID macro in the CPen constructor tells the pen style. The second parameter is the thickness of the pen, namely 2. The third argument indicates the color of the pen. The other pen object is created as pe. Then the 2 Rectangles with the pens p and pe are drawn.

8. Change the thickness, style, and color.

9. Construct the project and execute it to see the impact of the change incorporated.

10. The rectangles would be exhibited when the mouse is moved in the window exhibited.

11. Change the thickness, color, and style of the pen and examine the output after building and executing the project.

Posted Date: 10/10/2012 1:35:03 AM | Location : United States







Related Discussions:- Gdi object cpen, Assignment Help, Ask Question on Gdi object cpen, Get Answer, Expert's Help, Gdi object cpen Discussions

Write discussion on Gdi object cpen
Your posts are moderated
Related Questions
INTRODUCTION TO VB: The Windows programming is an event driven programming. The VB uses the Hungarian Notation for naming the variables. It deals with new data types like HWND,

DATA TYPES   The different primitive data types are Boolean, Char, Byte, Date, Decimal, Uinteger, Double, Integer, Long, Sbyte, Short, Single, String, Ulong & Ushort. To decla

For this assignment you have to design and implement a VB.NET project which prepares a bill of payment due, given the purchase amount. The project models a typical purchase transac

Problem 1. Describe the concept of exception in .Net environment 2. Explain the process of adding, updating and deleting records with an example 3. Explain DTD elements a

You are asked to create the LOTO game customized according to the following constraints: 1. Create a grid containing 20 numbers (20 buttons: button1, button2, …button20) 2. When t

FILE SYSTEM CONTROLS There are 3 file system controls as shown in figure. The drive list box, directory list box & the file list box. The drive list box control is used to exhi

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


DYNAMIC LINK LIBRARY - DLL   The DLL are files which can be called when required by the other program that is running in the computer. The DLL files which support the specific

Using Visual Studio 2010 C++ 1) Using Windows Explorer, make a copy of Irvine\examples\Project_sample folder in the folder where you keep your materials for this course.