Inheritance: BaseControl
Example #1
0
		public override void InitializeControls ()
		{
			base.InitializeControls();
			
			Texture texture = TextureManager.Instance.Find(ResourceLocator.GetFullPath("Planets/Earth/earth.dds"), TextureMagFilter.Nearest, TextureMinFilter.Nearest, TextureWrapMode.Clamp, TextureWrapMode.Clamp);
			
			this.progressBar = new ProgressBar(this.frameMgr, this);
			this.progressBar.Location = new Point(10, 10);
			this.progressBar.Size = new Size(200, 20);
			this.progressBar.Value = 75;
			this.progressBar.BorderSize = 1;
			AddChildControl(this.progressBar);
			
			this.button = new Button(this.frameMgr, this);
			this.button.Location = new Point(10, 40);
			this.button.Size = new Size(100,25);
			this.button.BorderSize = 1;
			AddChildControl(this.button);
						
			this.picture = new Picture(this.frameMgr, this);
			this.picture.Location = new Point(10, 70);
			this.picture.Size = new Size(200, 200);
			this.picture.BorderSize = 1;
			this.picture.Texture = texture;			
			AddChildControl(this.picture);
			
			this.vScrollBar = new VScrollBar(this.frameMgr, this);
			this.vScrollBar.Location = new Point(220, 10);
			this.vScrollBar.Size = new Size(40, 260);
			AddChildControl(this.vScrollBar);			
		}
Example #2
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 #3
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);
        }