Commit 513941ae HZH

添加Tab控件

1 个父辈 f6221286
...@@ -210,31 +210,6 @@ namespace HZH_Controls.Controls ...@@ -210,31 +210,6 @@ namespace HZH_Controls.Controls
get { return _selectedText; } get { return _selectedText; }
private set private set
{ {
//if (_source == null || _source.Count <= 0)
//{
// _selectText = "";
// _selectValue = "";
// _selectIndex = -1;
// _selectItem = new KeyValuePair<string, string>();
//}
//else
//{
// _selectText = "";
// _selectValue = "";
// _selectIndex = -1;
// _selectItem = new KeyValuePair<string, string>();
// for (int i = 0; i < _source.Count; i++)
// {
// if (_source[i].Value == value)
// {
// _selectText = value;
// _selectValue = _source[i].Key;
// _selectIndex = i;
// _selectItem = _source[i];
// break;
// }
// }
//}
_selectedText = value; _selectedText = value;
lblInput.Text = _selectedText; lblInput.Text = _selectedText;
txtInput.Text = _selectedText; txtInput.Text = _selectedText;
...@@ -417,25 +392,6 @@ namespace HZH_Controls.Controls ...@@ -417,25 +392,6 @@ namespace HZH_Controls.Controls
base.FillColor = Color.White; base.FillColor = Color.White;
base.RectColor = Color.FromArgb(220, 220, 220); base.RectColor = Color.FromArgb(220, 220, 220);
} }
//if (this.Parent != null && BackColor == Color.Transparent)
//{
// Control c = this;
// while (true)
// {
// if (c.BackColor == Color.Transparent)
// {
// c = c.Parent;
// }
// else
// {
// txtInput.BackColor = c.BackColor;
// base.FillColor = c.BackColor;
// base.RectColor = c.BackColor;
// break;
// }
// }
//}
} }
} }
} }
...@@ -25,7 +25,9 @@ namespace HZH_Controls.Controls ...@@ -25,7 +25,9 @@ namespace HZH_Controls.Controls
set set
{ {
_DataSource = value; _DataSource = value;
int intWidth = ControlHelper.GetStringWidth(value.Value, lblTitle.CreateGraphics(), lblTitle.Font); var g=lblTitle.CreateGraphics();
int intWidth = ControlHelper.GetStringWidth(value.Value, g, lblTitle.Font);
g.Dispose();
if (intWidth < 50) if (intWidth < 50)
intWidth = 50; intWidth = 50;
this.Width = intWidth + 20; this.Width = intWidth + 20;
......
...@@ -98,6 +98,9 @@ ...@@ -98,6 +98,9 @@
<Compile Include="Controls\Menu\UCMenuParentItem.Designer.cs"> <Compile Include="Controls\Menu\UCMenuParentItem.Designer.cs">
<DependentUpon>UCMenuParentItem.cs</DependentUpon> <DependentUpon>UCMenuParentItem.cs</DependentUpon>
</Compile> </Compile>
<Compile Include="Controls\Tab\TabControlExt.cs">
<SubType>Component</SubType>
</Compile>
<Compile Include="Helpers\ControlHelper.cs" /> <Compile Include="Helpers\ControlHelper.cs" />
<Compile Include="Controls\Btn\UCBtnExt.cs"> <Compile Include="Controls\Btn\UCBtnExt.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
......
...@@ -431,23 +431,16 @@ namespace HZH_Controls ...@@ -431,23 +431,16 @@ namespace HZH_Controls
System.Drawing.Graphics g, System.Drawing.Graphics g,
System.Drawing.Font font) System.Drawing.Font font)
{ {
try string[] strs = strSource.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
{ float fltWidth = 0;
string[] strs = strSource.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries); foreach (var item in strs)
float fltWidth = 0;
foreach (var item in strs)
{
System.Drawing.SizeF sizeF = g.MeasureString(strSource.Replace(" ", "A"), font);
if (sizeF.Width > fltWidth)
fltWidth = sizeF.Width;
}
return (int)fltWidth;
}
finally
{ {
g.Dispose(); System.Drawing.SizeF sizeF = g.MeasureString(strSource.Replace(" ", "A"), font);
if (sizeF.Width > fltWidth)
fltWidth = sizeF.Width;
} }
return (int)fltWidth;
} }
#endregion #endregion
......
...@@ -28,20 +28,174 @@ ...@@ -28,20 +28,174 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
this.tabControlExt1 = new HZH_Controls.Controls.TabControlExt();
this.tabPage7 = new System.Windows.Forms.TabPage();
this.tabPage8 = new System.Windows.Forms.TabPage();
this.tabPage9 = new System.Windows.Forms.TabPage();
this.tabPage10 = new System.Windows.Forms.TabPage();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.tabPage2 = new System.Windows.Forms.TabPage();
this.tabPage3 = new System.Windows.Forms.TabPage();
this.tabPage4 = new System.Windows.Forms.TabPage();
this.tabPage5 = new System.Windows.Forms.TabPage();
this.tabPage6 = new System.Windows.Forms.TabPage();
this.panel3.SuspendLayout();
this.tabControlExt1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
// //
// panel3
//
this.panel3.Controls.Add(this.tabControlExt1);
this.panel3.Size = new System.Drawing.Size(528, 321);
//
// tabControlExt1
//
this.tabControlExt1.Controls.Add(this.tabPage7);
this.tabControlExt1.Controls.Add(this.tabPage8);
this.tabControlExt1.Controls.Add(this.tabPage9);
this.tabControlExt1.Controls.Add(this.tabPage10);
this.tabControlExt1.Controls.Add(this.tabPage1);
this.tabControlExt1.Controls.Add(this.tabPage2);
this.tabControlExt1.Controls.Add(this.tabPage3);
this.tabControlExt1.Controls.Add(this.tabPage4);
this.tabControlExt1.Controls.Add(this.tabPage5);
this.tabControlExt1.Controls.Add(this.tabPage6);
this.tabControlExt1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tabControlExt1.ItemSize = new System.Drawing.Size(142, 50);
this.tabControlExt1.Location = new System.Drawing.Point(0, 0);
this.tabControlExt1.Multiline = true;
this.tabControlExt1.Name = "tabControlExt1";
this.tabControlExt1.SelectedIndex = 0;
this.tabControlExt1.Size = new System.Drawing.Size(528, 321);
this.tabControlExt1.SizeMode = System.Windows.Forms.TabSizeMode.FillToRight;
this.tabControlExt1.TabIndex = 0;
//
// tabPage7
//
this.tabPage7.Location = new System.Drawing.Point(4, 54);
this.tabPage7.Name = "tabPage7";
this.tabPage7.Padding = new System.Windows.Forms.Padding(3);
this.tabPage7.Size = new System.Drawing.Size(520, 263);
this.tabPage7.TabIndex = 6;
this.tabPage7.Text = "tabPage7";
this.tabPage7.UseVisualStyleBackColor = true;
//
// tabPage8
//
this.tabPage8.Location = new System.Drawing.Point(4, 54);
this.tabPage8.Name = "tabPage8";
this.tabPage8.Padding = new System.Windows.Forms.Padding(3);
this.tabPage8.Size = new System.Drawing.Size(419, 128);
this.tabPage8.TabIndex = 7;
this.tabPage8.Text = "tabPage8";
this.tabPage8.UseVisualStyleBackColor = true;
//
// tabPage9
//
this.tabPage9.Location = new System.Drawing.Point(4, 54);
this.tabPage9.Name = "tabPage9";
this.tabPage9.Padding = new System.Windows.Forms.Padding(3);
this.tabPage9.Size = new System.Drawing.Size(419, 128);
this.tabPage9.TabIndex = 8;
this.tabPage9.Text = "tabPage9";
this.tabPage9.UseVisualStyleBackColor = true;
//
// tabPage10
//
this.tabPage10.Location = new System.Drawing.Point(4, 54);
this.tabPage10.Name = "tabPage10";
this.tabPage10.Padding = new System.Windows.Forms.Padding(3);
this.tabPage10.Size = new System.Drawing.Size(419, 128);
this.tabPage10.TabIndex = 9;
this.tabPage10.Text = "tabPage10";
this.tabPage10.UseVisualStyleBackColor = true;
//
// tabPage1
//
this.tabPage1.Location = new System.Drawing.Point(4, 54);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
this.tabPage1.Size = new System.Drawing.Size(520, 263);
this.tabPage1.TabIndex = 10;
this.tabPage1.Text = "tabPage1";
this.tabPage1.UseVisualStyleBackColor = true;
//
// tabPage2
//
this.tabPage2.Location = new System.Drawing.Point(4, 54);
this.tabPage2.Name = "tabPage2";
this.tabPage2.Padding = new System.Windows.Forms.Padding(3);
this.tabPage2.Size = new System.Drawing.Size(520, 263);
this.tabPage2.TabIndex = 11;
this.tabPage2.Text = "tabPage2";
this.tabPage2.UseVisualStyleBackColor = true;
//
// tabPage3
//
this.tabPage3.Location = new System.Drawing.Point(4, 104);
this.tabPage3.Name = "tabPage3";
this.tabPage3.Padding = new System.Windows.Forms.Padding(3);
this.tabPage3.Size = new System.Drawing.Size(520, 213);
this.tabPage3.TabIndex = 12;
this.tabPage3.Text = "tabPage3";
this.tabPage3.UseVisualStyleBackColor = true;
//
// tabPage4
//
this.tabPage4.Location = new System.Drawing.Point(4, 104);
this.tabPage4.Name = "tabPage4";
this.tabPage4.Padding = new System.Windows.Forms.Padding(3);
this.tabPage4.Size = new System.Drawing.Size(520, 213);
this.tabPage4.TabIndex = 13;
this.tabPage4.Text = "tabPage4";
this.tabPage4.UseVisualStyleBackColor = true;
//
// tabPage5
//
this.tabPage5.Location = new System.Drawing.Point(4, 104);
this.tabPage5.Name = "tabPage5";
this.tabPage5.Padding = new System.Windows.Forms.Padding(3);
this.tabPage5.Size = new System.Drawing.Size(520, 213);
this.tabPage5.TabIndex = 14;
this.tabPage5.Text = "tabPage5";
this.tabPage5.UseVisualStyleBackColor = true;
//
// tabPage6
//
this.tabPage6.Location = new System.Drawing.Point(4, 104);
this.tabPage6.Name = "tabPage6";
this.tabPage6.Padding = new System.Windows.Forms.Padding(3);
this.tabPage6.Size = new System.Drawing.Size(520, 213);
this.tabPage6.TabIndex = 15;
this.tabPage6.Text = "tabPage6";
this.tabPage6.UseVisualStyleBackColor = true;
//
// FrmOKCancel1Test // FrmOKCancel1Test
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(427, 310); this.ClientSize = new System.Drawing.Size(528, 445);
this.Name = "FrmOKCancel1Test"; this.Name = "FrmOKCancel1Test";
this.Text = "FrmOKCancelTest"; this.Text = "FrmOKCancelTest";
this.Title = "测试修改密码"; this.Title = "测试修改密码";
this.panel3.ResumeLayout(false);
this.tabControlExt1.ResumeLayout(false);
this.ResumeLayout(false); this.ResumeLayout(false);
} }
#endregion #endregion
private HZH_Controls.Controls.TabControlExt tabControlExt1;
private System.Windows.Forms.TabPage tabPage7;
private System.Windows.Forms.TabPage tabPage8;
private System.Windows.Forms.TabPage tabPage9;
private System.Windows.Forms.TabPage tabPage10;
private System.Windows.Forms.TabPage tabPage1;
private System.Windows.Forms.TabPage tabPage2;
private System.Windows.Forms.TabPage tabPage3;
private System.Windows.Forms.TabPage tabPage4;
private System.Windows.Forms.TabPage tabPage5;
private System.Windows.Forms.TabPage tabPage6;
} }
} }
\ No newline at end of file \ No newline at end of file
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!