
Winform
MXCheng0126
这个作者很懒,什么都没留下…
展开
-
C#读取文本内容的7种方式
读取文本内容原创 2022-06-07 11:01:43 · 19591 阅读 · 1 评论 -
DataGridView单元格显示设置
private void button15_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); bool result = dbQueryNew.GetAllLineNameTest(ref dt); dataGridView1.DataSource = dt; } /// <summary>原创 2022-05-23 17:23:26 · 756 阅读 · 0 评论 -
控件自适应窗体
class AutoSizeFormClass { //(1).声明结构,只记录窗体和其控件的初始位置和大小。 public struct controlRect { public int Left; public int Top; public int Width; public int Height; } //(2).声明原创 2021-06-30 10:28:19 · 241 阅读 · 0 评论 -
调用点击事件
//按钮事件private void btn_Click(object sender, EventArgs e){}//自己的函数private void myFunc(){ //程序中其他地方调用按钮事件 btn_Click(this, new EventArgs());//这样传sender和e参数就可以,this代表当前程序所在的control,new EventArgs()代表初始化EventArgs类的一个新实例}...原创 2021-02-22 14:06:06 · 511 阅读 · 0 评论 -
C# Winform添加背景图片后加载的时候控件卡
添加下面3句public Show() { InitializeComponent(); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); // 禁止擦除背景. SetStyle(Contr...原创 2019-11-22 13:07:42 · 1693 阅读 · 2 评论 -
C# Winform在父窗体关闭子窗体
FormCollection childCollection = Application.OpenForms;for (int i = childCollection.Count; i-- > 0;){ if (childCollection[i].Name != "Monitor") childCollection[i].Close();} private ...原创 2019-11-22 12:13:36 · 2688 阅读 · 1 评论 -
C# Winform设置程序显示在屏幕中的位置
int x = (System.Windows.Forms.SystemInformation.WorkingArea.Width - this.Size.Width);int y = (System.Windows.Forms.SystemInformation.WorkingArea.Height - this.Size.Height) ;this.StartPosition = Form...原创 2019-11-22 12:05:29 · 1187 阅读 · 0 评论 -
C# Winform 设置程序只打开一次
在Program.cs文件添加namespace Monitor{ static class Program { private static System.Threading.Mutex mutex; [STAThread] static void Main() { Appl...原创 2019-11-22 11:49:03 · 425 阅读 · 0 评论