/// <summary> /// /// </summary> /// <param name="cbb"></param> /// <param name="cComm"></param> /// <param name="msg"></param> private void Init(ComboBox cbb, CCommBase cComm, RichTextBox msg = null) { if (cComm != null) { this.cCommSerial.RemoveComboBoxMouseDownClick(); this.cCommSerial.RemoveButtonClick(); this.cCommSerial.RefreshCOMM(cbb); //---传递端口类型 this.cCommSerial.mCCOMM = cComm; this.cCommSerial.mCCommRichTextBox = msg; //---加载按钮事件 this.cCommSerial.mButton.Click += new EventHandler(this.ParamShowDialog_Click); //---波特率 this.cCommSerial.AnalyseBaudRate(cComm.mSerialParam.mBaudRate); //---数据位 this.cCommSerial.AnalyseDataBits(cComm.mSerialParam.mDataBits); //---停止位 this.cCommSerial.AnalyseStopBits(cComm.mSerialParam.mStopBits); //---校验位 this.cCommSerial.AnalyseParity(cComm.mSerialParam.mParity); } else { this.DialogResult = DialogResult.None; } }
/// <summary> /// 初始化 /// </summary> /// <param name="ccomm"></param> public virtual void Init(CCommBase ccomm = null, RichTextBox msg = null) { if (ccomm != null) { if (this.defaultCCOMM == null) { this.defaultCCOMM = new CCommBase(); } this.defaultCCOMM = ccomm; this.defaultCCOMM.Init(this.comboBox_COMM, msg); } }
/// <summary> /// /// </summary> /// <param name="cComm"></param> private void Init(CCommBase cComm) { if (cComm != null) { this.cCommSerial.RemoveComboBoxMouseDownClick(); this.cCommSerial.RemoveButtonClick(); //---加载按钮事件 this.cCommSerial.mButton.Click += new EventHandler(this.ParamShowDialog_Click); } else { this.DialogResult = DialogResult.None; } }
/// <summary> /// /// </summary> /// <param name="text"></param> /// <param name="isLimitedSize"></param> public CCommSerialPlusForm(ComboBox cbb, CCommBase cComm, string text = null, bool isLimitedSize = false) { InitializeComponent(); if ((text != "") && (text != string.Empty)) { this.cCommSerial.mButton.Text = text; } //---判断是否限定最小尺寸 if (isLimitedSize) { //---限制窗体的大小 this.MinimumSize = this.Size; this.MaximumSize = this.Size; } this.Init(cbb, cComm); }
/// <summary> /// 启动初始化 /// </summary> /// <param name="ccomm"></param> /// <param name="msg"></param> private void StartupInit(CCommBase ccomm = null, RichTextBox msg = null) { //---button 点击事件 this.button_COMM.Click += new System.EventHandler(this.Button_Click); //---端口状态刷新事件 this.pictureBox_COMM.Click += new EventHandler(this.PictureBox_Click); //---增加鼠标移动事件 this.comboBox_COMM.MouseDown += new System.Windows.Forms.MouseEventHandler(this.ComboBoxMouseDown_Click); if (ccomm != null) { if (this.defaultCCOMM == null) { this.defaultCCOMM = new CCommBase(); } this.defaultCCOMM = ccomm; this.defaultCCOMM.Init(this.comboBox_COMM, msg); } }
/// <summary> /// /// </summary> /// <param name="ccomm"></param> public CCommBaseControl(CCommBase ccomm, RichTextBox msg = null) { InitializeComponent(); this.StartupInit(ccomm, msg); }