コード例 #1
0
 private void SetButtonType(RectButton btn, string type)
 {
     btn.BackColor   = this.BackColor;
     btn.Style       = MyButtonType.rectButton;
     btn.colorTop    = Color.LightBlue;
     btn.colorShadow = this.BackColor;
     btn.Label       = StringResource.str(type);
 }
コード例 #2
0
ファイル: RxConfigWnd.cs プロジェクト: imdmmp/kpgweigher
        public RxConfigWnd()
        {
            InitializeComponent();


            btn_quit.Text = StringResource.str("quit");
            btn_quit.BackColor = this.BackColor;
            btn_quit.Style = MyButtonType.roundButton;
            btn_quit.ValidClick += new EventHandler((s, e) =>
            {
                if (!Rx.bEnabled)
                    Rx.bSelected = false;
                Program.SwitchWindow("mainconfig");
                //Program.mainwnd.Invoke(new Action<bool>(Program.mainwnd.ReDraw), new object[] { false });
            });

           
            RectButton[] kbdbtns = new RectButton[] { btn_measdelay, btn_meastimes, btn_rtp, btn_coefa, btn_coefb, btn_coefc, btn_serial };
            //keyboard input buttons
            foreach (RectButton rb in kbdbtns)
            {
                rb.Style = MyButtonType.rectButton;
                rb.BackColor = this.BackColor;

                Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label;
                lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", ""));

                rb.ValidClick += new EventHandler((s, e) =>
                {
                    string regname = (s as Control).Name.Remove(0, 4);
                    kbdWnd.Init(StringResource.str("input") + StringResource.str(regname), regname, false, KbdData);
                });
            }

            //choice buttons 
            RectButton[] choicebtns = new RectButton[] { btn_prbtype, btn_current, btn_range, btn_serial_select };
            foreach (RectButton rb in choicebtns)
            {
                rb.Style = MyButtonType.rectButton;
                rb.BackColor = this.BackColor;

                Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label;
                lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", ""));

                rb.ValidClick += new EventHandler((s, e) =>
                {
                    string regname = (s as Control).Name.Remove(0, 4);
                    ChoiceWnd.Init(StringResource.str("choose") + StringResource.str(regname),
                        regname,
                        StringResource.str("lst_" + regname).Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries),
                        0, null, KbdData);
                });
            }

            //toggle buttons 
            RectButton[] togglebtns = new RectButton[] { btn_sqrt, btn_enable };
            foreach (RectButton rb in togglebtns)
            {
                rb.Style = MyButtonType.rectButton;
                rb.BackColor = this.BackColor;

                //Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label;
                //lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", ""));

                rb.ValidClick += new EventHandler((s, e) =>
                {
                    string regname = (s as Control).Name.Remove(0, 4);
                    KbdData(regname, "");
                });
            }

            InitDisplay();
        }
コード例 #3
0
ファイル: RunWnd.cs プロジェクト: imdmmp/kpgweigher
 private void SetButtonType(RectButton btn, string type)
 {
     btn.BackColor = this.BackColor;
     btn.Style = MyButtonType.rectButton;
     btn.colorTop = Color.LightBlue;
     btn.colorShadow = this.BackColor;
     btn.Label = StringResource.str(type);
 }
コード例 #4
0
        public RxConfigWnd()
        {
            InitializeComponent();


            btn_quit.Text        = StringResource.str("quit");
            btn_quit.BackColor   = this.BackColor;
            btn_quit.Style       = MyButtonType.roundButton;
            btn_quit.ValidClick += new EventHandler((s, e) =>
            {
                if (!Rx.bEnabled)
                {
                    Rx.bSelected = false;
                }
                Program.SwitchWindow("mainconfig");
                //Program.mainwnd.Invoke(new Action<bool>(Program.mainwnd.ReDraw), new object[] { false });
            });


            RectButton[] kbdbtns = new RectButton[] { btn_measdelay, btn_meastimes, btn_rtp, btn_coefa, btn_coefb, btn_coefc, btn_serial };
            //keyboard input buttons
            foreach (RectButton rb in kbdbtns)
            {
                rb.Style     = MyButtonType.rectButton;
                rb.BackColor = this.BackColor;

                Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label;
                lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", ""));

                rb.ValidClick += new EventHandler((s, e) =>
                {
                    string regname = (s as Control).Name.Remove(0, 4);
                    kbdWnd.Init(StringResource.str("input") + StringResource.str(regname), regname, false, KbdData);
                });
            }

            //choice buttons
            RectButton[] choicebtns = new RectButton[] { btn_prbtype, btn_current, btn_range, btn_serial_select };
            foreach (RectButton rb in choicebtns)
            {
                rb.Style     = MyButtonType.rectButton;
                rb.BackColor = this.BackColor;

                Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label;
                lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", ""));

                rb.ValidClick += new EventHandler((s, e) =>
                {
                    string regname = (s as Control).Name.Remove(0, 4);
                    ChoiceWnd.Init(StringResource.str("choose") + StringResource.str(regname),
                                   regname,
                                   StringResource.str("lst_" + regname).Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries),
                                   0, null, KbdData);
                });
            }

            //toggle buttons
            RectButton[] togglebtns = new RectButton[] { btn_sqrt, btn_enable };
            foreach (RectButton rb in togglebtns)
            {
                rb.Style     = MyButtonType.rectButton;
                rb.BackColor = this.BackColor;

                //Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label;
                //lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", ""));

                rb.ValidClick += new EventHandler((s, e) =>
                {
                    string regname = (s as Control).Name.Remove(0, 4);
                    KbdData(regname, "");
                });
            }

            InitDisplay();
        }
コード例 #5
0
ファイル: SysConfigWnd.cs プロジェクト: imdmmp/kpgweigher
        public static extern bool SetLocalTime(ref SystemTime sysTime); //设置本地时

        public SysConfigWnd()
        {
            InitializeComponent();
            lbl_sysconfig.Text = StringResource.str("sysconfig");
            btn_quit.Text = StringResource.str("quit");
            btn_quit.BackColor = this.BackColor;
            btn_quit.Style = MyButtonType.roundButton;
            btn_quit.ValidClick += new EventHandler((s, e) =>
            {
                Program.SwitchWindow("mainwnd");
                Program.mainwnd.Invoke(new Action<bool>(Program.mainwnd.ReDraw), new object[] { false });
            });
            RectButton[] kbdbtns = new RectButton[] { btn_ktt, btn_measdelay, btn_meastimes, btn_shifttimes, btn_newdate, btn_sampletimes, btn_fltlength };
            //keyboard input buttons
            foreach (RectButton rb in kbdbtns)
            {
                rb.Style = MyButtonType.rectButton;
                rb.colorTop = Color.Beige;
                rb.BackColor = this.BackColor;
                
                Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"),true)[0] as Label;
                lbl.Text = StringResource.str(lbl.Name.Replace("lbl_",""));

                rb.ValidClick += new EventHandler((s, e) =>
                {
                    string regname = (s as Control).Name.Remove(0, 4);
                    kbdWnd.Init(StringResource.str("input") + StringResource.str(regname), regname, false, KbdData);
                });
            }

            //choice buttons 
            RectButton[] choicebtns = new RectButton[] { btn_flttype, btn_navmeter, btn_rxscanner, btn_rsscanner };
            foreach (RectButton rb in choicebtns)
            {
                rb.Style = MyButtonType.rectButton;
                rb.colorTop = Color.Beige;
                rb.BackColor = this.BackColor;

                Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"),true)[0] as Label;
                lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", ""));

                rb.ValidClick += new EventHandler((s,e) =>{
                    string regname = (s as Control).Name.Remove(0, 4);
                    ChoiceWnd.Init(StringResource.str("choose") + StringResource.str(regname),
                        regname,
                        StringResource.str("lst_" + regname).Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries),
                        0, null, KbdData);
                });
            }

            //toggle buttons 
            RectButton[] togglebtns = new RectButton[] { btn_throw };
            foreach (RectButton rb in togglebtns)
            {
                rb.Style = MyButtonType.rectButton;
                rb.colorTop = Color.Beige;
                rb.BackColor = this.BackColor;

                Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label;
                lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", ""));

                rb.ValidClick += new EventHandler((s, e) =>
                {
                    string regname = (s as Control).Name.Remove(0, 4);
                    KbdData(regname, "");
                });
            }

            InitDisplay();
        }
コード例 #6
0
        public static extern bool SetLocalTime(ref SystemTime sysTime); //设置本地时

        public SysConfigWnd()
        {
            InitializeComponent();
            lbl_sysconfig.Text   = StringResource.str("sysconfig");
            btn_quit.Text        = StringResource.str("quit");
            btn_quit.BackColor   = this.BackColor;
            btn_quit.Style       = MyButtonType.roundButton;
            btn_quit.ValidClick += new EventHandler((s, e) =>
            {
                Program.SwitchWindow("mainwnd");
                Program.mainwnd.Invoke(new Action <bool>(Program.mainwnd.ReDraw), new object[] { false });
            });
            RectButton[] kbdbtns = new RectButton[] { btn_ktt, btn_measdelay, btn_meastimes, btn_shifttimes, btn_newdate, btn_sampletimes, btn_fltlength };
            //keyboard input buttons
            foreach (RectButton rb in kbdbtns)
            {
                rb.Style     = MyButtonType.rectButton;
                rb.colorTop  = Color.Beige;
                rb.BackColor = this.BackColor;

                Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label;
                lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", ""));

                rb.ValidClick += new EventHandler((s, e) =>
                {
                    string regname = (s as Control).Name.Remove(0, 4);
                    kbdWnd.Init(StringResource.str("input") + StringResource.str(regname), regname, false, KbdData);
                });
            }

            //choice buttons
            RectButton[] choicebtns = new RectButton[] { btn_flttype, btn_navmeter, btn_rxscanner, btn_rsscanner };
            foreach (RectButton rb in choicebtns)
            {
                rb.Style     = MyButtonType.rectButton;
                rb.colorTop  = Color.Beige;
                rb.BackColor = this.BackColor;

                Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label;
                lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", ""));

                rb.ValidClick += new EventHandler((s, e) => {
                    string regname = (s as Control).Name.Remove(0, 4);
                    ChoiceWnd.Init(StringResource.str("choose") + StringResource.str(regname),
                                   regname,
                                   StringResource.str("lst_" + regname).Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries),
                                   0, null, KbdData);
                });
            }

            //toggle buttons
            RectButton[] togglebtns = new RectButton[] { btn_throw };
            foreach (RectButton rb in togglebtns)
            {
                rb.Style     = MyButtonType.rectButton;
                rb.colorTop  = Color.Beige;
                rb.BackColor = this.BackColor;

                Label lbl = this.Controls.Find(rb.Name.Replace("btn_", "lbl_"), true)[0] as Label;
                lbl.Text = StringResource.str(lbl.Name.Replace("lbl_", ""));

                rb.ValidClick += new EventHandler((s, e) =>
                {
                    string regname = (s as Control).Name.Remove(0, 4);
                    KbdData(regname, "");
                });
            }

            InitDisplay();
        }