(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.