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,


CClientDC dc(this);






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
I have an external application I open from visual studio (excel). I want to reposition where that opens (top, left).. How do I do that?

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.

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

The scope of a variable is finding out by where you declare it. While you declare a variable in a procedure, only code in that procedure can access or alter the value of that varia

MENUS AND TOOL BARS   The Menu options can be checked, enabled, disabled, and popped up on an object. The Menu Object: The Menu control is used to generate a menu in

i want to use two forms in when the progress bar in form1 reaches on a specific value then disable form1 and progress bar will stop and the second Form2 will popup which wi

i have a database i want mange it network and i want write it with so how i can do this

Adding Events in VB   For adding the events in VB, first double click on the command button with the caption hello. The Private Sub command1_Click () and End Sub would be

Create a VB calculator application that appears as in the screen shots below. The user enters numbers in the textboxes labelled Number 1 and Number 2. When a calculati

Visual Basic 1. What is the method of creating a new project in VB.SSS 2. Illustrate Code Editor Window and Solution Explorer. 3. Write a VB program to sort and display a