コード例 #1
0
ファイル: Form1.cs プロジェクト: zjuluxi/BLD-Master
        public Form1()
        {
            InitializeComponent();
            rs = new RadioToolStripItems[] {
                new RadioToolStripItems(ebf, new string[] {
                    "UF", "UL", "UB", "UR", "DF", "DL", "DB", "DR", "FR", "FL", "BL", "BR"
                }),
                new RadioToolStripItems(cbf, new string[] {
                    "UFL", "UBL", "UBR", "UFR", "DFL", "DBL", "DBR", "DFR"
                }),
                new RadioToolStripItems(wbf, new string[] {
                    "UFr", "FUl", "ULf", "LUb", "UBl", "BUr", "URb", "RUf", "DFl", "FDr", "DLb", "LDf",
                    "DBr", "BDl", "DRf", "RDb", "FRu", "RFd", "FLd", "LFu", "BLu", "LBd", "BRd", "RBu"
                }),
                new RadioToolStripItems(ori, new string[] {
                    "白顶绿前", "白顶红前", "白顶蓝前", "白顶橙前", "绿顶黄前", "绿顶红前",
                    "绿顶白前", "绿顶橙前", "黄顶蓝前", "黄顶红前", "黄顶绿前", "黄顶橙前",
                    "蓝顶白前", "蓝顶红前", "蓝顶黄前", "蓝顶橙前", "橙顶绿前", "橙顶白前",
                    "橙顶蓝前", "橙顶黄前", "红顶绿前", "红顶黄前", "红顶蓝前", "红顶白前"
                })
            };
            rs[0].CheckedIndex = Settings.Default.ebf / 2;
            rs[1].CheckedIndex = Settings.Default.cbf / 3;
            rs[2].CheckedIndex = Settings.Default.wbf;
            rs[3].CheckedIndex = Settings.Default.ori;
            dftOri.Checked     = Settings.Default.dftOri;
            upsetCoord.Checked = Settings.Default.upsetCoord;
            signNum.Checked    = Settings.Default.signNum;

            var h = new KeyPressEventHandler((sender, e) =>
                                             e.Handled = !char.IsNumber(e.KeyChar) && e.KeyChar != (char)8);
            var h_ = new KeyPressEventHandler((sender, e) =>
                                              e.Handled = !char.IsNumber(e.KeyChar) && e.KeyChar != (char)8 &&
                                                          !(e.KeyChar == '-' && (sender as TextBox).Text.IndexOf('-') < 0));

            foreach (Control c in MyControl())
            {
                if (c is ComboBox cb)
                {
                    cb.SelectedIndex = 0;
                }
                else if (c is TextBox tb)
                {
                    tb.KeyPress += tb.MaxLength == 5 ? h_ : h;
                }
            }
            cc = cc3;
        }
コード例 #2
0
ファイル: Form1.cs プロジェクト: zjuluxi/BLD-Master
 private void Mode_Changed(object sender, EventArgs e)
 {
     if (sender == mode3)
     {
         edgeBox.Enabled     = mode3.Checked = true;
         wingBox.Enabled     = xcenterBox.Enabled = mode4.Checked = false;
         amountBox.MaxLength = 3;
         cc = cc3;
     }
     else
     {
         edgeBox.Enabled     = mode3.Checked = false;
         wingBox.Enabled     = xcenterBox.Enabled = mode4.Checked = true;
         amountBox.MaxLength = 2;
         cc = cc4;
     }
     result.Clear();
 }