随笔分类 - .Net-WinForm
摘要:// 以下示例为:模拟点击按钮的示例(执行按钮点击事件) button1.PerformClick(); // 模拟点击button1
阅读全文
摘要:有框 略(有两种,一种写法与无框原理相同;一种用MDIParent作为父窗体) 无框 form1.TopLevel = false; // 漏出菜单栏 form1.FormBorderStyle = FormBorderStyle.None; // 无框 form1.Parent = this.pa
阅读全文
摘要:事实证明,有些东西不用就会弄混。
阅读全文
摘要:/// <summary> /// 监听手动关闭事件 /// </summary> /// <param name="msg"></param> protected override void WndProc(ref Message msg) { const int WM_SYSCOMMAND =
阅读全文
摘要:DirectoryEntry rootfolder = new DirectoryEntry("IIS://localhost/W3SVC/1/ROOT"); // IIS://服务器的名字/要操作的Web服务器类型/站点/站点的虚拟目录 1、创建对象: 2、修改对象: #region 1、利用Di
阅读全文
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Drawing2D; using System.Drawing; using System.Linq;
阅读全文
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing.Drawing2D; using System.Drawing; using System.Linq;
阅读全文
摘要:// 自定义控件(ToolStripButton) public partial class RoundButton : ToolStripButton { protected override void OnPaint(PaintEventArgs pevent) // 重写绘制 { base.O
阅读全文
摘要:// 找活动状态中的窗口 Form form = Form.ActiveForm.FindForm(); Console.WriteLine("ActiveForm.FindForm:" + form.GetType()); // 找应用中的窗口 FormCollection formCollect
阅读全文
摘要:1、窗体界面拖拽一个notifyIcon控件: 2、窗体启动时加载图标: /// <summary> /// 初次启动 /// </summary> private void Form1_Load(object sender, EventArgs e) { //显示托盘图标 notifyIcon1.
阅读全文
摘要:TextBox滑动条保持在最后一行 private void TextBox_TextChanged(object sender, System.EventArgs e) { this.TextBox.SelectionStart = this.TextBox.Text.Length; this.T
阅读全文
摘要:由Windows默认处理的消息就调用Windows的DefWindowProc; 这里的WndProc就是对应控件窗口的窗口过程,而DefWndProc会被WndProc调用,处理那些WndProc中未处理的消息(包括WndProc未吞掉的); 因此DefWndProc收到的消息会比WndProc少
阅读全文
摘要:static class Program { /// <summary> /// 应用程序的主入口点。 /// </summary> [STAThread] static void Main() { Application.EnableVisualStyles(); Application.SetC
阅读全文
摘要:/// <summary> /// 只能输入数字 /// </summary> private void txt1_KeyPress(object sender, KeyPressEventArgs e) { //如果输入的不是退格和数字,则屏蔽输入 if (!(e.KeyChar == 8 ||
阅读全文
摘要:1 /// <summary> 2 /// 不重复运行程序 3 /// </summary> 4 /// <returns></returns> 5 private static Process RunningInstance() 6 { 7 Process current = Process.Ge
阅读全文
摘要:if (dataGridView1.Rows[0].Cells[0].Value == DBNull.Value) { //... }
阅读全文
摘要:最新版下载地址: https://www.慧都evget.com/product/740/download 图摘自:https://blog.csdn.net/luzhangtong/article/details/81177616 DexExpress12.2.5 链接:https://pan.b
阅读全文
摘要:/// <summary> /// 重写Panel-还未实现圆角功能 /// </summary> public class RoundPanel : Panel { private int mMatrixRound = 8; private Color mBack; public Color Ba
阅读全文
摘要:#region DropDownList样式重绘 /// <summary> /// 主要为DropDownList样式重绘(特定性较强) /// </summary> public partial class ComboboxEx : ComboBox { public ComboboxEx()
阅读全文
摘要:#region Form圆角 public void SetWindowRegion() { System.Drawing.Drawing2D.GraphicsPath FormPath; FormPath = new System.Drawing.Drawing2D.GraphicsPath();
阅读全文