示例#1
0
        private void ZoneDataBoxPaint(object sender, PaintEventArgs e)
        {
            if (ZoneData.IsEmpty)
            {
                return;
            }

            var x = 0;

            using (var g = e.Graphics)
            {
                for (var i = 0; i < Brushes.Length; i++)
                {
                    var curWidth = (int)(ZoneData.GetZonePercentage(i + 1) * Width);
                    if (i == Brushes.Length - 1)
                    {
                        curWidth = Width - x;
                    }

                    if (curWidth == 0)
                    {
                        continue;
                    }

                    g.FillRectangle(Brushes[i], x, 0, curWidth, Height);
                    x += curWidth;
                }
            }
        }