
winform 无边框 实现拖动
核心代码private Point mPoint;//定义一个位置信息Point用于存储鼠标位置//控件注册下面两个事件private void panelTop_MouseDown(object sender, MouseEventArgs e){ mPoint = new Point(e.X, e.Y);}/// summary/// 鼠标移动/// /summary/// param name="send…
核心代码private Point mPoint;//定义一个位置信息Point用于存储鼠标位置//控件注册下面两个事件private void panelTop_MouseDown(object sender, MouseEventArgs e){ mPoint = new Point(e.X, e.Y);}/// summary/// 鼠标移动/// /summary/// param name="send…
下面效果图是设置某行背景颜色和某Cells字体颜色下面是核心代码 public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { this.dataGridView1.Da…
效果图,源码下载地址: https://pan.baidu.com/s/1BbaUtzqMsKNj3PtT6IsncQ?pwd=q245 提取码: q245 核心代码using System;using System.Data;using System.Drawing;using System.Windows.Forms;namespace TreeViewDemo{ public class TreeViewEnhanced : TreeView …
效果如下1、自动适应窗体类的代码public class AutoAdaptWindowsSize{ double formOriginalWidth;//窗体高度原始宽度 double formOriginalHeight;//窗体原始 double scaleX;//水平缩放比例 double scaleY;//垂直缩放比例 Dictionarystring, string Cont…
效果在这里我们用的是 ScreenCapturerSharp库,要在nuget里面安装,或直接引用它的dll核心代码private void button1_Click(object sender, EventArgs e){ this.Hide(); System.Threading.Thread.Sleep(200); ScreenCapturer.ScreenCapturerTool screenCapturer = …
以下核心代码public static Form frm;private void button1_Click(object sender, EventArgs e){ if (frm == null || string.IsNullOrEmpty(frm.Text)) { frm = new Form2(); frm.Show(); } else { frm.WindowState = FormWind…
效果图如下绘制控件代码using System.Drawing;using System.Linq;using System.Reflection;using System.Windows.Forms;namespace WindowsFormsApp2{ public partial class MyPicControl : UserControl { public MyPicControl() { In…
我们先看一下效果,效果如下图视频讲解地址 https://www.bilibili.com/video/BV1H24y1o7UB实现功能步骤如下1、在nuget里面添加第三方库CefSharp.WinForms2、调用显示到winofrm的核心代码如下private void button1_Click(object sender, EventArgs e){//转载请保留 http://www…
先看一下效果,在这里我以TextBox控件为例,其它类型的操作也类似于这样视频讲解地址 https://www.bilibili.com/video/BV1AV4y1M7mR步骤如下(控件名为textBox1)1、注册两个事件,代码如下private void textBox1_DragDrop(object sender, DragEventArgs e){ textBox1.Text…
视频讲解地址 https://www.bilibili.com/video/BV1Wv4y1G7M9效果图步骤如下1、父窗体窗属性设置IsMdiContainer = true;2、嵌入的子窗体添加Form2 form2 = new Form2();form2.Show();form2.MdiParent = this;