随笔分类 -  winform

摘要:效果图 主体代码 using System; using System.Collections.Generic; using System.Drawing; using System.Windows.Forms; namespace FrameControl { public partial cla 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(405) 评论(0) 推荐(0)
摘要:摘要: C#中的自定义控件中的属性(Property)、事件(Event)及一些相关特性(Attribute)的总结 今天学习了下C#用户控件开发添加自定义属性的事件,主要参考了MSDN,总结并实验了一些用于开发自定义属性和事件的特性(Attribute)。 在这里先说一下我的环境: 操作系统:Wi 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(1475) 评论(0) 推荐(0)
摘要:一、窗体 绿色边框框住的区域:屏幕橙色边框框住的区域:窗体黄色边框框住的区域:窗体工作区 1.边框 窗体的FormBorderStyle可以设置以下的值,每个值导致窗体的边框的宽度不一样,但是可以发现的是左、右、下边框的宽度是一样的: // // 摘要: // 指定窗体的边框样式。 [ComVisi 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(2405) 评论(0) 推荐(2)
摘要:using System; using System.ComponentModel; using System.Drawing; using System.Runtime.InteropServices; using System.Windows.Forms; namespace WindowsFo 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(468) 评论(0) 推荐(0)
摘要:using System; using System.ComponentModel; using System.Reflection; namespace PropertyGridUse { public class PropertyAttribute<T> { /// <summary> /// 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(662) 评论(1) 推荐(0)
摘要:1、效果图 2、导入导出 using System; using System.Collections.Generic; using System.IO; using System.Reflection; using System.Text; using System.Windows.Forms; 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(1474) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.ComponentModel; /// <summary> /// 提供支持数据绑定的泛型集合 /// </summary> /// <typeparam name="T"></ 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(274) 评论(0) 推荐(0)
摘要:private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs e) { using (SolidBrush b = new SolidBrush(this.dataGridView1. 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(751) 评论(0) 推荐(0)
摘要:1.DataBindings 控件基类(Control),有一个DataBindings对象,它是一个ControlBindingCollection类,这个类继承与BindingsCollection,里面有一个Binding的列表对象,其中Binding对象是一个记录了属性名,数据源,数据成员等 阅读全文
posted @ 2022-04-12 22:46 Bridgebug 阅读(2177) 评论(0) 推荐(0)
摘要:Winform中调用WPF 1.打开窗体 在winform项目中添加引用: PresentationCorePresentationFrameworkWindowsBase 然后添加相应的WPF程序,就可以通过 Show()方法打开窗体。 但是这样打开的窗体不能够接收键盘的输入(若是模态的窗口,即对 阅读全文
posted @ 2022-04-12 22:45 Bridgebug 阅读(445) 评论(0) 推荐(0)
摘要:using System.Drawing; using System.Drawing.Drawing2D; public Image CreateTextImage(string text, Font font, Color backgroundColor, Color foreColor, int 阅读全文
posted @ 2022-04-12 22:45 Bridgebug 阅读(169) 评论(0) 推荐(0)
摘要:前言:相较于之前文章,用这种方式优点是可以修改在属性控件上显示的效果,然后重新绑定就可以了 1.效果图 2.使用举例 PropertyGridProperty propertyGridProperty = new PropertyGridProperty(); Property p1 = new P 阅读全文
posted @ 2020-03-18 11:23 Bridgebug 阅读(280) 评论(0) 推荐(0)
摘要:1.效果图 2.对象类 public class People { [Category("自定义")] [TypeConverter(typeof(OptionValuesTypeConvertor))] [OptionCollection(1, 54, 6)] public decimal ID 阅读全文
posted @ 2020-03-18 10:43 Bridgebug 阅读(422) 评论(0) 推荐(0)
摘要:1.效果图 2.对象和控件 using System.ComponentModel; using System.Drawing; using System.Windows.Forms; namespace AttributeTest { public partial class UserContro 阅读全文
posted @ 2020-03-18 09:52 Bridgebug 阅读(320) 评论(0) 推荐(0)
摘要:partial class DataGridViewInfo { /// <summary> /// 必需的设计器变量。 /// </summary> private System.ComponentModel.IContainer components = null; /// <summary> 阅读全文
posted @ 2020-01-14 14:42 Bridgebug 阅读(635) 评论(0) 推荐(0)
摘要:1.在父控件中居中 /// <summary> /// 控件在父控件中居中 /// </summary> /// <param name="ctr">要设置的控件</param> /// <param name="isLR">左右居中</param> /// <param name="isUD">上 阅读全文
posted @ 2020-01-09 17:58 Bridgebug 阅读(3064) 评论(0) 推荐(0)
摘要:class CtrEnabled { [System.Runtime.InteropServices.DllImport("user32.dll ")] static extern int SetWindowLong(IntPtr hWnd, int nIndex, int wndproc); [S 阅读全文
posted @ 2020-01-09 17:52 Bridgebug 阅读(494) 评论(0) 推荐(0)
摘要:将要实现拖曳的窗体订阅下列两个事件 private void Form1_DragEnter(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) e.Effect = DragDropE 阅读全文
posted @ 2020-01-09 11:02 Bridgebug 阅读(151) 评论(0) 推荐(0)
摘要:CSDN下载: https://download.csdn.net/download/breakbridge/12251843 public partial class MesBox : Form { int _maxWidth = 802; int _maxHeight = 704; int _b 阅读全文
posted @ 2019-09-29 09:12 Bridgebug 阅读(947) 评论(0) 推荐(0)
摘要:public class TextBoxNumber : TextBox { public TextBoxNumber() { this.KeyPress += textBox_KeyPress; this.Leave += textBox_Leave; } double _maxValue = i 阅读全文
posted @ 2019-09-09 16:37 Bridgebug 阅读(580) 评论(0) 推荐(0)