C# winform解决解决窗体第一次设置为最大化后,点击最大化按钮窗体无法居中问题
2024-10-10 01:33:52
public frmMain()
{
InitializeComponent();
//解决窗体第一次设置为最大化后,点击最大化按钮窗体无法居中问题
int x = Convert.ToInt32((Screen.PrimaryScreen.WorkingArea.Width - this.Width) * 0.5);
int y = Convert.ToInt32((Screen.PrimaryScreen.WorkingArea.Height - this.Height) * 0.5);
this.SetBounds(x, y, this.Width, this.Height, BoundsSpecified.All);
}
最新文章
- Linux 下从头再走 GTK+-3.0 (三)
- pypi 国内镜像 及修改全局方法
- 机器学习:logistic回归
- 删除docker私有库镜像
- Month Calendar
- LinearLayout按下(pressed)或获取焦点(focused)时背景设置不同颜色或图片
- call()与apply()区别
- java的动态代理设计模式
- mysql中取系统当前时间
- 关于AutoCAD.NET的辅助方法
- achieve aop through xml
- C#拾遗(二、函数)
- Spring学习(15)--- 基于Java类的配置Bean 之 @Bean &; @Scope 注解
- SpriteKit:检测当新场景显示以后
- Java网络编程详解
- EUI组件之DataGroup
- ceph 存储池PG查看和PG存放OSD位置
- Linux 150命令之查看文件及内容处理命令 cat tac less head tail cut
- lr_get_transaction_duration 函数介绍
- ethereum