现在的位置: 首页 > 综合 > 正文

一个自绘的导航栏控件

2011年01月26日 ⁄ 综合 ⁄ 共 3767字 ⁄ 字号 评论关闭
一个自绘的导航栏控件,类似WINDOWS的左侧导航栏

 

  1using System;
  2
  3using System.Collections.Generic;
  4
  5using System.ComponentModel;
  6
  7using System.Drawing;
  8
  9using System.Data;
 10
 11using System.Text;
 12
 13using System.Windows.Forms;
 14
 15using System.Drawing.Drawing2D;
 16
 17using System.Threading;
 18
 19 
 20
 21namespace ShadePanelControl
 22
 23{
 24
 25    public partial class ShadePanelControl : UserControl
 26
 27    {
 28
 29        private LinearGradientBrush lgBrush;
 30
 31        private Color startColor = Color.White;
 32
 33        private Color endColor = Color.Silver;
 34
 35        private Color frameColor = Color.Silver;
 36
 37        private string titleString = "标题一";
 38
 39        private int topPanelHeight = 20;
 40
 41        private Color titleStringColor = Color.Gray;
 42
 43        private bool beenExpand = false;
 44
 45        private int height;
 46
 47 
 48
 49        public int Height1
 50
 51        {
 52
 53            get return this.Height; }
 54
 55            set
 56
 57            {
 58
 59                this.Height = value;
 60
 61                height = value;
 62
 63                this.Invalidate();
 64
 65            }

 66
 67        }

 68
 69 
 70
 71        [Category("TitleStringColor"), Description("标题颜色")]
 72
 73        public Color TitleStringColor
 74
 75        {
 76
 77            get return titleStringColor; }
 78
 79            set
 80
 81            {
 82
 83                titleStringColor = value;
 84
 85                this.Invalidate();
 86
 87            }

 88
 89        }

 90
 91 
 92
 93 
 94
 95        Arribute Set Or Get
204
205        public ShadePanelControl()
206
207        {
208
209            InitializeComponent();
210
211            this.height = this.Height;
212
213        }

214
215        protected override void OnPaint(PaintEventArgs e)
216
217        {
218
219            DrawPanel(e.Graphics);
220
221            DrawSolidLine(e.Graphics);
222
223            DrawTitleString(e.Graphics);
224
225            base.OnPaint(e);
226
227        }

228
229 
230
231        /// <summary>
232
233        /// 绘制渐变框
234
235        /// </summary>
236
237        /// <param name="g"></param>
【上篇】
【下篇】

抱歉!评论已关闭.