private void CreateColorControl(String name, int y) { const int colorSize = 12; GroupBox colorGroup = new GroupBox(this); colorGroup.SetPosition(10, y); colorGroup.SetText(name); colorGroup.SetSize(160, 35); colorGroup.Name = name + "groupbox"; ColorDisplay disp = new ColorDisplay(colorGroup); disp.Name = name; disp.SetBounds(0, 10, colorSize, colorSize); TextBoxNumeric numeric = new TextBoxNumeric(colorGroup); numeric.Name = name + "Box"; numeric.SetPosition(105, 7); numeric.SetSize(26, 16); numeric.SelectAllOnFocus = true; numeric.TextChanged += NumericTyped; HorizontalSlider slider = new HorizontalSlider(colorGroup); slider.SetPosition(colorSize + 5, 10); slider.SetRange(0, 255); slider.SetSize(80, colorSize); slider.Name = name + "Slider"; slider.ValueChanged += SlidersMoved; }
private void CreateControls() { const int startY = 5; const int height = 35; CreateColorControl("Red", startY); CreateColorControl("Green", startY + height); CreateColorControl("Blue", startY + height * 2); CreateColorControl("Alpha", startY + height * 3); GroupBox finalGroup = new GroupBox(this); finalGroup.SetPosition(180, 40); finalGroup.SetSize(60, 60); finalGroup.SetText("Result"); finalGroup.Name = "ResultGroupBox"; ColorDisplay disp = new ColorDisplay(finalGroup); disp.Name = "Result"; disp.SetBounds(0, 10, 32, 32); //disp.DrawCheckers = true; //UpdateControls(); }
private void setupUi() { renderer = new Gwen.Renderer.OpenTK(); Gwen.Skin.Base skin = new Gwen.Skin.TexturedBase(renderer, "DefaultSkin.png"); canvas = new Canvas(skin); canvas.SetSize(Width, Height); gwenInput = new Gwen.Input.OpenTK(this); gwenInput.Initialize(canvas); Mouse.ButtonDown += Mouse_ButtonDown; Mouse.ButtonUp += Mouse_ButtonUp; Mouse.Move += Mouse_Move; Mouse.WheelChanged += Mouse_Wheel; canvas.ShouldDrawBackground = true; canvas.BackgroundColor = System.Drawing.Color.FromArgb(122, 150, 170, 170); // controls radioCamera = new RadioButtonGroup(canvas); radioCamera.AutoSizeToContents = true; radioCamera.SetText("Тип камеры"); radioCamera.AddOption("Свободная", "free"); radioCamera.AddOption("Привязанная", "bound"); radioCamera.SetSelection(0); radioCamera.SelectionChanged += radioCamera_SelectionChanged; // coord GroupBox posGroup = new GroupBox(canvas); posGroup.SetText("Позиция камеры"); posGroup.SizeToChildren(); posGroup.SetSize(150, 120); Gwen.Align.PlaceDownLeft(posGroup, radioCamera, 45); labelPosX = new Label(posGroup); labelPosY = new Label(posGroup); labelPosZ = new Label(posGroup); labelPosX.SetText("X: 0.0"); labelPosY.SetText("Y: 1.0"); labelPosZ.SetText("Z: 2.0"); Gwen.Align.PlaceDownLeft(labelPosY, labelPosX, 5); Gwen.Align.PlaceDownLeft(labelPosZ, labelPosY, 5); // reset button Button resetCameraButton = new Gwen.Control.Button(posGroup); resetCameraButton.SetText("Сбросить позицию\nкамеры"); resetCameraButton.Clicked += cameraReset_Clicked; resetCameraButton.SizeToContents(); Gwen.Align.PlaceDownLeft(resetCameraButton, labelPosZ, 5); labelSpeed = new Label(canvas); Gwen.Align.PlaceDownLeft(labelSpeed, posGroup, 5); labelTips = new Label(canvas); labelTips.SetText(freeCameraTip + "\n\n" + nodeTransformTip); labelTips.SizeToContents(); Gwen.Align.PlaceDownLeft(labelTips, labelSpeed, 15); statusBar = new Gwen.Control.StatusBar(canvas); statusBar.Dock = Gwen.Pos.Bottom; }
private void CreateControls() { const int startY = 5; const int height = 35; CreateColorControl("Red", startY); CreateColorControl("Green", startY + height); CreateColorControl("Blue", startY + height*2); CreateColorControl("Alpha", startY + height*3); GroupBox finalGroup = new GroupBox(this); finalGroup.SetPosition(180, 40); finalGroup.SetSize(60, 60); finalGroup.SetText("Result"); finalGroup.Name = "ResultGroupBox"; ColorDisplay disp = new ColorDisplay(finalGroup); disp.Name = "Result"; disp.SetBounds(0, 10, 32, 32); //disp.DrawCheckers = true; //UpdateControls(); }