设为首页 加入收藏

TOP

(八十)c#Winform自定义控件-分割线标签(二)
2019-10-09 20:05:59 】 浏览:360
Tags:八十 c#Winform 定义 控件 -分割线 标签
t;summary>
74 /// 获取或设置大小,该大小是 <see cref="M:System.Windows.Forms.Control.GetPreferredSize(System.Drawing.Size)" /> 可以指定的下限。 75 /// </summary> 76 /// <value>The minimum size.</value> 77 [Localizable(true)] 78 public override Size MinimumSize 79 { 80 get 81 { 82 return base.MinimumSize; 83 } 84 set 85 { 86 base.MinimumSize = value; 87 ResetMaxSize(); 88 } 89 } 90 91 92 /// <summary> 93 /// 获取或设置大小,该大小是 <see cref="M:System.Windows.Forms.Control.GetPreferredSize(System.Drawing.Size)" /> 可以指定的上限。 94 /// </summary> 95 /// <value>The maximum size.</value> 96 [Localizable(true)] 97 public override Size MaximumSize 98 { 99 get 100 { 101 return base.MaximumSize; 102 } 103 set 104 { 105 base.MaximumSize = value; 106 ResetMaxSize(); 107 } 108 } 109 /// <summary> 110 /// 获取或设置一个值,该值指示是否自动调整控件的大小以完整显示其内容。 111 /// </summary> 112 /// <value><c>true</c> if [automatic size]; otherwise, <c>false</c>.</value> 113 /// <PermissionSet> 114 /// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> 115 /// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> 116 /// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" /> 117 /// <IPermission class="System.Diagnostics.PerformanceCounterPermission, System, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> 118 /// </PermissionSet> 119 [EditorBrowsable(EditorBrowsableState.Never), Browsable(false)] 120 public override bool AutoSize 121 { 122 get 123 { 124 return base.AutoSize; 125 } 126 set 127 { 128 base.AutoSize = value; 129 } 130 } 131 132 133 /// <summary> 134 /// The line color 135 /// </summary> 136 private Color lineColor = LineColors.Light; 137 138 /// <summary> 139 /// Gets or sets the color of the line. 140 /// </summary> 141 /// <value>The color of the line.</value> 142 public Color LineColor 143 { 144 get { return lineColor; } 145 set 146 { 147 lineColor = value; 148 Invalidate(); 149 } 150 } 151 152 /// <summary> 153 /// Resets the maximum size. 154 /// </summary> 155 private void ResetMaxSize() 156 { 157 using (var g = this.CreateGraphics()) 158 { 159 var _width = Width; 160 var size = g.MeasureString(string.IsNullOrEmpty(Text) ? "A" : Text, Font); 161 if (MinimumSize.Height != (int)size.Height) 162 MinimumSize = new Size(base.MinimumSize.Width, (int)size.Height); 163 if (MaximumSize.Height != (int)size.Height) 164 MaximumSize = new Size(base.MaximumSize.Width, (int)size.H
首页 上一页 1 2 3 下一页 尾页 2/3/3
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇dotnetcore+vue+elementUI 前后端.. 下一篇Parallel.ForEach 使用多线遍历循..

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目