handeditorform.cs

来自「中文名:Windows Forms 程序设计 英文名:Windows Form」· CS 代码 · 共 42 行

CS
42
字号
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace AlarmClockControlLibrary {
  partial class HandEditorForm : Form {

    Hand hand;

    public HandEditorForm() {
      InitializeComponent();
    }

    public Hand Hand {
      get { return this.hand; }
      set { this.hand = value; }
    }

    private void HandEditorForm_Load(object sender, EventArgs e) {

      // Set controls from passed in Hand type
      this.colorPanel.BackColor = this.hand.Color;
      this.widthNumericUpDown.Value = this.hand.Width;
    }

    private void okButton_Click(object sender, System.EventArgs e) {
      DialogResult = DialogResult.OK;
      this.hand = new Hand(this.colorPanel.BackColor, (int)this.widthNumericUpDown.Value);
      this.Close();
    }

    private void colorButton_Click(object sender, EventArgs e) {
      this.colorDialog.Color = this.colorPanel.BackColor;
      this.colorDialog.ShowDialog();
      this.colorPanel.BackColor = this.colorDialog.Color;
    }
  }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?