NetBlog主题

WinForm多国语言设置
WinForm技巧

WinForm多国语言设置

6271

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

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

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

5291

以下是核心代码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刷新问题

5954

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

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

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

4989

相关视频教程 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打造指示灯

25344

核心代码如下//开始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窗体应用程序只能运行一个解决方案

4557

有些软件不想在同一台电脑上运行两个可以用以下方法在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确认窗口关闭

5437

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,应用技巧

10348

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

BackgroundWorker任务状态源码实例
WinForm技巧

BackgroundWorker任务状态源码实例

3557

些代码的主要功能是 应用了BackgroundWorker 这个类 任务正在运行时柱塞客户操作,并且可以看到任务运行状态 任务完成窗口关闭源码实例下载地址https://pan.baidu.com/s/1skGYzTF以下是backgroundWorkerFrm窗体核心代码using System; using System.Collections.Generic; using…