Asp. NET gets all color values sample

Source: Internet
Author: User

  This article mainly introduces asp.net to obtain all color values of the method, the need for friends can refer to the following

(1) How to add the fonts available in the computer to the ComboBox in the WinForm:  a word to be done: ComboBox1.Items.AddRange (fontfamily.families);    (2) Get all available colors and fill in the ASP.net drop-down menu:    code as follows: propertyinfo[] properties;  ArrayList color color;  //SolidBrush brush;  properties = typeof (Color). GetProperties (BindingFlags.Public | bindingflags.static);  colors = new ArrayList ();  foreach (PropertyInfo prop in properties)   { //GE t 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 (col OR); //colors. ADD (Brush); }    (3) How do I get the connection string for the database?   A. Create a new text file with the filename *.udl (for example: mydb.udl), where the icon becomes the icon for the database connection.   B. Double-click this file to eject the dialog box for the properties of the data connection.Now you can set it up. Generally, we first select the "Provider" tab, after setting, and then set the related properties of the Connection tab, I will not say anything else. When you have set it up, press OK at the end. There may be a corresponding hint, you can do it yourself.   C. Use Notepad to open the file you just made. Inside there is a string like this:  provider=sqloledb.1; PASSWORD=123456SA; Persist Security info=true; User Id=sa;initial Catalog=zpweb;data source=myservername  if the SQL Server database is used, the provider=sqloledb.1 is changed to: Server= localhost: you can.    

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.