예제 #1
0
 public abstract void PaintProgressBar(ProgressBar component);
예제 #2
0
        public override void PaintProgressBar(ProgressBar component)
        {
            SubImage subI1, subI2;
            float x1, x2, x3, x4, y1, y2, y3, y4;

            Position origin = UI.Instance.GetOrigin();

            if (component.Type == ETypeOrientation.Horizontal)
            {
                origin = UI.Instance.GetOrigin();

                subI1 = progressBarLeft;
                subI2 = progressBarRight;

                x1 = origin.X + component.Position.X;
                x2 = origin.X + component.Position.X + 4;
                x3 = origin.X + component.Position.X + component.Size.width - 4;
                x4 = origin.X + component.Position.X + component.Size.width;
                y1 = origin.Y + component.Position.Y;
                y2 = origin.Y + component.Position.Y + component.Size.height;

                GL.Enable(EnableCap.Texture2D);
                GL.Color3(1f, 1f, 1f);
                progressBarLeft.Paint(x1, y1, x2, y2);
                progressBarRight.Paint(x3, y1, x4, y2);
                GL.Disable(EnableCap.Texture2D);
                GL.Color3((byte)79, (byte)91, (byte)84);
                GL.Begin(BeginMode.Quads);
                GL.Vertex2(x2, y1);
                GL.Vertex2(x3, y1);
                GL.Vertex2(x3, y2);
                GL.Vertex2(x2, y2);
                GL.End();
                GL.Color3((byte)46, (byte)55, (byte)53);

                GL.Begin(BeginMode.Quads);
                GL.Vertex2(x1 + 2, y1 + 2);
                GL.Vertex2(x1 + 2 + component.POfSlider, y1 + 2);
                GL.Vertex2(x1 + 2 + component.POfSlider, y2 - 2);
                GL.Vertex2(x1 + 2, y2 - 2);
                GL.End();
            }
            else
            {
                subI1 = progressBarTop;
                subI2 = progressBarBottom;

                x1 = origin.X + component.Position.X;
                x2 = origin.X + component.Position.X + component.Size.width;
                y1 = origin.Y + component.Position.Y;
                y2 = origin.Y + component.Position.Y + 4;
                y3 = origin.Y + component.Position.Y + component.Size.height - 4;
                y4 = origin.Y + component.Position.Y + component.Size.height;

                GL.Enable(EnableCap.Texture2D);
                GL.Color3(1f, 1f, 1f);
                progressBarTop.Paint(x1, y1, x2, y2);
                progressBarBottom.Paint(x1, y3, x2, y4);
                GL.Disable(EnableCap.Texture2D);
                GL.Color3((byte)79, (byte)91, (byte)84);
                GL.Begin(BeginMode.Quads);
                GL.Vertex2(x1, y2);
                GL.Vertex2(x2, y2);
                GL.Vertex2(x2, y3);
                GL.Vertex2(x1, y3);
                GL.End();
                GL.Color3((byte)46, (byte)55, (byte)53);

                GL.Begin(BeginMode.Quads);
                GL.Vertex2(x1 + 2, y4 - 2 - component.POfSlider);
                GL.Vertex2(x2 - 2, y4 - 2 - component.POfSlider);
                GL.Vertex2(x2 - 2, y4 - 2);
                GL.Vertex2(x1 + 2, y4 - 2);
                GL.End();
            }
        }
        public ProgressNSliderTestDialog()
            : base("Progress and Slider Test", 150, 150, 320, 200)
        {
            /*
			borderLayout=new BorderLayout(16,16,16,16,8);
			borderLayout.SouthHAlignment = EHorizontalAlignment.HRight;

			closeButton=new Button("Close");
			closeButton.LayoutProperty = EArea.South;

			valueLabel=new Label("Value:0%");
			valueLabel.LayoutProperty = EArea.North;

			centerPanel=new Panel();
			centerGirdLayout=new GirdLayout(2,1);
			centerPanel.Layout = centerGirdLayout;

			horizontalPBar=new ProgressBar(0.0f,100.0f,0.0f);
			horizontalSBar=new SlideBar(0.0f,100.0f,0.0f);

			centerPanel.Add(horizontalPBar);
			centerPanel.Add(horizontalSBar);
			centerPanel.LayoutProperty = EArea.Center;
			centerPanel.Pack();

			verticalPBar=new ProgressBar(0.0f,100.0f,0.0f, ETypeOrientation.Vertical);
			verticalSBar=new SlideBar(0.0f,100.0f,0.0f, ETypeOrientation.Vertical);

			verticalPBar.LayoutProperty = EArea.East;
            verticalSBar.LayoutProperty = EArea.East;

			Add(closeButton);
			Add(valueLabel);
			Add(centerPanel);
			Add(verticalPBar);
			Add(verticalSBar);

			Layout = borderLayout;

			Pack();
            */

            girdLayout = new GirdLayout(4, 1);

            girdLayout.SetHorizontalAlignment(0, 0, EHAlignment.HLeft);
            girdLayout.SetHorizontalAlignment(1, 0, EHAlignment.HCenter);
            girdLayout.SetHorizontalAlignment(2, 0, EHAlignment.HCenter);
            girdLayout.SetHorizontalAlignment(3, 0, EHAlignment.HRight);

            girdLayout.Right = 16;
            girdLayout.Left = 16;
            girdLayout.Top = 8;
            girdLayout.Bottom = 8;
            girdLayout.Spacer = 4;

            closeButton = new Button("Close");
            closeButton.LayoutProperty = EArea.South;

            valueLabel = new Label("Value: 0%");
            valueLabel.LayoutProperty = EArea.North;

            horizontalPBar = new ProgressBar(0.0f, 100.0f, ETypeOrientation.Horizontal);
            horizontalSBar = new SlideBar(0.0f, 100.0f, ETypeOrientation.Horizontal);

            Button button1 = new Button("button1");
            Button button2 = new Button("button2");

            Add(valueLabel);
            Add(horizontalPBar);
            Add(horizontalSBar);
            //Add(button1);
            //Add(button2);
            Add(closeButton);

            Layout = girdLayout;

            Pack();

            horizontalSBar.Slider.DragMovedEvent += new DragMovedHandler(Slider_DragMovedEvent);
            closeButton.MouseReleasedEvent += new MouseReleasedHandler(closeButton_MouseReleasedEvent);
        }