摘要:
在winform中拖四个button控件、两个textbox控件、一个combobox控件、一个openfiledialog控件。如图 下面为代码部分: using System;using System.Collections.Generic;using System.IO;using Syste 阅读全文
摘要:
C#拖拽文件获得文件名 //首先将控件的 AllowDrop = True; //获得一个文件名 private void textBox1_DragDrop(object sender, DragEventArgs e) { textBox1.Text = ((Array)e.Data.GetDa 阅读全文
摘要:
非自创,转载自大神易大胆888 private float X; private float Y; private void setTag(Control cons) { foreach (Control con in cons.Controls) { con.Tag = con.Width +": 阅读全文
摘要:
首先在Form中建两个控件panel1和panel2,设置好相同尺寸大小。 然后在每个panel中放置需要的控件内容,并将两panel拖动重叠在一起。 下面为设置panel的代码: //点击button1后,panel2显示,并将panel2放置在所有控件的最前端,panel1隐藏 private 阅读全文
摘要:
label1.Text = DateTime.Now.ToLongDateString().ToString()+"\r"+ DateTime.Now.ToString("hh:mm:ss"); 例如:2022年7月26日 6:02:25 label2.Text= DateTime.Now.ToSt 阅读全文
摘要:
使用编辑列添加列标题 为了使listview显示网格线,需将listView1.GridLines = true; 为了使listview能选中单行,需将listView1.FullRowSelect = true; 并将View属性设置为Details。 然后用二维数组添加数据 string[][ 阅读全文
摘要:
using System;using System.Windows.Forms;using System.Threading; namespace 多线程{ delegate void SetValueCallback(int value); public partial class Form1 : 阅读全文
摘要:
啥也不说了,直接上代码。 //按行读取txt文件 string[] contents = File.ReadAllLines("E:\\345.txt"); foreach (string i in contents){textBox2.Text = textBox2.Text + i + "\r\ 阅读全文
摘要:
private void button2_Click(object sender, EventArgs e) { foreach (Control cur in Controls) { if (cur is TextBox ) { string name = cur.Name; cur.Text = 阅读全文
摘要:
1.限制窗体的大小(1)Width属性:用于获取和设置窗体的宽度 (2)Height属性:用于获取和设置窗体的高度 (3)FormBorderStyle属性:用于获取和设置窗体的边框样式 None:无边框 FixedSingle:固定的单行边框Fixed3D:固定的三维边框FixedDialog:固 阅读全文