首页 > 开发 > 综合 > 正文

自制作调色板(转)

2024-07-21 02:23:54
字体:
来源:转载
供稿:网友
using system;
using system.winforms;
using system.drawing;
       
public class createmypanel : form
{  
  color[] color = new color[]{
                        color.aliceblue,
color.antiquewhite,
color.aqua,
color.aquamarine,
color.azure,
color.beige,
color.bisque,
color.black,
color.blanchedalmond,
color.blue,
color.blueviolet,
color.brown,
color.burlywood,
color.cadetblue,
color.chartreuse,
color.chocolate,
color.coral,
color.cornflower,
color.cornsilk,
color.crimson,
color.cyan,
color.darkblue,
color.darkcyan,
color.darkgoldenrod,
color.darkgray,
color.darkgreen,
color.darkkhaki,
color.darkmagenta,
color.darkolivegreen,
color.darkorange,
color.darkorchid,
color.darkred,
color.darksalmon,
color.darkseagreen,
color.darkslateblue,
color.darkslategray,
color.darkturquoise,
color.darkviolet,
color.deeppink,
color.deepskyblue,
color.dimgray,
color.dodgerblue,
color.firebrick,
color.floralwhite,
color.forestgreen,
color.fuchsia,
color.gainsboro,
color.ghostwhite,
color.gold,
color.goldenrod,
color.gray,
color.green,
color.greenyellow,
color.honeydew,
color.hotpink,
color.indianred,
color.indigo,
color.ivory,
color.khaki,
color.lavender,
color.lavenderblush,
color.lawngreen,
color.lemonchiffon,
color.lightblue,
color.lightcoral,
color.lightcyan,
color.lightgoldenrodyellow,
color.lightgray,
color.lightgreen,
color.lightpink,
color.lightsalmon,
color.lightseagreen,
color.lightskyblue,
color.lightslategray,
color.lightsteelblue,
color.lightyellow,
color.lime,
color.limegreen,
color.linen,
color.magenta,
color.maroon,
color.mediumaquamarine,
color.mediumblue,
color.mediumorchid,
color.mediumpurple,
color.mediumseagreen,
color.mediumslateblue,
color.mediumspringgreen,
color.mediumturquoise,
color.mediumvioletred,
color.midnightblue,
color.mintcream,
color.mistyrose,
color.moccasin,
color.navajowhite,
color.navy,
color.oldlace,
color.olive,
color.olivedrab,
color.orange,
color.orangered,
color.orchid,
color.palegoldenrod,
color.palegreen,
color.paleturquoise,
color.palevioletred,
color.papayawhip,
color.peachpuff,
color.peru,
color.pink,
color.plum,
color.powderblue,
color.purple,
color.red,
color.rosybrown,
color.royalblue,
color.saddlebrown,
color.salmon,
color.sandybrown,
color.seagreen,
color.seashell,
color.sienna,
color.silver,
color.skyblue,
color.slateblue,
color.slategray,
color.snow,
color.springgreen,
color.steelblue,
color.tan,
color.teal,
color.thistle,
color.tomato,
color.transparent,
color.turquoise,
color.violet,
color.wheat,
color.white,
color.whitesmoke,
color.yellow,
color.yellowgreen
};
  private panel panel1 = new panel();
  private label[] col = new label[141];


  public createmypanel()
  {     
  
   // initialize the panel control.
   panel1.location = new point(clientrectangle.left + 5,clientrectangle.top + 5);
   panel1.size = new size(clientrectangle.right-5, clientrectangle.bottom-5);  
   panel1.borderstyle = system.winforms.borderstyle.fixed3d;
   this.controls.add(panel1); // add the panel control to (inside) the form.  
   // initalize the label controls.  
   int ystart = clientrectangle.top;

   for(int j=0; j<141; j++)
      col[j] = new label();

   for(int i = 0; i<141; i++)
   {
     col[i].size = new size(clientrectangle.right, 20);  
     col[i].font = new system.drawing.font("comic sans ms",10,fontstyle.bold);  
     col[i].forecolor = color.black;
     if(col[i].equals(color.black) == true)
     {   col[i].forecolor = color.white;
     }
     col[i].text = color[i].tostring();
     col[i].location = new point(clientrectangle.left,ystart);
     col[i].backcolor = color[i];
     col[i].borderstyle = system.winforms.borderstyle.fixed3d;  
     panel1.controls.add(col[i]);  // add the label controls to (inside) the panel.
     if((col[i].location.y > panel1.location.y))
     {
       panel1.autoscroll = true;   
     }  
     ystart += 20;
   }
  
   this.size = new size(315, 300);
   this.text = "a color guide - jayant";
   this.maximizebox = false;
   this.borderstyle = formborderstyle.fixeddialog;
   this.startposition = formstartposition.centerscreen;
  
  }

  public static void main()
  {
     application.run(new createmypanel());
  }
}  
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表