黄学彪
2021-01-28 1fcf2302f79f9cbea5ef17c3688311ed65cfabb4
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using Shared;
using HDL_ON.UI.CSS;
using System;
using System.Collections.Generic;
using System.Text;
 
namespace HDL_ON.Stan
{
    /// <summary>
    /// 风扇档位进度条控件
    /// </summary>
    public class FanGearSeekBarControl : SeekBarImageControl
    {
        #region ■ 初始化_____________________________
 
        /// <summary>
        /// 风扇档位进度条控件
        /// </summary>
        /// <param name="i_width">宽度,非真实值,实际宽度会加上左右间距</param>
        public FanGearSeekBarControl(int i_width) : base(i_width)
        {
        }
 
        /// <summary>
        /// 初始化控件
        /// </summary>
        /// <param name="i_maxGear">最大档位</param>
        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
    }
}