private void initFormDefConfig() { // 设置图标 this.Icon = MessyUtils.IamgeToIcon(Core.ImageResource.转到行, true); this.StartPosition = FormStartPosition.CenterParent; this.Name = EnumUtils.GetDescription(DefaultNameEnum.ROW_GOTO_FORM); }
/// <summary> /// 窗体默认配置 /// </summary> private void formDefConfig() { // 设置图标 this.Icon = MessyUtils.IamgeToIcon(Core.ImageResource.分割, true); this.AutoScaleMode = AutoScaleMode.None; // 调节窗口位置 this.Location = FormUtisl.MiddleForm(this); }
// 窗体加载事件 private void ThereofForm_Load(object sender, EventArgs e) { // 设置图标 this.Icon = MessyUtils.IamgeToIcon(Core.ImageResource.关于, true); this.Text = "关于 " + EnumUtils.GetDescription(DefaultNameEnum.PROGRAM_NAME); this.programName.Text = "关于 " + EnumUtils.GetDescription(DefaultNameEnum.PROGRAM_NAME); setVersion(); // 组装Tab容器 Dictionary <string, string> dic = new Dictionary <string, string>(); dic.Add("系统信息", getSystemMess()); dic.Add("环境变量", getVariable()); dic.Add("特殊目录", getSpecialcatalog()); setTab(dic); }
/// <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(); }
// 窗体加载事件 private void CharsStatistics_Load(object sender, EventArgs e) { // 设置图标 this.Icon = MessyUtils.IamgeToIcon(Core.ImageResource.统计, true); // 获取待添加的控件集合 List <Control[]> conList = getControlList(); // 为选中字符控件绑定事件 CheckBox chk1 = getTempCheckB("选中字符CHK", "选中字符"); chk1.CheckedChanged += Chk1_CheckedChanged; // 添加到控件集合中 conList.Add(new Control[] { chk1 }); // 将标签和文本框放入信息栏中并调整标签文本框位置和信息栏的大小 labAndTextLayout(conList); // 获取文本框与值的对应关系 Dictionary <string, string> nameAndVal = getTextNameValDic(textBox.Text); // 根据传入的文本框name和值的对应关系给文本框赋值 textBoxAssignment(nameAndVal); // 调整窗口大小 formSizeLayout(); }
/// <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; } }
/// <summary> /// 确定窗体的大小 /// </summary> /// <param name="rowColuArr">生成表格说使用的数据</param> private void defineFormSize(string[][] rowColuArr) { int cellWidth = redrawDataTable.Rows[0].Cells[0].Size.Width; // 数据表格在窗体中所占的宽 int dataViewW = redrawDataTable.Location.X + redrawDataTable.RowHeadersWidth + (cellWidth * rowColuArr.Max(x => x.Length)); // 数据表格在窗体中所占的高 int dataViewH = redrawDataTable.Location.Y + colHeadersHeight + (cellDefHeight * rowColuArr.Length); // 判断工作区的宽 if (dataViewW > 1000) { Width = MessyUtils.GetResolvingpower()[0] - 100; } else if (dataViewW < 600) { Width = 600; } else { Width = (Width - ClientSize.Width) + dataViewW + 15; } // 判断工作区的高 if (dataViewH > Screen.PrimaryScreen.Bounds.Height) { Height = MessyUtils.GetResolvingpower()[1] - 100; } else if (dataViewH < 500) { Height = 500; } else { Height = (Height - ClientSize.Height) + dataViewH + 15; } // MinimumSize = new Size(Width, Height); }