winForm 窗体单例 (底层显示到上层,任务栏显示出来)
以下核心代码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…
以下核心代码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;
效果自定义控件核心代码/// summary/// 遮罩层/// /summary[Designer("System.Windows.Forms.Design.ParentControlDesigner, System.Design", typeof(IDesigner))]public class MaskLayer : Control{/// summary/// 遮罩层/// /summarypublic MaskLayer(){SetSty…
效果图核心代码using System;using System.Drawing;using System.Drawing.Drawing2D;using System.Windows.Forms;namespace TabControlDemo{public class MyTabControl : TabControl{const int CLOSE_SIZE = 15;//原创来自 www.luofenming.compublic MyTabControl(){this.…
2022-07-18 更新 (大家尽量用网站显示的核心代码,百度网盘的没有更新)效果图源码地址 链接: https://pan.baidu.com/s/1QYX0aEmHaCxQuHsVIGsmaA?pwd=2fw6 提取码: 2fw6 以下是核心源码public class Line{//原创来自 www.luofenming.comprivate double x1, x2, y1, y2;priva…
效果图设置 panel2.AutoScroll = true; 内容大于可视区的时间有滚动条核心代码private void AddControl(Control control){//转载请保留http://www.luofenming.com/show.aspx?id=ART2022011600001for (int i = 0; i 25; i++){Button button = new Button();button.Size = …
2022-11-18 修复combobox不存在的字符串时会清空2022-01-06 更新效果图如下方法12021-12-20 更新,修复输入不存在的数据源然后点击其他地方会报错核心代码//数据源Liststring data = new Liststring(){"A001","A002","A003","B001","B012","B031","C011","C0121","C012…