/// <summary> /// 窗体默认配置 /// </summary> private void formDefConfig() { // 设置图标 this.AutoScaleMode = AutoScaleMode.None; // 调节窗口位置 this.Location = FormUtisl.MiddleForm(this); }
/// <summary> /// 窗体默认配置 /// </summary> private void formDefConfig() { // 设置图标 this.Icon = MessyUtils.IamgeToIcon(Core.ImageResource.分割, true); this.AutoScaleMode = AutoScaleMode.None; // 调节窗口位置 this.Location = FormUtisl.MiddleForm(this); }
// 窗口的默认配置 private void initFormDefConfig() { this.ShowIcon = false; this.StartPosition = FormStartPosition.CenterParent; this.AutoScaleMode = AutoScaleMode.None; this.Name = EnumUtils.GetDescription(DefaultNameEnum.CREAD_JAVA_ENTITY); // 调节窗口位置 this.Location = FormUtisl.MiddleForm(this); }
/// <summary> /// 窗体的启动函数 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RootDisplayForm_Load(object sender, EventArgs e) { // 加载默认配置 initRootForm(); // 将窗体加入到单例窗体工厂 addSingletonAllForm(); // 将控件组合到一起并添加到窗体中 controlCombination(); // 打开拖入的文件到新标签中 loadOpenFile(); // 调节窗口位置 Location = FormUtisl.MiddleForm(this); }
/// <summary> /// 窗口加载时的执行方法 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FindAndReplace_Load(object sender, EventArgs e) { // 设置图标 this.Icon = MessyUtils.IamgeToIcon(Core.ImageResource.查找替换, true); this.StartPosition = FormStartPosition.CenterParent; if (textBox.SelectionLength == 0) { this.当前文档R.Checked = true; } else { this.定内容R.Checked = true; } // 调节窗口位置 Location = FormUtisl.MiddleForm(this); // 设置当前索引和总共的索引 setCurrentLab(); }
/// <summary> /// 调节窗体的位置 /// </summary> private void middleForm() { Form rootDisplayForm = textBox.FindForm(); // 根据父窗体居中 Location = FormUtisl.MiddleForm(this, rootDisplayForm); // 获取当前屏幕分辨率 int[] wh = MessyUtils.GetResolvingpower(); int w = rootDisplayForm.Location.X + rootDisplayForm.Width; if (w + Width <= wh[0]) { // 设置相对于启动窗体贴右 Location = new Point(w, Location.Y); return; } if (Width <= rootDisplayForm.Location.X) { w = rootDisplayForm.Location.X - Width; Location = new Point(w, Location.Y); return; } }
// 窗体失去焦点事件 private void RootDisplayForm_Deactivate(object sender, EventArgs e) { FormUtisl.TopFormNoFocus(false, FormCacheFactory.getTopFormCache().Values.ToArray()); }
/// <summary> /// 退出程序 /// </summary> /// <returns></returns> public static object exitProgram(Dictionary <Type, object> data) { FormUtisl.DropOut(); return(null); }