DataGridView背景图片
来源:互联网 发布:matlab 2017b for mac 编辑:程序博客网 时间:2024/06/02 21:59
控件扩展与设置
定义背景图片: public class DataGridView背景 : DataGridView { protected override void PaintBackground(Graphics 绘图画面, Rectangle 绘制背景, Rectangle 绘制区域) { base.PaintBackground(绘图画面, 绘制背景, 绘制区域); Bitmap[] 背景图 = new Bitmap[] { 资源文件.美女, 资源文件.花, 资源文件.花2, 资源文件.花3, 资源文件.花4, 资源文件.花5, 资源文件.花6, 资源文件.欧美美女, 资源文件.欧美美女1, 资源文件.欧美美女2, 资源文件.欧美美女3, 资源文件.欧美美女4, 资源文件.欧美美女5, 资源文件.花7, 资源文件.花8, 资源文件.花9, 资源文件.花10, 资源文件.花11, 资源文件.花12, 资源文件.花13, 资源文件.欧美美女6, 资源文件.欧美美女7, 资源文件.欧美美女8, 资源文件.欧美美女9, 资源文件.欧美美女10, 资源文件.欧美美女11, 资源文件.花14, 资源文件.花15, 资源文件.花17, 资源文件.花18, 资源文件.花19, 资源文件.花20, 资源文件.花23 };//(int)this.Tag 绘图画面.DrawImage(背景图[(int)base.Tag % 背景图.Length], 绘制区域); Rectangle 区域 = new Rectangle(绘制区域.X + 1, 绘制区域.Y + 1, 绘制区域.Width - 3, 绘制区域.Height - 3); 绘图画面.DrawRectangle(Pens.Red, 区域); } }实例化:DataGridView 背景图事件日历 = new DataGridView背景();设置停靠容器和大小: private void Form1_Load(object sender, EventArgs e) { 背景图事件日历.Parent = this; 背景图事件日历.Dock = DockStyle.Fill; 背景图事件日历.Tag = DateTime.Now.Minute; 日历加载(DateTime.Now); }刷新背景(在定时中按分钟自绘): this.BeginInvoke(new Action(() => { if (DateTime.Now.Minute == 0 && DateTime.Now.Second == 1) 日历加载(DateTime.Now);/*每小时更新时辰因为0时日期变更时辰亦变更*/ if (DateTime.Now.Minute < 59 && DateTime.Now.Second == 0) { 自定日历.Tag = DateTime.Now.Minute; 自定日历.Refresh(); } }));一些设置: 背景图事件日历.AllowUserToAddRows = false; 背景图事件日历.AllowUserToDeleteRows = false; 背景图事件日历.AllowUserToOrderColumns = false; 背景图事件日历.AllowUserToResizeColumns = false; 背景图事件日历.AllowUserToResizeRows = false; 背景图事件日历.ReadOnly = true; 背景图事件日历.RowHeadersVisible = false; 背景图事件日历.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill; 背景图事件日历.ColumnHeadersDefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; 背景图事件日历.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders; 背景图事件日历.RowsDefaultCellStyle.WrapMode = (DataGridViewTriState.True); 背景图事件日历.DefaultCellStyle.SelectionBackColor = Color.Transparent; 背景图事件日历.DefaultCellStyle.SelectionForeColor = Color.Red;//.Blue.Gold 背景图事件日历.GridColor = Color.Lime; 背景图事件日历.CellClick += new DataGridViewCellEventHandler(背景图事件日历_CellClick);
- DataGridView背景图片
- DataGridView 添加背景图片
- 背景图片
- 背景图片
- 背景图片
- Datagridview
- DataGridView
- DataGridView
- DataGridView
- DATAGRIDVIEW
- DataGridView
- DataGridView
- datagridview
- DataGridView
- dataGridView
- datagridview
- DataGridView
- datagridview
- 通向架构师的道路(第五天)之tomcat集群-群猫乱舞
- iOS 第三方框架SDWebImage的简单使用
- 黑马程序员——java第二十二天:GUI
- 判断数组是否包含元素
- SOA与EAI的比较
- DataGridView背景图片
- 使用getopt_long()从命令行获取参数,struct option
- C语言 string.h 中函数的实现
- 手把手教你WEB套打程序开发
- ios图片拉伸问题的总结
- Qt排序问题
- 如何获取选中的颜色值
- Android开发者不可或缺的四大工具
- 系统架构设计师考试大纲