private void btnDi_MouseClick(object sender, System.Windows.Forms.MouseEventArgs e) { XIconToolButton btn = sender as XIconToolButton; AssiBtnDTO btnDTO = btn.ValueObj as AssiBtnDTO; if (!IsAllowOpenAssiFrameValidate(btnDTO)) { if (assiViewFrame != null) { assiViewFrame.Close(); } return; } if (assiViewFrame != null) { assiViewFrame.Close(); } XBaseControl xBaseCtrl = this.getParentCtrl(btnDTO.FrameLocation); if (!isDiOpen) { diAssiForm = new EntDiAssiForm(this.Context); diAssiForm.Size = GetFrameSize(xBaseCtrl); diAssiForm.Location = GetFrameLocation(xBaseCtrl); diAssiForm.delegateHelper += getDOsFromHelp; diAssiForm.FormClosed += new FormClosedEventHandler(diAssiForm_FormClosed); isDiOpen = true; diAssiForm.Show(xBaseCtrl); } }
/// <summary> ///调用打开助手窗口 /// </summary> /// <param name="btnDTO">按钮参数</param> protected void LoadAssiFrame(AssiBtnDTO btnDTO) { if (!IsAllowOpenAssiFrameValidate(btnDTO)) { if (assiViewFrame != null) { assiViewFrame.Close(); } return; } XBaseControl xBaseCtrl = this.getParentCtrl(btnDTO.FrameLocation); if (diAssiForm != null) { diAssiForm.Close(); diAssiForm = null; isDiOpen = false; } // 如果窗口已经打开,点击按钮时只进行tab页签间的切换 if (assiViewFrame == null || (assiViewFrame.FrameLocation != btnDTO.FrameLocation || assiViewFrame.FrameOpenModel != btnDTO.OpenFrameModel) && assiViewFrame.IsFrameOpened) { if (assiViewFrame != null) { assiViewFrame.Close(); } assiViewFrame = new AssiViewFrame(); assiViewFrame.assistantBtnBaseView = this; assiViewFrame.FrameLocation = btnDTO.FrameLocation; assiViewFrame.FrameOpenModel = btnDTO.OpenFrameModel; // 设置鼠标点击时,不需要关闭辅助录入的组件,除此之外都关闭辅助录入 assiViewFrame.MouseInXBaseCtrlList = this.getMouseInXBaseCtrlList(btnDTO); //// 设置窗体的起始位置 assiViewFrame.StartPosition = FormStartPosition.Manual; assiViewFrame.FormBorderStyle = FormBorderStyle.None; assiViewFrame.Location = this.GetFrameLocation(xBaseCtrl); assiViewFrame.Size = this.GetFrameSize(xBaseCtrl); } // 参数中增加事件处理对象 Dictionary <string, object> paramDic = this.getParamDic(btnDTO); paramDic.Add("assiViewFrame", assiViewFrame); // 获取加载对象 XUserControl xUserCtrl = this.LoadConfigUserControl(paramDic, btnDTO); if (xUserCtrl != null) { assiViewFrame.loadFrame(xBaseCtrl, xUserCtrl, btnDTO); } }
public override void OnDeActiveForm() { base.OnDeActiveForm(); if (diAssiForm != null) { diAssiForm.Close(); diAssiForm = null; isDiOpen = false; } if (assiViewFrame != null) { assiViewFrame.Close(); } }