随笔分类 -  Winform

摘要:第一种方法:将Form1整个窗体作为值传给Form2 form1 button1弹出 from2, from2 numericUpDown1的值改变,使form1 textBox1的值改变。 Form1代码: Form2代码: 第二种方法:委托与事件 form1 button1弹出 from2, f 阅读全文
posted @ 2019-10-28 17:45 发明创造小能手 阅读(356) 评论(0) 推荐(0)
摘要:设置窗体最大化,填满整个屏幕//this.MaximizedBounds = Screen.PrimaryScreen.WorkingArea;//this.MaximumSize = Screen.PrimaryScreen.WorkingArea.Size;// this.MaximumSize 阅读全文
posted @ 2018-01-29 14:38 发明创造小能手 阅读(8748) 评论(1) 推荐(0)
摘要:原文地址:https://www.codeproject.com/Articles/29010/WinForm-ImageButton 自定义winfrom图片按钮:支持鼠标正常、悬停、按下更改图片,支持文本。 首先,创建没有按钮文本的图片,这样的: 正常: 悬停: 按下: 添加ImageButto 阅读全文
posted @ 2017-04-28 18:45 发明创造小能手 阅读(1830) 评论(0) 推荐(0)
摘要:0.选择基类 1.设置控件的Style 在构造函数里添加: 2.定义变量,并对一些变量进行一些默认设置 3.设置属性值 4.确定控件的位置 5.Value值变化的属性 6.定义value属性值 7.绘制控件 8.在设计时,修改控件的大小 9.1响应鼠标事件 9.2响应鼠标事件 阅读全文
posted @ 2017-04-26 10:13 发明创造小能手 阅读(852) 评论(0) 推荐(0)
摘要:1.CompositeControls组合控件:在原有控件的基础上根据需要进行组合 2.ExtendedControls 扩展控件:继承自原有控件,添加一些新的属性和方法,绘制一些新元素 当每个Button都使用一样的样式,可以使用自定义控件统一设置控件的属性、方法。 3.CustomControl 阅读全文
posted @ 2017-04-24 17:00 发明创造小能手 阅读(316) 评论(0) 推荐(0)
摘要:制作一个自定义按钮,使用2种半透明的颜色来填充Button 1.添加一个自定义控件类,并改变基类,继承自Button 2.为控件创建一些自定义属性 4.到这里就完成了。 完整代码: 阅读全文
posted @ 2017-04-24 15:54 发明创造小能手 阅读(409) 评论(0) 推荐(0)
摘要:C#: VB.NET: ListView同样适用。 阅读全文
posted @ 2017-04-21 09:52 发明创造小能手 阅读(405) 评论(0) 推荐(0)
摘要:效果图: 新建一个继承自TreeView的控件类,代码如下: 在窗体里应用: 阅读全文
posted @ 2017-04-21 09:28 发明创造小能手 阅读(1821) 评论(0) 推荐(0)
摘要:设计界面:2个button,一个panel 当鼠标移动到btnHome时,显示menuPanel 当鼠标离开btnHome时,隐藏menuPanel 当btnPin箭头向左时,menuPanel为自动隐藏状态 当btnPin箭头向下时,menuPanel为固定显示状态 From1代码: 阅读全文
posted @ 2017-04-20 11:00 发明创造小能手 阅读(1642) 评论(0) 推荐(0)
摘要:使用资源文件实现多语言切换。 1. 新建一个Form,名为FrmMain。 在界面添加一个MenuStrip和一个Button。 并设置好控件的文本和位置。(Language=(Default)) 2. 设置窗体FrmMain属性 :Localizable=true , Languange=英语 并 阅读全文
posted @ 2017-04-20 10:21 发明创造小能手 阅读(533) 评论(0) 推荐(0)
摘要:this.myButton.BackColor = System.Drawing.SystemColors.Control; this.myButton.FlatAppearance.BorderColor = System.Drawing.SystemColors.Control; this.myButton.FlatAppearance.BorderSize = 0; this.m... 阅读全文
posted @ 2017-04-19 16:18 发明创造小能手 阅读(2120) 评论(0) 推荐(0)
摘要:Winfrom Button 去掉获取焦点时的边框: 自定义一个Button,重写ShowFocusCues方法 阅读全文
posted @ 2017-04-19 16:09 发明创造小能手 阅读(1626) 评论(0) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows.Forms; namespace ... 阅读全文
posted @ 2017-03-10 11:48 发明创造小能手 阅读(686) 评论(0) 推荐(0)
摘要:[datagridview与treeview绑定] treeview 代码: datagridview多维表头实现效果: 自定义控件全部代码: using System;using System.Collections.Generic;using System.Text;using System.W 阅读全文
posted @ 2017-03-09 17:48 发明创造小能手 阅读(3600) 评论(0) 推荐(0)
摘要:DataGridView单元格合并和二维表头应用: 自定义控件全部代码: 空间上添加一个timer1,20毫秒 阅读全文
posted @ 2017-03-09 17:22 发明创造小能手 阅读(4869) 评论(0) 推荐(1)
摘要:a form & a tabControl 思路: DrawMode设一定要设为OwnerDrawFixed 事件:Form_Load、tabControl1_DrawItem、tabControl1_DrawItem 注意: 阅读全文
posted @ 2017-03-09 16:59 发明创造小能手 阅读(829) 评论(0) 推荐(1)
摘要:1、DataTable转成ListView: 先遍历DataTable的列,把DataTable列名添加到listView列头。 然后外循环添加行,内循环添加列 跟这篇文章是一样的 http://www.cnblogs.com/Sukie-s-home/p/5702469.html 2、ListVi 阅读全文
posted @ 2016-08-16 15:19 发明创造小能手 阅读(1789) 评论(0) 推荐(0)
摘要:在开发WinCE6.0程序的时候,要把DataTable的数据显示到ListView控件上,无法使用绑定, 只能使用循环遍历。 思路:外循环遍历行,内循环遍历列 阅读全文
posted @ 2016-07-25 10:00 发明创造小能手 阅读(484) 评论(0) 推荐(0)
摘要:实现效果如下: 1、设计窗体 下拉框的名称cmbName 2、连接数据库 DBHelper类代码: 3、窗体代码 窗体Load事件 阅读全文
posted @ 2016-07-22 13:39 发明创造小能手
摘要:这是Winform 1、设计窗体 一个ListView listView1 一个textBox txbSelected 2、listView1填充数据 3、选中全行触发事件 阅读全文
posted @ 2016-07-22 13:39 发明创造小能手

levels of contents