NetBlog主题

C#,WinForm DataGridView添加行号
WinForm技巧

C#,WinForm DataGridView添加行号

210

效果图核心代码//注册事件 this.dataGridView1.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.dataGridView1_CellPainting);private void dataGridView1_CellPainting(object sender, DataGridViewCellPaintingEventArgs e){ if …

winform 无边框 实现拖动
WinForm技巧

winform 无边框 实现拖动

532

核心代码private Point mPoint;//定义一个位置信息Point用于存储鼠标位置//控件注册下面两个事件private void panelTop_MouseDown(object sender, MouseEventArgs e){ mPoint = new Point(e.X, e.Y);}/// summary/// 鼠标移动/// /summary/// param name="send…

C# WinForm 控件自适应窗体大小
WinForm技巧

C# WinForm 控件自适应窗体大小

2192

效果如下1、自动适应窗体类的代码public class AutoAdaptWindowsSize{ double formOriginalWidth;//窗体高度原始宽度 double formOriginalHeight;//窗体原始 double scaleX;//水平缩放比例 double scaleY;//垂直缩放比例 Dictionarystring, string Cont…

C# 截图功能实例源码
WinForm技巧

C# 截图功能实例源码

858

效果在这里我们用的是 ScreenCapturerSharp库,要在nuget里面安装,或直接引用它的dll核心代码private void button1_Click(object sender, EventArgs e){ this.Hide(); System.Threading.Thread.Sleep(200); ScreenCapturer.ScreenCapturerTool screenCapturer = …

winform中显示(预览)PDF文件
WinForm技巧

winform中显示(预览)PDF文件

3384

我们先看一下效果,效果如下图视频讲解地址 https://www.bilibili.com/video/BV1H24y1o7UB实现功能步骤如下1、在nuget里面添加第三方库CefSharp.WinForms2、调用显示到winofrm的核心代码如下private void button1_Click(object sender, EventArgs e){//转载请保留 http://www…