ASP.NET取得所有顏色值示例
更新時(shí)間:2014年03月13日 17:26:52 作者:
這篇文章主要介紹了ASP.NET取得所有顏色值的方法,需要的朋友可以參考下
(1)怎樣將電腦里有可用字體加入WINFORM中的ComboBox中:
一句話搞定:comboBox1.Items.AddRange (FontFamily.Families);
(2)取得所有可用顏色并填充到asp.net的下拉菜單中:
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)怎樣取得數(shù)據(jù)庫(kù)的連接字符串?
A. 新建一個(gè)文本文件,文件名使用*.udl(比如:myDB.udl),此時(shí)發(fā)現(xiàn)圖標(biāo)變成數(shù)據(jù)庫(kù)連接的圖標(biāo)了。
B. 雙擊此文件,彈出數(shù)據(jù)連接屬性的對(duì)話框,此時(shí)你可以進(jìn)行設(shè)置了。一般地,我們首先選擇“提供程序”的選項(xiàng)卡,進(jìn)行設(shè)置之后,再設(shè)置“連接”選項(xiàng)卡的相關(guān)屬性,其他的我就不說(shuō)了。設(shè)置好之后,最后按“確定”??赡軙?huì)有相應(yīng)的提示,你自己看著辦吧。
C. 用記事本打開(kāi)你剛才的這個(gè)文件。里面有類似這樣的字符串:
Provider=SQLOLEDB.1;Password=123456sa;Persist Security Info=True;User ID=sa;Initial Catalog=ZPWeb;Data Source=MyServerName
如果使用SQLSERVER數(shù)據(jù)庫(kù),將Provider=SQLOLEDB.1;改為:Server=localhost;即可。
一句話搞定:comboBox1.Items.AddRange (FontFamily.Families);
(2)取得所有可用顏色并填充到asp.net的下拉菜單中:
復(fù)制代碼 代碼如下:
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)怎樣取得數(shù)據(jù)庫(kù)的連接字符串?
A. 新建一個(gè)文本文件,文件名使用*.udl(比如:myDB.udl),此時(shí)發(fā)現(xiàn)圖標(biāo)變成數(shù)據(jù)庫(kù)連接的圖標(biāo)了。
B. 雙擊此文件,彈出數(shù)據(jù)連接屬性的對(duì)話框,此時(shí)你可以進(jìn)行設(shè)置了。一般地,我們首先選擇“提供程序”的選項(xiàng)卡,進(jìn)行設(shè)置之后,再設(shè)置“連接”選項(xiàng)卡的相關(guān)屬性,其他的我就不說(shuō)了。設(shè)置好之后,最后按“確定”??赡軙?huì)有相應(yīng)的提示,你自己看著辦吧。
C. 用記事本打開(kāi)你剛才的這個(gè)文件。里面有類似這樣的字符串:
Provider=SQLOLEDB.1;Password=123456sa;Persist Security Info=True;User ID=sa;Initial Catalog=ZPWeb;Data Source=MyServerName
如果使用SQLSERVER數(shù)據(jù)庫(kù),將Provider=SQLOLEDB.1;改為:Server=localhost;即可。
相關(guān)文章
ASP.NET Core 7 Razor Pages項(xiàng)目發(fā)布到IIS的詳細(xì)過(guò)程
這篇文章主要介紹了ASP.NET Core 7 Razor Pages項(xiàng)目發(fā)布到IIS的詳細(xì)過(guò)程,詳細(xì)介紹了發(fā)布過(guò)程遇到的問(wèn)題及解決方法,對(duì)ASP.NET Core 發(fā)布到IIS相關(guān)知識(shí)感興趣的朋友一起看看吧2023-01-01
Asp.net通過(guò)SignalR2進(jìn)行實(shí)時(shí)聊天
這篇文章介紹了Asp.net通過(guò)SignalR2進(jìn)行實(shí)時(shí)聊天的方法,文中通過(guò)示例代碼介紹的非常詳細(xì)。對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2022-05-05
asp.net開(kāi)發(fā)微信公眾平臺(tái)之驗(yàn)證消息的真實(shí)性
這篇文章主要介紹了asp.net開(kāi)發(fā)微信公眾平臺(tái)之驗(yàn)證消息的真實(shí)性的相關(guān)資料,需要的朋友可以參考下2015-06-06
asp.net操作過(guò)程中常見(jiàn)錯(cuò)誤的解決方法
這篇文章主要介紹了asp.net操作過(guò)程中常見(jiàn)錯(cuò)誤的解決方法,主要有IIS無(wú)法識(shí)別ASP.NET、 SQL Server不允許進(jìn)行遠(yuǎn)程連接可能會(huì)導(dǎo)致此失敗等問(wèn)題,感興趣的小伙伴們可以參考一下2015-10-10
.NET開(kāi)發(fā)人員關(guān)于ML.NET的入門學(xué)習(xí)
隨著谷歌,F(xiàn)acebook發(fā)布他們的工具機(jī)器學(xué)習(xí)工具Tensorflow 2和PyTorch,微軟也發(fā)布了ML.NET 1.0??梢哉f(shuō)2019年是機(jī)器學(xué)習(xí)社區(qū)普及化的一年,下面小編向大家簡(jiǎn)單介紹一下關(guān)于ML.NET的入門學(xué)習(xí)2019-05-05
Asp.Net 通用數(shù)據(jù)操作類 (附通用數(shù)據(jù)基類)
以前經(jīng)常用php的數(shù)據(jù)操作類,這次的asp.net數(shù)據(jù)操作類,是個(gè)方法2008-07-07
ASP.NET WebService中使用ASP.NET_SessionId的問(wèn)題說(shuō)明
proxy.CookieContainer存儲(chǔ)了客戶端的 ASP.NET_SessionId。這樣以后每次通過(guò)webservice 方法調(diào)用時(shí),都會(huì)將ASP.NET_SessionId傳遞到服務(wù)器端。2011-09-09

