NetBlog主题

WinForm (ProgressBar)进度条显示百分比
WinForm技巧

WinForm (ProgressBar)进度条显示百分比

8503

先给大家看一下效果,如下图ProgressBar控件.net 目前没有带百分比显示的,要我们自己做一个带显示百分比的控件如转载请保留原创地址 http://www.luofenming.com/show.aspx?id=ART2018083000001在这里 长话短说 说重点的以下是自己绘制带百分比的ProgressBar的核心代码usin…

解决WinForm tableLayoutPanel 里面数据在刷新时边框闪动
WinForm技巧

解决WinForm tableLayoutPanel 里面数据在刷新时边框闪动

5541

tableLayoutPanel 里面的Lable值发生变动频繁时 边框会闪动解决是在窗体加载时添加以下代码即可,本人亲自用过,很管用private void Form1_Load(object sender, EventArgs e) { //tableLayoutPanel1 是控件的名称tableLayoutPanel1.GetType().GetProperty("DoubleBuffer…

WinForm多国语言设置
WinForm技巧

WinForm多国语言设置

6346

相关的视频教程 https://www.bilibili.com/video/BV1fK4y1R7EP?share_source=copy_web选择窗体属性,把语言改成需要的语言,然后界面也改成相应的语言之后核心代码在以下public class Language{/// summary/// 设置当前程序的界面语言/// /summary/// param name="lang"…

Winform遍历所有控件,以及获取控件名称和类型
WinForm技巧

Winform遍历所有控件,以及获取控件名称和类型

5352

以下是核心代码private void button4_Click(object sender, EventArgs e){Control.ControlCollection sonControls = panel1.Controls;//遍历所有控件 foreach (Control control in sonControls){string s = control.Name;//获得控件名称string s2 = control.GetType().ToStri…

WinForm,ComboBox刷新问题
WinForm技巧

WinForm,ComboBox刷新问题

6109

ComboBox items DataSource刷新问题//第一次给comboBox.DataSource赋值 显示 的是正确 List<string> instrumentList = new List<string>() { "111111", "22222222", "333333" }; comboBox1.DataSource=instrumentList;//第二次…

Dictionary绑定到ComboBox显示值,实际值
WinForm技巧

Dictionary绑定到ComboBox显示值,实际值

5024

相关视频教程 https://www.bilibili.com/video/BV19M4y1N7bt private void TestAndSetForm_Load(object sender, EventArgs e){Dictionarystring, string dic = new Dictionarystring, string();BindingSource bs = new BindingSource();dic["广东省"] = "http://mk.gd.soa…

C#,纯WinForm打造指示灯
WinForm技巧

C#,纯WinForm打造指示灯

25586

核心代码如下//开始private void button1_Click(object sender, EventArgs e){label1.Visible = true;label1.Text = "●";//如果觉得太小调label1字体大小if (th == null || !th.IsAlive){th = new Thread(run);//添加线程 th.IsBackground = true;th.Start();}}//结束pr…

C#,WinForm窗体应用程序只能运行一个解决方案
WinForm技巧

C#,WinForm窗体应用程序只能运行一个解决方案

4618

有些软件不想在同一台电脑上运行两个可以用以下方法在Program.cs类里面写上以下代码即可/// <summary>/// 应用程序的主入口点。/// </summary>[STAThread]static void Main(){bool ret;System.Threading.Mutex mutex = new System.Threading.Mutex(true, Applicat…

C#,Winform确认窗口关闭
WinForm技巧

C#,Winform确认窗口关闭

5481

private void MainFrm_FormClosing(object sender, FormClosingEventArgs e){if (MessageBox.Show("您确认退出吗?", "www.luofenming.com", MessageBoxButtons.YesNoCancel) == System.Windows.Forms.DialogResult.Yes){Dispose();Application.Exit();}e…

C#,Winform, DataGridView,应用技巧
WinForm技巧

C#,Winform, DataGridView,应用技巧

10471

2019-09-11 更新 1、有时不希望DataGridView显示不要显示的数据 2018-04-04 解决方法 取消DataGridView自动生成列 dataGridView1.AutoGenerateColumns = false;2、DataGridView添加 行、列 2018-04-04 //增加一个列 DataGridViewColumn c = new DataGridViewColumn(); dgv.…