0% found this document useful (0 votes)
27 views8 pages

Lecture 8

The document discusses different types of common dialog boxes in C#, including color, font, and print dialog boxes. It provides examples of how to display each dialog box and apply the user's selections, such as changing a picture box color using the color dialog selection or setting the font for a rich text box from the font dialog box choice. Code samples are given to demonstrate opening each dialog box and performing actions based on the user's inputs.

Uploaded by

zaituna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views8 pages

Lecture 8

The document discusses different types of common dialog boxes in C#, including color, font, and print dialog boxes. It provides examples of how to display each dialog box and apply the user's selections, such as changing a picture box color using the color dialog selection or setting the font for a rich text box from the font dialog box choice. Code samples are given to demonstrate opening each dialog box and performing actions based on the user's inputs.

Uploaded by

zaituna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Visual Programming C#

Yasser N. Mohammed
Color Dialog Box

There are several classes that implement common dialog boxes, such as color
selection , print setup etc.

- A ColorDialog object is a dialog box


with a list of colors that are defined
for the display system. 

- The user can select or create


a particular color from the list,
which is then reported back to
the application when the dialog box
exits.

2
-You can invite a color dialog box by calling ShowDialog() method.

ColorDialog dialog= new ColorDialog();


dialog.ShowDialog();

EX1: The following C# program invites a color dialog box to :


1 - Change the picturebox to the selected color.
2 – Print the color name on the label2
3 – Print RGB results on the label3

3
The Code

4
Font Dialog Box

Font dialog box represents a common dialog box that displays a list of fonts
that are currently installed on the system.

The Font dialog box lets the user choose attributes for a logical font, such as
font family and associated font style, point size, effects , and a script .

5
Ex2 : The following C# program invites a Font Dialog Box to:
1 – Print the selected Font Name and Font Size.
2 – Apply the selected font on the richTextBox1.

The Code

6
Print Dialog Box

• A user can use the Print dialog box to select a printer, configure it, and
perform a print job.

• Print dialog boxes provide an easy way to implement Print and Print Setup
dialog boxes in a manner consistent with Windows standards.

7
Ex3 : The following C# program invites a Print Dialog Box to print a document.

You might also like