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

ADO.net architecture, write a detailed account on ADO.net architecture.

write a detailed account on ADO.net architecture.

Application for loan, Scenario GetLoan is a new company that will provid...

Scenario GetLoan is a new company that will provide a loan of money to individual members of the public.   There are two types of loan to be offered: Secured Loan wher

Tab order - dialog, Tab Order: The tab order stands for the order in w...

Tab Order: The tab order stands for the order in which the controls receive focus when the user clicks the tab key. The CTRL + D can be used to set the tab order of controls.

Three models for user interface design, THREE MODELS FOR USER INTERFACE DES...

THREE MODELS FOR USER INTERFACE DESIGN   The 3 models for the user interface design are the implementation model, mental model &the manifest model. The Implementation Mod

Explain dtd elements and dtd attributes, Problem 1. Describe the concep...

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

Scalar variables and array variables, Mostly time, you just desire to assig...

Mostly time, you just desire to assign a single value to a variable you have declared. A variable having a single value is a scalar variable. At other times, this is convenient to

WebTime ASP.net , Let us modify the webTime ASP.NET project that we develop...

Let us modify the webTime ASP.NET project that we developed. We will add drop down lists for modifying the different style elements for the label element that displays the time. We

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.

Need help on macros in visual basic, I have an excel list with a lot's of s...

I have an excel list with a lot's of serial numbers that have been entered by hand from PDFs online (1-5 serial numbers per PDF). Many of the values are duplicates, wrong, or conta

Vb program for simple image processing, A program needs to be written that ...

A program needs to be written that is capable of simple image processing. All the images that are available for you to use, can be found on Blackboard in the Assignments section. T

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