Illustration of ccolordialog, Visual Basic Programming

Assignment Help:

ILLUSTRATION OF CCOLORDIALOG

The constructor of the CColorDialog takes the initial parameter as the default color and the next parameter specifies how much the dialog is displayed. It is a modal dailog. The Modal dialogs are exhibited using the DoModal() function. The Modal dialog required to be disposed by clicking the ok or cancel button. To build a color dialog follow the steps as shown below.

1. Generate a SDI application.

2. Handle the Right button double click message for the CcolordlgView object id.

3. In response to Step 2 the event handler will be inserted in the colordlgView.cpp.

4. Generate a device context with which you can draw by using the CClientDC class.

5. Generate a color dialog object by using the CColorDialog class. In this situation dlg is the color dialog object.

6. The initial parameter RGB(255,0,0) shows that the Red is the default color.

7. The modal dialog is displayed by using the DoModal function as the dlg.DoModal()

8. We are going to choose a color from the color dialog.

9. Consequently create a variable color by using COLORREF.

10. The variable color is assigned the color by using the GetColor() function.

11. Generate a Cbrush object (mybrush) with the selected color to draw.

12. Use the selected color with the SelectObject function.

13. The SelectObject function will put into use of the new GDI object and return the present object.

14. By using the new color namely red, that is the default color, an ellipse would be drawn when the right button is double clicked.

15. Execute the project, double click the right button, select a color and click the ok button of the color dialog.

16. An ellipse would be filled with the selected color.

void CColordlgView::OnRButtonDblClk(UINT nFlags, CPoint point)

{

CClientDC dc(this);

CColorDialog dlg(RGB(255,0,0),CC_FULLOPEN);

/* RGB(255,0,0) red color, default also red color*/

dlg.DoModal();

COLORREF color = dlg.GetColor();

//color can be a var and assign value

CBrush mybrush(color);

dc.SelectObject(&mybrush);

dc.Ellipse(20,40,100,150);

}


Related Discussions:- Illustration of ccolordialog

ER DIAGRAM FOR DISTRIBUTER MANAGEMENT, HOW TO MAKE ER DIAGRAM FOR DISTRIBUT...

HOW TO MAKE ER DIAGRAM FOR DISTRIBUTER MANAGEMNET OF WATER PURIFIAR

Find the total cost, Case: Design a web page that contains the VBScript uti...

Case: Design a web page that contains the VBScript utilized for calculating subtotals, taxes, discounts & totals as well as code utilized to validate use

Create an application for hospital management, 1.   Make project in Visual ...

1.   Make project in Visual Studio 2008. 2.   Controller Class is used for functioning. 3.   Login Form where three people can login like manager, staff and receptionist we c

Application Deployment , I would like to know how to deploy a VB.NET Applic...

I would like to know how to deploy a VB.NET Application using SQL SERVER as a back-end database

Files in a visual basic project, FILES IN A VB PROJECT The project file...

FILES IN A VB PROJECT The project file has the.vbp extension. The form in which we draw has the .frm extension; .mod denotes the module file; .cls denotes the class file; .res

While loop - vbscript, In VBScript, the While...Wend statement is provided ...

In VBScript, the While...Wend statement is provided for those who are familiar along its usage. However, due to the lack of flexibility in While...Wend, it is suggested that you us

Drawing, #questiontypes of lines and how to draw

#questiontypes of lines and how to draw

Creating constants in vbscript, In VBScript, You create user-defined consta...

In VBScript, You create user-defined constants using the Const statement. It lets you create string or numeric constants along with meaningful names and let you to assign them lite

Loan program, need help with logic part of loan program

need help with logic part of loan program

Vbscript dictionary object properties, Just like normal objects Dictionary ...

Just like normal objects Dictionary object also has definite properties. These properties can be set to any valid value & can be retrieved as and while required. Pr

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