[此贴子已经被作者于2006-9-24 16:04:07编辑过]
[此贴子已经被作者于2006-9-24 16:04:07编辑过]
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace Sep_24_SingleLine
{
public partial class SingleLine : UserControl
{
public SingleLine()
{
InitializeComponent();
}
public int Length
{
get
{ return label1.Size.Width; }
set
{ label1.Size = new Size(value, label1.Size.Height); }
}
private void SingleLine_SizeChanged(object sender, EventArgs e)
{
label1.Size = new Size(this.Size.Width - 5, label1.Size.Height);
}
}
}
namespace Sep_24_SingleLine
{
partial class SingleLine
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.label1.Location = new System.Drawing.Point(5, 7);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(134, 2);
this.label1.TabIndex = 0;
//
// SingleLine
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.label1);
this.Name = "SingleLine";
this.Size = new System.Drawing.Size(144, 16);
this.SizeChanged += new System.EventHandler(this.SingleLine_SizeChanged);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.Label label1;
}
}
[此贴子已经被作者于2006-9-24 16:14:45编辑过]