熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> .NET編程 >> 正文

c#產生隨機顏色

2022-06-13   來源: .NET編程 

  using System;

  using SystemData;

  using SystemConfiguration;

  using SystemCollections;

  using SystemWeb;

  using SystemWebSecurity;

  using SystemWebUI;

  using SystemWebUIWebControls;

  using SystemWebUIWebControlsWebParts;

  using SystemWebUIHtmlControls;

  using SystemDrawing;

  public partial class Default : SystemWebUIPage

  {

  protected void Page_Load(object sender EventArgs e)

  {

  string k = getStrColor();

  LabelForeColor=SystemDrawingColorFromName( getStrColor());

  // LabelForeColor=ColorFromArgb(randomNext()randomNext()randomNext());

  }

  private static Random rand = new Random();

  public static string getStrColor()

  {

  Color color = ColorFromArgb(randNext());

  string strColor = # + ConvertToString(colorToArgb() )PadLeft( )Substring( );

  return strColor;

  }

  }


From:http://tw.wingwit.com/Article/program/net/201311/13902.html
  • 上一篇文章:

  • 下一篇文章:
  • 推薦文章
    Copyright © 2005-2022 電腦知識網 Computer Knowledge   All rights reserved.