using Shared;
using HDL_ON.UI.CSS;
using System;
using System.Collections.Generic;
using System.Text;
namespace HDL_ON.Stan
{
///
/// 风扇档位进度条控件
///
public class FanGearSeekBarControl : SeekBarImageControl
{
#region ■ 初始化_____________________________
///
/// 风扇档位进度条控件
///
/// 宽度,非真实值,实际宽度会加上左右间距
public FanGearSeekBarControl(int i_width) : base(i_width)
{
}
///
/// 初始化控件
///
/// 最大档位
public void InitControl(int i_maxGear)
{
//档位文字控件的宽度
int contrWidth = Application.GetRealWidth(8);
//档位文字之间的间距(需要减去左右两边的间距)
int contrSpace = (this.Width - this.SeekBarPadding * 2 - contrWidth * i_maxGear) / (i_maxGear - 1);
//初始X轴与滑动条一致
int XX = this.X + this.SeekBarPadding;
//生成档位控件
for (int i = 1; i <= i_maxGear; i++)
{
//档位控件
var btnGear = new NormalViewControl(contrWidth, Application.GetRealHeight(18), false);
btnGear.X = XX;
btnGear.Y = this.Bottom;
btnGear.Text = i.ToString();
btnGear.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
btnGear.TextColor = CSS_Color.PromptingColor1;
this.Parent.AddChidren(btnGear);
//X轴往右推移
if (i == i_maxGear)
{
//最后一个时,只到它的右边
XX = btnGear.Right;
}
else
{
XX = btnGear.Right + contrSpace;
}
}
//最后再打上一个【档】字
var btnGearView = new NormalViewControl(60, 18, true);
btnGearView.X = XX + Application.GetRealWidth(4);
btnGearView.Y = this.Bottom;
btnGearView.TextSize = CSS_FontSize.PromptFontSize_FirstLevel;
btnGearView.TextColor = CSS_Color.PromptingColor1;
btnGearView.Text = "(" + Language.StringByID(StringId.Gear) + ")";
this.Parent.AddChidren(btnGearView);
}
#endregion
}
}