using System; using System.Drawing; using System.Windows.Forms; namespace WindowsFormsControlLibrary1 { public partial class UserControl1 : UserControl { int pos=1; Color clr=Color.AliceBlue; public UserControl1() { InitializeComponent(); } private void UserControl1_Load(object sender, EventArgs e) { label2.Left = 0; label1.Left = 0; label2.Size = this.ClientSize; label1.Size = label2.Size; this.label1.Width = pos; } public int Value { get { return pos; } set { pos = value; changeSlide(); } } public Color SetColor { get { return clr; } set { clr = value; color(); } } private void changeSlide() { if (pos > 0 && pos<101) { int temp =(int) this.ClientSize.Width * pos / 100; label1.Width = temp; label1.Text = this.ClientSize.Width.ToString(); } } private void color() { label1.BackColor = clr; } } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)