Example of ASP. NET getting all color values

Source: Internet
Author: User

(1) how to add available fonts to the ComboBox in WINFORM:
One sentence: comboBox1.Items. AddRange (FontFamily. Families );

(2) retrieve all available colors and fill them in the asp.net drop-down menu:
Copy codeThe Code is as follows:
PropertyInfo [] properties;
ArrayList colors;
Color color;
// SolidBrush brush;
Properties = typeof (Color). GetProperties (BindingFlags. Public | BindingFlags. Static );
Colors = new ArrayList ();
Foreach (PropertyInfo prop in properties)
{
// Get the value of this static property
Color = (Color) prop. GetValue (null, null );
// Skip colors that are not interesting
If (color = Color. Transparent) continue;
If (color = Color. Empty) continue;
Try
{
DdlList. Items. Add (prop. Name );
}
Catch
{
}
// Create a solid brush of this color
// Brush = new SolidBrush (color );
// Colors. Add (brush );
}

(3) how to obtain the database connection string?
A. Create A text file with the file name *. udl (for example, myDB. udl). Then, the icon becomes the database connection icon.
B. Double-click this file to bring up the data connection attribute dialog box. You can set it now. Generally, we first select the "provider" tab, and then set the relevant properties of the "connection" tab. After the settings, click "OK ". There may be corresponding prompts, you can do it yourself.
C. Open your file in notepad. There are strings like this:
Provider = SQLOLEDB.1; Password = 123456sa; Persist Security Info = True; User ID = sa; Initial Catalog = ZPWeb; Data Source = MyServerName
If you use the SQLSERVER database, change Provider = SQLOLEDB.1; To: Server = localhost.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.