asp.net 產(chǎn)生隨機(jī)顏色實(shí)現(xiàn)代碼
來(lái)源:懂視網(wǎng)
責(zé)編:小采
時(shí)間:2020-11-27 22:43:49
asp.net 產(chǎn)生隨機(jī)顏色實(shí)現(xiàn)代碼
asp.net 產(chǎn)生隨機(jī)顏色實(shí)現(xiàn)代碼: 代碼如下:public string GetRandomColor() { Random RandomNum_First = new Random((int)DateTime.Now.Ticks); // 對(duì)于C#的隨機(jī)數(shù),沒(méi)什么好說(shuō)的 System.Threading.Thread.Sleep(RandomNum_First.Next(
導(dǎo)讀asp.net 產(chǎn)生隨機(jī)顏色實(shí)現(xiàn)代碼: 代碼如下:public string GetRandomColor() { Random RandomNum_First = new Random((int)DateTime.Now.Ticks); // 對(duì)于C#的隨機(jī)數(shù),沒(méi)什么好說(shuō)的 System.Threading.Thread.Sleep(RandomNum_First.Next(
代碼如下:
public string GetRandomColor()
{
Random RandomNum_First = new Random((int)DateTime.Now.Ticks);
// 對(duì)于C#的隨機(jī)數(shù),沒(méi)什么好說(shuō)的
System.Threading.Thread.Sleep(RandomNum_First.Next(50));
Random RandomNum_Sencond = new Random((int)DateTime.Now.Ticks);
// 為了在白色背景上顯示,盡量生成深色
int int_Red = RandomNum_First.Next(256);
int int_Green = RandomNum_Sencond.Next(256);
int int_Blue = (int_Red + int_Green > 400) ? 0 : 400 - int_Red - int_Green;
int_Blue = (int_Blue > 255) ? 255 : int_Blue;
return Color.FromArgb(int_Red, int_Green, int_Blue).Name;
}
聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com
asp.net 產(chǎn)生隨機(jī)顏色實(shí)現(xiàn)代碼
asp.net 產(chǎn)生隨機(jī)顏色實(shí)現(xiàn)代碼: 代碼如下:public string GetRandomColor() { Random RandomNum_First = new Random((int)DateTime.Now.Ticks); // 對(duì)于C#的隨機(jī)數(shù),沒(méi)什么好說(shuō)的 System.Threading.Thread.Sleep(RandomNum_First.Next(