// ***********************************************************************
// Assembly : HZH_Controls
// Created : 08-08-2019
//
// ***********************************************************************
//
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
//
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace HZH_Controls.Controls
{
///
/// Class UCProcessExt.
/// Implements the
///
///
public partial class UCProcessExt : UCControlBase
{
///
/// The value
///
private int _value = 0;
///
/// Gets or sets the value.
///
/// The value.
public int Value
{
get { return this._value; }
set
{
if (value < 0)
return;
this._value = value;
SetValue();
}
}
///
/// The maximum value
///
private int maxValue = 100;
///
/// Gets or sets the maximum value.
///
/// The maximum value.
public int MaxValue
{
get { return maxValue; }
set
{
if (value <= 0)
return;
maxValue = value;
SetValue();
}
}
///
/// Sets the value.
///
private void SetValue()
{
double dbl = (double)_value / (double)maxValue;
this.panel1.Width = (int)(this.Width * dbl);
}
///
/// Initializes a new instance of the class.
///
public UCProcessExt()
{
InitializeComponent();
}
///
/// Handles the SizeChanged event of the ProcessExt control.
///
/// The source of the event.
/// The instance containing the event data.
private void ProcessExt_SizeChanged(object sender, EventArgs e)
{
SetValue();
}
///
/// Steps this instance.
///
public void Step()
{
Value++;
}
}
}