VB.Net - ColorDialog Control - Tutorialspoint
Có thể bạn quan tâm
- VB.Net - Home
- VB.Net - Overview
- VB.Net - Environment Setup
- VB.Net - Program Structure
- VB.Net - Basic Syntax
- VB.Net - Data Types
- VB.Net - Variables
- VB.Net - Constants
- VB.Net - Modifiers
- VB.Net - Statements
- VB.Net - Directives
- VB.Net - Operators
- VB.Net - Decision Making
- VB.Net - Loops
- VB.Net - Strings
- VB.Net - Date & Time
- VB.Net - Arrays
- VB.Net - Collections
- VB.Net - Functions
- VB.Net - Subs
- VB.Net - Classes & Objects
- VB.Net - Exception Handling
- VB.Net - File Handling
- VB.Net - Basic Controls
- VB.Net - Dialog Boxes
- VB.Net - Advanced Forms
- VB.Net - Event Handling
- VB.Net - Regular Expressions
- VB.Net - Database Access
- VB.Net - Excel Sheet
- VB.Net - Send Email
- VB.Net - XML Processing
- VB.Net - Web Programming
- VB.Net Useful Resources
- VB.Net - Quick Guide
- VB.Net - Useful Resources
- VB.Net - Discussion
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- AI Based Resume Builder
- Personal AI Study Assistant
- Generate Coding Logic
- HR Interview Questions
- Computer Glossary
- Who is Who
The ColorDialog control class represents a common dialog box that displays available colors along with controls that enable the user to define custom colors. It lets the user select a color.
The main property of the ColorDialog control is Color, which returns a Color object.
Following is the Color dialog box −
Properties of the ColorDialog Control
The following are some of the commonly used properties of the ColorDialog control −
| Sr.No. | Property & Description |
|---|---|
| 1 | AllowFullOpen Gets or sets a value indicating whether the user can use the dialog box to define custom colors. |
| 2 | AnyColor Gets or sets a value indicating whether the dialog box displays all available colors in the set of basic colors. |
| 3 | CanRaiseEvents Gets a value indicating whether the component can raise an event. |
| 4 | Color Gets or sets the color selected by the user. |
| 5 | CustomColors Gets or sets the set of custom colors shown in the dialog box. |
| 6 | FullOpen Gets or sets a value indicating whether the controls used to create custom colors are visible when the dialog box is opened. |
| 7 | ShowHelp Gets or sets a value indicating whether a Help button appears in the color dialog box. |
| 8 | SolidColorOnly Gets or sets a value indicating whether the dialog box will restrict users to selecting solid colors only. |
Methods of the ColorDialog Control
The following are some of the commonly used methods of the ColorDialog control −
| Sr.No. | Method Name & Description |
|---|---|
| 1 | Reset Resets all options to their default values, the last selected color to black, and the custom colors to their default values. |
| 2 | RunDialog When overridden in a derived class, specifies a common dialog box. |
| 3 | ShowDialog Runs a common dialog box with a default owner. |
Events of the ColorDialog Control
The following are some of the commonly used events of the ColorDialog control −
| Sr.No. | Event & Description |
|---|---|
| 1 | HelpRequest Occurs when the user clicks the Help button on a common dialog box. |
Example
In this example, let's change the forecolor of a label control using the color dialog box. Take the following steps −
Drag and drop a label control, a button control and a ColorDialog control on the form.
Set the Text property of the label and the button control to 'Give me a new Color' and 'Change Color', respectively.
Change the font of the label as per your likings.
-
Double-click the Change Color button and modify the code of the Click event.
When the application is compiled and run using Start button available at the Microsoft Visual Studio tool bar, it will show the following window −
Clicking on the Change Color button, the color dialog appears, select a color and click the OK button. The selected color will be applied as the forecolor of the text of the label.
vb.net_dialog_boxes.htm Print Page Previous Next AdvertisementsTừ khóa » Visual Basic Colors
-
Settings
-
RGB Function (Visual Basic For Applications) - Microsoft Docs
-
RGB Colours - Excel At Finance
-
Excel VBA: ColorIndex Codes List & RGB Colors
-
Colors : Visual Basic - BrainBell
-
Excel VBA Color Code List - ColorIndex, RGB Color, VB Color
-
VB Colors Name List | MrExcel Message Board
-
Using The RGB Function - Event Procedures - Visual Basic Planet
-
RGB Function - VB & VBA In A Nutshell: The Language [Book]
-
Microsoft Visual Basic - Color Changer - FunctionX
-
VB.NET Color Names
-
[PDF] Everything You Wanted To Know About Visual Basic 6 Colors
-
Using Different Colors In Visual Basic - VB.Net Tutorial