private void MainForm_Load(object sender, EventArgs e) { lbl_title.Parent = pb_banner; lbl_help.Parent = pb_banner; // 如果有过位置记录,在上次关闭处打开,如果没有,显示在右上角 RegistryKey reg = Registry.CurrentUser.CreateSubKey("SoftWare\\" + MY_SOFT_NAME); int x = Convert.ToInt32(reg.GetValue("x")); int y = Convert.ToInt32(reg.GetValue("y")); if (x != 0 || y != 0) { this.Location = new Point(x, y);//可以转换成 Left 、Top 见 2. } else { this.Left = Screen.GetWorkingArea(this).Width - this.Width; this.Top = 0; } initRecordAndId(null); // 读卡器初始化 cvrInit(); // 控件与数据绑定 tb_name.DataBindings.Add("Text", people, "name", false, DataSourceUpdateMode.OnPropertyChanged); tb_sex.DataBindings.Add("Text", people, "sex", false, DataSourceUpdateMode.OnPropertyChanged); tb_age.DataBindings.Add("Text", people, "age", false, DataSourceUpdateMode.OnPropertyChanged); tb_card_id.DataBindings.Add("Text", people, "cardId", false, DataSourceUpdateMode.OnPropertyChanged); tb_serial.DataBindings.Add("Text", people, "serialId", false, DataSourceUpdateMode.OnPropertyChanged); //声明委托 loghandlers = new loghandler(PrintLog); // 循环读卡 _readCardInfoTimer = new System.Timers.Timer(); _readCardInfoTimer.Elapsed += new ElapsedEventHandler(timeSendSms_Tick); _readCardInfoTimer.Interval = 1000; _readCardInfoTimer.Start(); }
public static void setloghandler(loghandler handler) { Util._loghandler = handler; }