Inheritance: BaseControl
Example #1
0
        private void InitHelper(out Label label, out ProgressBar bar, int row, string text, int value, Color barColor, Color barBack, Color textBack)
        {
            int borderSize = 0;
            //int spacer = 2;
            //int textWidth = 100;
            //int barLeftEdge = (2 * spacer) + textWidth;

            label = new Label(frameMgr, this);
            label.Text = text;
            label.BorderSize = 0;
            label.DrawTextFormat = DrawTextFormat.Right | DrawTextFormat.VerticalCenter;
            label.BackgroundColor = textBack;
            AddChildControl(label);

            bar = new ProgressBar(frameMgr, this);
            bar.BorderSize = borderSize;
            bar.BackgroundColor = barBack;
            bar.BarColor = barColor;
            bar.Value = value;
            AddChildControl(bar);

            ResizeHelper(label, bar, row, 7);
        }
Example #2
0
        private void ResizeHelper(Label label, ProgressBar bar, int row, int rows)
        {
            int clientWidth = clientRectangle.Width;
            int clientHeight = clientRectangle.Height;

            int spacer = 2;
            int spacer2 = spacer * 2;
            int textWidth = 100;
            int barLeftEdge = spacer2 + textWidth;

            int rowHeight = (clientHeight - (spacer * (rows + 1))) / rows;
            if (rowHeight < 5) rowHeight = 5;

            int barWidth = (clientWidth - spacer) - barLeftEdge;
            if (barWidth < 5) barWidth = 5;

            label.Location = new Point(spacer, spacer + (row * (rowHeight + spacer)));
            label.Size = new Size(textWidth, rowHeight);

            bar.Location = new Point(barLeftEdge, spacer + (row * (rowHeight + spacer)));
            bar.Size = new Size(barWidth, rowHeight);
        }