Gdi object cpen, Visual Basic Programming

Assignment Help:

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.


Related Discussions:- Gdi object cpen

Message box - dialog box in visual basic, Message Box: The Message Box...

Message Box: The Message Box can be specified a title as shown in figure to specify the title for the message box follow by the command given below:  Private Sub Command1_C

Numeric data types - visual basic, Numeric data types: The Integer, lo...

Numeric data types: The Integer, long integer are used for entire numbers. Single and doubles are related with the floating point numbers. Currency is related with numbers dea

Collection is adding last record, Please help me.. I am loading data from ...

Please help me.. I am loading data from a text file to a class (Item Inventory from Tony Gaddis - Visual Basic - Chapter 12 -programming challange# 7-9) and the last item loaded is

Arrays, I need to design a logic for a program that allows a user to enter ...

I need to design a logic for a program that allows a user to enter 15 numbers, then displays each number and its difference from the numeric average of the numbers entered

XML document, Write a XML with database with book details (BOOK ID, Title, ...

Write a XML with database with book details (BOOK ID, Title, Author, subject, published Year, language, vendor, price)

Retrieval methods - document in visual programming, Retrieval Methods: ...

Retrieval Methods: There are 3 ways to find a document. The primary method is a positional retrieval. This is achieved by keeping in mind where you left it. The next method is

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

Functions, write a v.net function called is vowel that returns true for vow...

write a v.net function called is vowel that returns true for vowel letters

Variable length strings, Variable Length Strings: The Strings can be de...

Variable Length Strings: The Strings can be declared using As or $ as shown in the code below; the msg and msg1 are the two strings and they are assigned the values using '='.

Login form, How to create a login form in vb 2010

How to create a login form in vb 2010

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