コード例 #1
0
ファイル: CommandButton.cs プロジェクト: kamackay/KD
 /// <summary>
 /// 
 /// </summary>
 /// <param name="c"></param>
 public CommandButton(Commands c)
 {
     InitializeComponent();
     this.Height = 60;
     this.Width = TextRenderer.MeasureText(c.GetDescription(), new Font("Arial", 10F, FontStyle.Regular)).Width + 10; ;
     this.command = c.ToString();
     this.Click += c.GetAction();
     this.description = c.GetDescription();
     this.FlatStyle = System.Windows.Forms.FlatStyle.Flat;
     this.FlatAppearance.MouseOverBackColor = this.FlatAppearance.MouseDownBackColor = SystemColors.ActiveCaption;
     this.FlatAppearance.BorderSize = 1;
     this.BackColor = SystemColors.ControlDark;
     ToolTip tt = new ToolTip();
     tt.SetToolTip(this, String.Concat(this.command, ": ", this.description));
     Bitmap b = c.GetImage();
     if (b == null) return;
     b = b.ResizeByHeight(60);
     this.BackColor = SystemColors.ControlDarkDark;
     this.BackgroundImage = b;
     this.Width = 60;
     this.BackgroundImageLayout = ImageLayout.Stretch;
     this.drawText = false;
 }