本人个人主页http://www.flyingwind.net/f/view.asp?id=228
CircleIndicator控件是一个仿机械仪表的显示控件,效果如下图
CircleIndicator属性
public int CurrentValue{get, set}
仪表的当前值
public int TotalSum{get, set}
刻度满值时表示的真实值大小
public Color PointerColor{get, set}
指针的颜色
public Color UnitColor{get, set}
单位标签颜色
public System.String Unit{get, set}
单位(deault=“X100” 表示仪器直接读出来的数要X100就是真实值)(注意仪器正中间会显示自动计算好的真实值CurrentValue)
public Color MinorColor{get, set}
次刻度颜色
public Color MajorColor{get, set}
主刻度颜色
public int MinorSlide{get, set}
主刻度与主刻度之间次刻度的个数(default=5)
public int MajorSlide{get, set}
主刻度个数(default=5)
public int TotalAngle{get, set}
总角度(default:140度)
下载FlyingWindTools2011-08-11.zip
下载地址2(CSDN):http://download.csdn.net/source/3511433
范例
{
public FlyingWindToolsExample()
{
InitializeComponent();
numericUpDown1.Maximum = UInt32.MaxValue;
}
/// <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 Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.circleIndicator1 = new Net.FlyingWind.Tools.CircleIndicator();
this.label3 = new System.Windows.Forms.Label();
this.numericUpDown3 = new System.Windows.Forms.NumericUpDown();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).BeginInit();
this.SuspendLayout();
//
// circleIndicator1
//
this.circleIndicator1.BackColor = System.Drawing.Color.White;
this.circleIndicator1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.circleIndicator1.CurrentValue = 0;
this.circleIndicator1.Location = new System.Drawing.Point(12, 78);
this.circleIndicator1.MajorColor = System.Drawing.Color.Red;
this.circleIndicator1.MajorSlide = 5;
this.circleIndicator1.Margin = new System.Windows.Forms.Padding(0);
this.circleIndicator1.MinorColor = System.Drawing.Color.Blue;
this.circleIndicator1.MinorSlide = 5;
this.circleIndicator1.Name = "circleIndicator1";
this.circleIndicator1.PointerColor = System.Drawing.Color.Red;
this.circleIndicator1.Size = new System.Drawing.Size(256, 131);
this.circleIndicator1.TabIndex = 1;
this.circleIndicator1.TotalAngle = 140;
this.circleIndicator1.TotalSum = 500;
this.circleIndicator1.Unit = "X100";
this.circleIndicator1.UnitColor = System.Drawing.Color.Black;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(12, 224);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(149, 12);
this.label3.TabIndex = 6;
this.label3.Text = "circleIndicator的显示值:\r\n";
//
// numericUpDown3
//
this.numericUpDown3.Location = new System.Drawing.Point(167, 220);
this.numericUpDown3.Maximum = new decimal(new int[] {
500,
0,
0,
0});
this.numericUpDown3.Name = "numericUpDown3";
this.numericUpDown3.Size = new System.Drawing.Size(83, 21);
this.numericUpDown3.TabIndex = 7;
this.numericUpDown3.ValueChanged += new System.EventHandler(this.numericUpDown3_ValueChanged);
//
// FlyingWindToolsExample
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(726, 380);
this.Controls.Add(this.numericUpDown3);
this.Controls.Add(this.label3);
this.Controls.Add(this.circleIndicator1);
this.Name = "FlyingWindToolsExample";
this.Text = "Form1";
((System.ComponentModel.ISupportInitialize)(this.numericUpDown3)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private Net.FlyingWind.Tools.CircleIndicator circleIndicator1;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.NumericUpDown numericUpDown3;
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
lightIndicator1.LightStatus = (int)numericUpDown1.Value;
}
private void numericUpDown2_ValueChanged(object sender, EventArgs e)
{
lightIndicator1.NumLight = (int)numericUpDown2.Value;
}
private void numericUpDown3_ValueChanged(object sender, EventArgs e)
{
circleIndicator1.CurrentValue = (int)numericUpDown3.Value;
}
}