public void NumEditHandlesNonNumberChars() { var container = new GuiWidget { DoubleBuffer = true, LocalBounds = new RectangleDouble(0, 0, 200, 200) }; var numberEdit = new NumberEdit(0, 0, 0, 12, 200, 16, true, true); container.AddChild(numberEdit); container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, numberEdit.Height - 1, 0)); container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, numberEdit.Height - 1, 0)); Assert.IsTrue(numberEdit.CharIndexToInsertBefore == 0); Assert.IsTrue(numberEdit.TopLeftOffset.Y == 0); // type a . (non numeric character) SendKey(Keys.Back, ' ', container); SendKey(Keys.Delete, ' ', container); SendKey(Keys.OemMinus, '-', container); Assert.IsTrue(numberEdit.Value == 0); SendKey(Keys.OemPeriod, '.', container); Assert.IsTrue(numberEdit.Value == 0); SendKey(Keys.D0, '.', container); Assert.IsTrue(numberEdit.Value == 0); SendKey(Keys.A, 'A', container); Assert.IsTrue(numberEdit.Value == 0); container.Close(); }
public MHNumberEdit(double startingValue, ThemeConfig theme, double pixelWidth = 0, double pixelHeight = 0, bool allowNegatives = false, bool allowDecimals = false, double minValue = int.MinValue, double maxValue = int.MaxValue, double increment = 1, int tabIndex = 0) { using (this.LayoutLock()) { this.Padding = 3; this.HAnchor = HAnchor.Fit; this.VAnchor = VAnchor.Fit; this.Border = 1; this.theme = theme; this.ActuallNumberEdit = new NumberEdit(startingValue, 0, 0, theme.DefaultFontSize, pixelWidth, pixelHeight, allowNegatives, allowDecimals, minValue, maxValue, increment, tabIndex) { VAnchor = VAnchor.Bottom, }; var internalWidget = this.ActuallNumberEdit.InternalTextEditWidget; internalWidget.TextColor = theme.EditFieldColors.Inactive.TextColor; internalWidget.FocusChanged += (s, e) => { internalWidget.TextColor = (internalWidget.Focused) ? theme.EditFieldColors.Focused.TextColor : theme.EditFieldColors.Inactive.TextColor; }; this.ActuallNumberEdit.InternalNumberEdit.MaxDecimalsPlaces = 5; this.AddChild(this.ActuallNumberEdit); } this.PerformLayout(); }
public MHNumberEdit(double startingValue, ThemeConfig theme, char singleCharLabel = char.MaxValue, double pixelWidth = 0, double pixelHeight = 0, bool allowNegatives = false, bool allowDecimals = false, double minValue = int.MinValue, double maxValue = int.MaxValue, double increment = 1, int tabIndex = 0) { using (this.LayoutLock()) { this.Padding = 3; this.HAnchor = HAnchor.Fit; this.VAnchor = VAnchor.Fit; this.Border = 1; this.theme = theme; double labelWidth = 0; if (singleCharLabel != char.MaxValue) { singleCharEditColor = theme.PrimaryAccentColor.WithContrast(theme.EditFieldColors.Focused.BackgroundColor, 3).ToColor(); labelWidget = new TextWidget(singleCharLabel.ToString(), pointSize: theme.DefaultFontSize - 2, textColor: theme.PrimaryAccentColor) { Margin = new BorderDouble(left: 2), HAnchor = HAnchor.Left, VAnchor = VAnchor.Center, Selectable = false }; labelWidth = labelWidget.Width + labelWidget.Margin.Left; this.AddChild(labelWidget); } this.ActuallNumberEdit = new NumberEdit(startingValue, 0, 0, theme.DefaultFontSize, pixelWidth, pixelHeight, allowNegatives, allowDecimals, minValue, maxValue, increment, tabIndex) { VAnchor = VAnchor.Bottom, }; ActuallNumberEdit.Margin = ActuallNumberEdit.Margin.Clone(left: labelWidth + 2); var internalWidget = this.ActuallNumberEdit.InternalTextEditWidget; internalWidget.TextColor = theme.EditFieldColors.Inactive.TextColor; internalWidget.FocusChanged += (s, e) => { internalWidget.TextColor = (internalWidget.Focused) ? theme.EditFieldColors.Focused.TextColor : theme.EditFieldColors.Inactive.TextColor; if (labelWidget != null) { labelWidget.TextColor = (internalWidget.Focused) ? singleCharEditColor : theme.PrimaryAccentColor; } }; this.ActuallNumberEdit.InternalNumberEdit.MaxDecimalsPlaces = 5; this.AddChild(this.ActuallNumberEdit); } this.PerformLayout(); }
private void AddVectorEdit(GuiWidget parent, Translate target, int index) { NumberEdit editControl = new NumberEdit(target.Size[index], pixelWidth: 35, allowNegatives: true, allowDecimals: true); editControl.TabIndex = index; editControl.InternalNumberEdit.TextChanged += (sender, e) => { Vector3 newSize = target.Translation; newSize[index] = editControl.Value; target.Translation = newSize; }; parent.AddChild(editControl); }
private void AddVectorEdit(BoxPrimitive target, int index) { NumberEdit editControl = new NumberEdit(target.Size[index], pixelWidth: 35, allowDecimals: true) { TabIndex = index }; editControl.InternalNumberEdit.TextChanged += (sender, e) => { Vector3 newSize = target.Size; newSize[index] = editControl.Value; target.Size = newSize; }; AddChild(editControl); }
public InlineEditControl(string defaultSizeString = "-0000.00", Agg.Font.Justification justification = Agg.Font.Justification.Left) { base.Visible = false; double pointSize = 12; numberDisplay = new TextWidget(defaultSizeString, 0, 0, pointSize, justification: justification) { Visible = false, VAnchor = VAnchor.Bottom, HAnchor = HAnchor.Left, Text = "0", }; AddChild(numberDisplay); numberEdit = new NumberEdit(0, 50, 50, pointSize, pixelWidth: numberDisplay.Width, allowNegatives: true, allowDecimals: true) { Visible = false, VAnchor = VAnchor.Bottom, HAnchor = HAnchor.Left, SelectAllOnFocus = true, }; numberEdit.InternalNumberEdit.TextChanged += (s, e) => { numberDisplay.Text = GetDisplayString == null ? "None" : GetDisplayString.Invoke(Value); base.OnTextChanged(e); }; numberEdit.InternalNumberEdit.MaxDecimalsPlaces = 2; numberEdit.EditComplete += (s, e) => { EditComplete?.Invoke(this, e); timeSinceMouseUp.Restart(); numberEdit.Visible = false; numberDisplay.Visible = true; }; AddChild(numberEdit); VAnchor = VAnchor.Fit; HAnchor = HAnchor.Fit; var runningInterval = UiThread.SetInterval(HideIfApplicable, .1); this.Closed += (s, e) => runningInterval.Continue = false; }
public MHNumberEdit(double startingValue, double x = 0, double y = 0, double pointSize = 12, double pixelWidth = 0, double pixelHeight = 0, bool allowNegatives = false, bool allowDecimals = false, double minValue = int.MinValue, double maxValue = int.MaxValue, double increment = 1, int tabIndex = 0) { Padding = new BorderDouble(3); actuallNumberEdit = new NumberEdit(startingValue, x, y, pointSize, pixelWidth, pixelHeight, allowNegatives, allowDecimals, minValue, maxValue, increment, tabIndex); actuallNumberEdit.VAnchor = Agg.UI.VAnchor.ParentBottom; AddChild(actuallNumberEdit); BackgroundColor = RGBA_Bytes.White; HAnchor = HAnchor.FitToChildren; VAnchor = VAnchor.FitToChildren; }
public GCodeViewerApplication(string gCodeToLoad = "") : base(800, 600) { this.Title = "G Code Visualizer"; MinimumSize = new VectorMath.Vector2(200, 200); Title = "MatterHackers GCodeVisualizer"; gCodeViewWidget = new GCodeViewWidget(new Vector2(), new Vector2(100, 100)); AddChild(gCodeViewWidget); FlowLayoutWidget keepOnTop = new FlowLayoutWidget(); prevLayerButton = new Button("<<", 0, 0); prevLayerButton.Click += prevLayer_ButtonClick; keepOnTop.AddChild(prevLayerButton); currentLayerIndex = new NumberEdit(1, pixelWidth: 40); keepOnTop.AddChild(currentLayerIndex); currentLayerIndex.EditComplete += new EventHandler(layerCountTextWidget_EditComplete); layerCountTextWidget = new TextWidget("/1____", 12); keepOnTop.AddChild(layerCountTextWidget); nextLayerButton = new Button(">>", 0, 0); nextLayerButton.Click += nextLayer_ButtonClick; keepOnTop.AddChild(nextLayerButton); if (gCodeToLoad != "") { gCodeViewWidget.LoadFile(gCodeToLoad); } else { openFileButton = new Button("Open GCode", 0, 0); openFileButton.Click += openFileButton_ButtonClick; keepOnTop.AddChild(openFileButton); } AddChild(keepOnTop); AnchorAll(); UiThread.RunOnIdle(currentLayerIndex.Focus); }
public MHNumberEdit(double startingValue, double x = 0, double y = 0, double pointSize = 12, double pixelWidth = 0, double pixelHeight = 0, bool allowNegatives = false, bool allowDecimals = false, double minValue = int.MinValue, double maxValue = int.MaxValue, double increment = 1, int tabIndex = 0) { using (this.LayoutLock()) { this.Padding = new BorderDouble(3); this.BackgroundColor = Color.White; this.HAnchor = HAnchor.Fit; this.VAnchor = VAnchor.Fit; this.Border = 1; this.ActuallNumberEdit = new NumberEdit(startingValue, x, y, pointSize, pixelWidth, pixelHeight, allowNegatives, allowDecimals, minValue, maxValue, increment, tabIndex) { VAnchor = VAnchor.Bottom, }; this.ActuallNumberEdit.InternalNumberEdit.MaxDecimalsPlaces = 5; this.AddChild(this.ActuallNumberEdit); } this.PerformLayout(); }
public SetLayerWidget(ViewGcodeWidget gcodeViewWidget) : base(FlowDirection.LeftToRight) { this.gcodeViewWidget = gcodeViewWidget; textImageButtonFactory.normalTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.hoverTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.disabledTextColor = ActiveTheme.Instance.PrimaryTextColor; textImageButtonFactory.pressedTextColor = ActiveTheme.Instance.PrimaryTextColor; editCurrentLayerIndex = new NumberEdit(1, pixelWidth: 40); editCurrentLayerIndex.VAnchor = VAnchor.ParentCenter; editCurrentLayerIndex.Margin = new BorderDouble(5, 0); editCurrentLayerIndex.EditComplete += new EventHandler(editCurrentLayerIndex_EditComplete); this.AddChild(editCurrentLayerIndex); gcodeViewWidget.ActiveLayerChanged += new EventHandler(gcodeViewWidget_ActiveLayerChanged); setLayerButton = textImageButtonFactory.Generate(LocalizedString.Get("Go")); setLayerButton.VAnchor = Agg.UI.VAnchor.ParentCenter; setLayerButton.Click += new EventHandler(layerCountTextWidget_EditComplete); this.AddChild(setLayerButton); }
public MHNumberEdit(double startingValue, double x = 0, double y = 0, double pointSize = 12, double pixelWidth = 0, double pixelHeight = 0, bool allowNegatives = false, bool allowDecimals = false, double minValue = int.MinValue, double maxValue = int.MaxValue, double increment = 1, int tabIndex = 0) { Padding = new BorderDouble(3); actuallNumberEdit = new NumberEdit(startingValue, x, y, pointSize, pixelWidth, pixelHeight, allowNegatives, allowDecimals, minValue, maxValue, increment, tabIndex); actuallNumberEdit.VAnchor = Agg.UI.VAnchor.ParentBottom; AddChild(actuallNumberEdit); BackgroundColor = RGBA_Bytes.White; HAnchor = HAnchor.FitToChildren; VAnchor = VAnchor.FitToChildren; actuallNumberEdit.TextChanged += new EventHandler(internalNumberEdit_TextChanged); actuallNumberEdit.InternalTextEditWidget.EditComplete += new EventHandler(InternalTextEditWidget_EditComplete); UiThread.RunOnIdle(OnIdle); }
/////////////////////////////////////////////////////////////////////////// // IStyleBuilderPage Implementation and StyleBuilderPage Overrides /// <include file='doc\PositionStylePage.uex' path='docs/doc[@for="PositionStylePage.CreateUI"]/*' /> /// <devdoc> /// Creates the UI elements within the page. /// </devdoc> protected override void CreateUI() { Label positionLabel = new Label(); Label leftLabel = new Label(); Label topLabel = new Label(); Label widthLabel = new Label(); Label heightLabel = new Label(); Label zIndexLabel = new Label(); ImageList positionImages = new ImageList(); positionImages.ImageSize = new Size(34, 34); positionCombo = new UnsettableComboBox(); positionPicture = new PictureBoxEx(); leftUnit = new UnitControl(); topUnit = new UnitControl(); widthUnit = new UnitControl(); heightUnit = new UnitControl(); zIndexEdit = new NumberEdit(); positionImages.Images.AddStrip(new Bitmap(typeof(PositionStylePage), "PropPosition.bmp")); positionPicture.Location = new Point(4, 9); positionPicture.Size = new Size(36, 36); positionPicture.TabIndex = 0; positionPicture.TabStop = false; positionPicture.Images = positionImages; positionLabel.Location = new Point(44, 8); positionLabel.Size = new Size(240, 16); positionLabel.TabIndex = 1; positionLabel.TabStop = false; positionLabel.Text = SR.GetString(SR.PosSP_PosModeLabel); positionCombo.Location = new Point(44, 24); positionCombo.Size = new Size(200, 21); positionCombo.TabIndex = 2; positionCombo.DropDownStyle = ComboBoxStyle.DropDownList; positionCombo.Items.AddRange(new object[] { SR.GetString(SR.PosSP_PosModeCombo_1), SR.GetString(SR.PosSP_PosModeCombo_2), SR.GetString(SR.PosSP_PosModeCombo_3) }); positionCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangePosition); topLabel.Location = new Point(46, 61); topLabel.Size = new Size(60, 16); topLabel.TabIndex = 3; topLabel.TabStop = false; topLabel.Text = SR.GetString(SR.PosSP_TopLabel); topUnit.Location = new Point(108, 57); topUnit.Size = new Size(88, 21); topUnit.TabIndex = 4; topUnit.DefaultUnit = UnitControl.UNIT_PX; topUnit.MinValue = -32768; topUnit.MaxValue = 32767; topUnit.Changed += new EventHandler(this.OnChangedTop); heightLabel.Location = new Point(220, 61); heightLabel.Size = new Size(60, 16); heightLabel.TabIndex = 5; heightLabel.TabStop = false; heightLabel.Text = SR.GetString(SR.PosSP_HeightLabel); heightUnit.Location = new Point(282, 57); heightUnit.Size = new Size(88, 21); heightUnit.TabIndex = 6; heightUnit.DefaultUnit = UnitControl.UNIT_PX; heightUnit.AllowNegativeValues = false; heightUnit.MinValue = -32768; heightUnit.MaxValue = 32767; heightUnit.Changed += new EventHandler(this.OnChangedHeight); leftLabel.Location = new Point(46, 84); leftLabel.Size = new Size(60, 16); leftLabel.TabIndex = 7; leftLabel.TabStop = false; leftLabel.Text = SR.GetString(SR.PosSP_LeftLabel); leftUnit.Location = new Point(108, 80); leftUnit.Size = new Size(88, 21); leftUnit.TabIndex = 8; leftUnit.DefaultUnit = UnitControl.UNIT_PX; leftUnit.MinValue = -32768; leftUnit.MaxValue = 32767; leftUnit.Changed += new EventHandler(this.OnChangedLeft); widthLabel.Location = new Point(220, 84); widthLabel.Size = new Size(60, 16); widthLabel.TabIndex = 9; widthLabel.TabStop = false; widthLabel.Text = SR.GetString(SR.PosSP_WidthLabel); widthUnit.Location = new Point(282, 80); widthUnit.Size = new Size(88, 21); widthUnit.TabIndex = 10; widthUnit.DefaultUnit = UnitControl.UNIT_PX; widthUnit.AllowNegativeValues = false; widthUnit.MinValue = -32768; widthUnit.MaxValue = 32767; widthUnit.Changed += new EventHandler(this.OnChangedWidth); zIndexLabel.Location = new Point(46, 112); zIndexLabel.Size = new Size(100, 16); zIndexLabel.TabIndex = 11; zIndexLabel.TabStop = false; zIndexLabel.Text = SR.GetString(SR.PosSP_ZIndexLabel); zIndexEdit.Location = new Point(46, 130); zIndexEdit.Size = new Size(60, 20); zIndexEdit.TabIndex = 12; zIndexEdit.MaxLength = 6; zIndexEdit.AllowDecimal = false; zIndexEdit.TextChanged += new EventHandler(this.OnChangedZIndex); this.Controls.Clear(); this.Controls.AddRange(new Control[] { zIndexLabel, zIndexEdit, widthLabel, widthUnit, leftLabel, leftUnit, heightLabel, heightUnit, topLabel, topUnit, positionPicture, positionLabel, positionCombo }); }
protected override void AddChildElements() { AltGroupBox adjustmentControlsGroupBox = new AltGroupBox(new TextWidget("Tuning Adjustment".Localize(), pointSize: 18, textColor: ActiveTheme.Instance.SecondaryAccentColor)); adjustmentControlsGroupBox.Margin = new BorderDouble(0); adjustmentControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; { FlowLayoutWidget tuningRatiosLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); tuningRatiosLayout.Margin = new BorderDouble(0, 0, 0, 0) * TextWidget.GlobalPointSizeScaleRatio; tuningRatiosLayout.HAnchor = HAnchor.ParentLeftRight; tuningRatiosLayout.Padding = new BorderDouble(3, 0, 3, 0) * TextWidget.GlobalPointSizeScaleRatio; double sliderWidth = 300; double sliderThumbWidth = 10; if (ActiveTheme.Instance.DisplayMode == ActiveTheme.ApplicationDisplayType.Touchscreen) { sliderWidth = 280; sliderThumbWidth = 20; } TextWidget subheader = new TextWidget("Fine-tune adjustment while actively printing", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor); subheader.Margin = new BorderDouble(bottom: 6); tuningRatiosLayout.AddChild(subheader); TextWidget feedRateDescription; { FlowLayoutWidget feedRateLeftToRight; { feedRateValue = new NumberEdit(0, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40 * TextWidget.GlobalPointSizeScaleRatio); feedRateValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.FeedRateRatio * 100 + .5)) / 100.0; feedRateLeftToRight = new FlowLayoutWidget(); feedRateLeftToRight.HAnchor = HAnchor.ParentLeftRight; feedRateDescription = new TextWidget(LocalizedString.Get("Speed Multiplier")); feedRateDescription.MinimumSize = new Vector2(140, 0) * TextWidget.GlobalPointSizeScaleRatio; feedRateDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor; feedRateDescription.VAnchor = VAnchor.ParentCenter; feedRateLeftToRight.AddChild(feedRateDescription); feedRateRatioSlider = new SolidSlider(new Vector2(), sliderThumbWidth, minFeedRateRatio, maxFeedRateRatio); feedRateRatioSlider.Margin = new BorderDouble(5, 0); feedRateRatioSlider.Value = PrinterConnectionAndCommunication.Instance.FeedRateRatio; feedRateRatioSlider.TotalWidthInPixels = sliderWidth; feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes(); feedRateRatioSlider.ValueChanged += (sender, e) => { PrinterConnectionAndCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value; }; PrinterConnectionAndCommunication.Instance.FeedRateRatioChanged.RegisterEvent(FeedRateRatioChanged_Event, ref unregisterEvents); feedRateValue.EditComplete += (sender, e) => { feedRateRatioSlider.Value = feedRateValue.Value; }; feedRateLeftToRight.AddChild(feedRateRatioSlider); tuningRatiosLayout.AddChild(feedRateLeftToRight); feedRateLeftToRight.AddChild(feedRateValue); feedRateValue.Margin = new BorderDouble(0, 0, 5, 0); feedRateValue.VAnchor = VAnchor.ParentCenter; textImageButtonFactory.FixedHeight = (int)feedRateValue.Height + 1; textImageButtonFactory.borderWidth = 1; textImageButtonFactory.normalBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); textImageButtonFactory.hoverBorderColor = new RGBA_Bytes(ActiveTheme.Instance.PrimaryTextColor, 200); Button setFeedRateButton = textImageButtonFactory.Generate(LocalizedString.Get("Set")); setFeedRateButton.VAnchor = VAnchor.ParentCenter; feedRateLeftToRight.AddChild(setFeedRateButton); } TextWidget extrusionDescription; { extrusionValue = new NumberEdit(0, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40 * TextWidget.GlobalPointSizeScaleRatio); extrusionValue.Value = ((int)(PrinterConnectionAndCommunication.Instance.ExtrusionRatio * 100 + .5)) / 100.0; FlowLayoutWidget leftToRight = new FlowLayoutWidget(); leftToRight.HAnchor = HAnchor.ParentLeftRight; leftToRight.Margin = new BorderDouble(top: 10) * TextWidget.GlobalPointSizeScaleRatio; extrusionDescription = new TextWidget(LocalizedString.Get("Extrusion Multiplier")); extrusionDescription.MinimumSize = new Vector2(140, 0) * TextWidget.GlobalPointSizeScaleRatio; extrusionDescription.TextColor = ActiveTheme.Instance.PrimaryTextColor; extrusionDescription.VAnchor = VAnchor.ParentCenter; leftToRight.AddChild(extrusionDescription); extrusionRatioSlider = new SolidSlider(new Vector2(), sliderThumbWidth, minExtrutionRatio, maxExtrusionRatio, Orientation.Horizontal); extrusionRatioSlider.TotalWidthInPixels = sliderWidth; extrusionRatioSlider.Margin = new BorderDouble(5, 0); extrusionRatioSlider.Value = PrinterConnectionAndCommunication.Instance.ExtrusionRatio; extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes(); extrusionRatioSlider.ValueChanged += (sender, e) => { PrinterConnectionAndCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value; }; PrinterConnectionAndCommunication.Instance.ExtrusionRatioChanged.RegisterEvent(ExtrusionRatioChanged_Event, ref unregisterEvents); extrusionValue.EditComplete += (sender, e) => { extrusionRatioSlider.Value = extrusionValue.Value; }; leftToRight.AddChild(extrusionRatioSlider); tuningRatiosLayout.AddChild(leftToRight); leftToRight.AddChild(extrusionValue); extrusionValue.Margin = new BorderDouble(0, 0, 5, 0); extrusionValue.VAnchor = VAnchor.ParentCenter; textImageButtonFactory.FixedHeight = (int)extrusionValue.Height + 1; Button setExtrusionButton = textImageButtonFactory.Generate(LocalizedString.Get("Set")); setExtrusionButton.VAnchor = VAnchor.ParentCenter; leftToRight.AddChild(setExtrusionButton); } feedRateLeftToRight.VAnchor = VAnchor.FitToChildren; } adjustmentControlsGroupBox.AddChild(tuningRatiosLayout); if (false) { HorizontalLine line = new HorizontalLine(); line.Margin = new BorderDouble(0, 10); tuningRatiosLayout.AddChild(line); TextWidget subheader2 = new TextWidget("Fine-tune z-height, while actively printing", pointSize: 8, textColor: ActiveTheme.Instance.PrimaryTextColor); subheader2.Margin = new BorderDouble(bottom: 6); tuningRatiosLayout.AddChild(subheader2); ImageBuffer togetherBig; ImageBuffer appartBig; CreateButtonImages(out togetherBig, out appartBig); textImageButtonFactory.FixedHeight = 0; Button togetherALot = textImageButtonFactory.GenerateFromImages("", togetherBig); Button appartALot = textImageButtonFactory.GenerateFromImages("", appartBig); FlowLayoutWidget leftToRigth = new FlowLayoutWidget(); leftToRigth.AddChild(togetherALot); leftToRigth.AddChild(appartALot); tuningRatiosLayout.AddChild(leftToRigth); } } this.AddChild(adjustmentControlsGroupBox); }
/// <include file='doc\DataListGeneralPage.uex' path='docs/doc[@for="DataListGeneralPage.InitForm"]/*' /> /// <devdoc> /// Initializes the UI of the form. /// </devdoc> private void InitForm() { GroupLabel dataGroup = new GroupLabel(); Label dataSourceLabel = new Label(); this.dataSourceCombo = new UnsettableComboBox(); Label dataMemberLabel = new Label(); this.dataMemberCombo = new UnsettableComboBox(); Label dataKeyFieldLabel = new Label(); this.dataKeyFieldCombo = new UnsettableComboBox(); GroupLabel headerFooterGroup = new GroupLabel(); this.showHeaderCheck = new CheckBox(); this.showFooterCheck = new CheckBox(); GroupLabel repeatGroup = new GroupLabel(); Label repeatColumnsLabel = new Label(); this.repeatColumnsEdit = new NumberEdit(); Label repeatDirectionLabel = new Label(); this.repeatDirectionCombo = new ComboBox(); Label repeatLayoutLabel = new Label(); this.repeatLayoutCombo = new ComboBox(); GroupLabel templatesGroup = new GroupLabel(); this.extractRowsCheck = new CheckBox(); dataGroup.SetBounds(4, 4, 360, 16); dataGroup.Text = SR.GetString(SR.DLGen_DataGroup); dataGroup.TabIndex = 0; dataGroup.TabStop = false; dataSourceLabel.SetBounds(8, 24, 170, 16); dataSourceLabel.Text = SR.GetString(SR.DLGen_DataSource); dataSourceLabel.TabStop = false; dataSourceLabel.TabIndex = 1; dataSourceCombo.SetBounds(8, 40, 140, 21); dataSourceCombo.DropDownStyle = ComboBoxStyle.DropDownList; dataSourceCombo.Sorted = true; dataSourceCombo.TabIndex = 2; dataSourceCombo.NotSetText = SR.GetString(SR.DLGen_DSUnbound); dataSourceCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangedDataSource); dataMemberLabel.SetBounds(184, 24, 170, 16); dataMemberLabel.Text = SR.GetString(SR.DLGen_DataMember); dataMemberLabel.TabStop = false; dataMemberLabel.TabIndex = 3; dataMemberCombo.SetBounds(184, 40, 140, 21); dataMemberCombo.DropDownStyle = ComboBoxStyle.DropDownList; dataMemberCombo.Sorted = true; dataMemberCombo.TabIndex = 4; dataMemberCombo.NotSetText = SR.GetString(SR.DLGen_DMNone); dataMemberCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangedDataMember); dataKeyFieldLabel.SetBounds(8, 66, 170, 16); dataKeyFieldLabel.Text = SR.GetString(SR.DLGen_DataKey); dataKeyFieldLabel.TabStop = false; dataKeyFieldLabel.TabIndex = 4; dataKeyFieldCombo.SetBounds(8, 82, 140, 21); dataKeyFieldCombo.DropDownStyle = ComboBoxStyle.DropDownList; dataKeyFieldCombo.Sorted = true; dataKeyFieldCombo.TabIndex = 5; dataKeyFieldCombo.NotSetText = SR.GetString(SR.DLGen_DKNone); dataKeyFieldCombo.SelectedIndexChanged += new EventHandler(this.OnSelChangedDataKeyField); headerFooterGroup.SetBounds(4, 108, 360, 16); headerFooterGroup.Text = SR.GetString(SR.DLGen_HeaderFooterGroup); headerFooterGroup.TabIndex = 6; headerFooterGroup.TabStop = false; showHeaderCheck.SetBounds(8, 128, 170, 16); showHeaderCheck.TabIndex = 7; showHeaderCheck.Text = SR.GetString(SR.DLGen_ShowHeader); showHeaderCheck.TextAlign = ContentAlignment.MiddleLeft; showHeaderCheck.FlatStyle = FlatStyle.System; showHeaderCheck.CheckedChanged += new EventHandler(this.OnCheckChangedShowHeader); showFooterCheck.SetBounds(8, 146, 170, 16); showFooterCheck.TabIndex = 8; showFooterCheck.Text = SR.GetString(SR.DLGen_ShowFooter); showFooterCheck.TextAlign = ContentAlignment.MiddleLeft; showFooterCheck.FlatStyle = FlatStyle.System; showFooterCheck.CheckedChanged += new EventHandler(this.OnCheckChangedShowFooter); repeatGroup.SetBounds(4, 172, 360, 16); repeatGroup.Text = SR.GetString(SR.DLGen_RepeatLayoutGroup); repeatGroup.TabIndex = 9; repeatGroup.TabStop = false; repeatColumnsLabel.SetBounds(8, 192, 106, 16); repeatColumnsLabel.Text = SR.GetString(SR.DLGen_RepeatColumns); repeatColumnsLabel.TabStop = false; repeatColumnsLabel.TabIndex = 10; repeatColumnsEdit.SetBounds(112, 188, 40, 21); repeatColumnsEdit.AllowDecimal = false; repeatColumnsEdit.AllowNegative = false; repeatColumnsEdit.TabIndex = 11; repeatColumnsEdit.TextChanged += new EventHandler(this.OnChangedRepeatProps); repeatDirectionLabel.SetBounds(8, 217, 106, 16); repeatDirectionLabel.Text = SR.GetString(SR.DLGen_RepeatDirection); repeatDirectionLabel.TabStop = false; repeatDirectionLabel.TabIndex = 12; repeatDirectionCombo.SetBounds(112, 213, 140, 56); repeatDirectionCombo.DropDownStyle = ComboBoxStyle.DropDownList; repeatDirectionCombo.Items.AddRange(new object[] { SR.GetString(SR.DLGen_RD_Horz), SR.GetString(SR.DLGen_RD_Vert) }); repeatDirectionCombo.TabIndex = 13; repeatDirectionCombo.SelectedIndexChanged += new EventHandler(this.OnChangedRepeatProps); repeatLayoutLabel.SetBounds(8, 242, 106, 16); repeatLayoutLabel.Text = SR.GetString(SR.DLGen_RepeatLayout); repeatLayoutLabel.TabStop = false; repeatLayoutLabel.TabIndex = 14; repeatLayoutCombo.SetBounds(112, 238, 140, 21); repeatLayoutCombo.DropDownStyle = ComboBoxStyle.DropDownList; repeatLayoutCombo.Items.AddRange(new object[] { SR.GetString(SR.DLGen_RL_Table), SR.GetString(SR.DLGen_RL_Flow) }); repeatLayoutCombo.TabIndex = 15; repeatLayoutCombo.SelectedIndexChanged += new EventHandler(this.OnChangedRepeatProps); templatesGroup.SetBounds(4, 266, 360, 16); templatesGroup.Text = "Templates"; templatesGroup.TabIndex = 16; templatesGroup.TabStop = false; templatesGroup.Visible = false; extractRowsCheck.SetBounds(8, 286, 260, 16); extractRowsCheck.Text = "Extract rows from Tables in template content"; extractRowsCheck.TabIndex = 17; extractRowsCheck.Visible = false; extractRowsCheck.FlatStyle = FlatStyle.System; extractRowsCheck.CheckedChanged += new EventHandler(this.OnCheckChangedExtractRows); this.Text = SR.GetString(SR.DLGen_Text); this.Size = new Size(368, 280); this.CommitOnDeactivate = true; this.Icon = new Icon(this.GetType(), "DataListGeneralPage.ico"); Controls.Clear(); Controls.AddRange(new Control[] { extractRowsCheck, templatesGroup, repeatLayoutCombo, repeatLayoutLabel, repeatDirectionCombo, repeatDirectionLabel, repeatColumnsEdit, repeatColumnsLabel, repeatGroup, showFooterCheck, showHeaderCheck, headerFooterGroup, dataKeyFieldCombo, dataKeyFieldLabel, dataMemberCombo, dataMemberLabel, dataSourceCombo, dataSourceLabel, dataGroup }); }
private void InitForm() { GroupLabel label = new GroupLabel(); this.allowPagingCheck = new System.Windows.Forms.CheckBox(); this.allowCustomPagingCheck = new System.Windows.Forms.CheckBox(); System.Windows.Forms.Label label2 = new System.Windows.Forms.Label(); this.pageSizeEdit = new NumberEdit(); System.Windows.Forms.Label label3 = new System.Windows.Forms.Label(); GroupLabel label4 = new GroupLabel(); this.visibleCheck = new System.Windows.Forms.CheckBox(); System.Windows.Forms.Label label5 = new System.Windows.Forms.Label(); this.posCombo = new ComboBox(); System.Windows.Forms.Label label6 = new System.Windows.Forms.Label(); this.modeCombo = new ComboBox(); System.Windows.Forms.Label label7 = new System.Windows.Forms.Label(); this.nextPageTextEdit = new System.Windows.Forms.TextBox(); System.Windows.Forms.Label label8 = new System.Windows.Forms.Label(); this.prevPageTextEdit = new System.Windows.Forms.TextBox(); System.Windows.Forms.Label label9 = new System.Windows.Forms.Label(); this.pageButtonCountEdit = new NumberEdit(); label.SetBounds(4, 4, 0x1af, 0x10); label.Text = System.Design.SR.GetString("DGPg_PagingGroup"); label.TabStop = false; label.TabIndex = 0; this.allowPagingCheck.SetBounds(12, 0x18, 180, 0x10); this.allowPagingCheck.Text = System.Design.SR.GetString("DGPg_AllowPaging"); this.allowPagingCheck.TextAlign = ContentAlignment.MiddleLeft; this.allowPagingCheck.TabIndex = 1; this.allowPagingCheck.FlatStyle = FlatStyle.System; this.allowPagingCheck.CheckedChanged += new EventHandler(this.OnCheckChangedAllowPaging); this.allowCustomPagingCheck.SetBounds(220, 0x18, 180, 0x10); this.allowCustomPagingCheck.Text = System.Design.SR.GetString("DGPg_AllowCustomPaging"); this.allowCustomPagingCheck.TextAlign = ContentAlignment.MiddleLeft; this.allowCustomPagingCheck.TabIndex = 2; this.allowCustomPagingCheck.FlatStyle = FlatStyle.System; this.allowCustomPagingCheck.CheckedChanged += new EventHandler(this.OnCheckChangedAllowCustomPaging); label2.SetBounds(12, 50, 100, 14); label2.Text = System.Design.SR.GetString("DGPg_PageSize"); label2.TabStop = false; label2.TabIndex = 3; this.pageSizeEdit.SetBounds(0x70, 0x2e, 40, 0x18); this.pageSizeEdit.TabIndex = 4; this.pageSizeEdit.AllowDecimal = false; this.pageSizeEdit.AllowNegative = false; this.pageSizeEdit.TextChanged += new EventHandler(this.OnTextChangedPageSize); label3.SetBounds(0x9e, 50, 80, 14); label3.Text = System.Design.SR.GetString("DGPg_Rows"); label3.TabStop = false; label3.TabIndex = 5; label4.SetBounds(4, 0x4e, 0x1af, 14); label4.Text = System.Design.SR.GetString("DGPg_NavigationGroup"); label4.TabStop = false; label4.TabIndex = 6; this.visibleCheck.SetBounds(12, 100, 260, 0x10); this.visibleCheck.Text = System.Design.SR.GetString("DGPg_Visible"); this.visibleCheck.TextAlign = ContentAlignment.MiddleLeft; this.visibleCheck.TabIndex = 7; this.visibleCheck.FlatStyle = FlatStyle.System; this.visibleCheck.CheckedChanged += new EventHandler(this.OnCheckChangedVisible); label5.SetBounds(12, 0x7a, 150, 14); label5.Text = System.Design.SR.GetString("DGPg_Position"); label5.TabStop = false; label5.TabIndex = 8; this.posCombo.SetBounds(12, 0x8a, 0x90, 0x15); this.posCombo.TabIndex = 9; this.posCombo.DropDownStyle = ComboBoxStyle.DropDownList; this.posCombo.Items.AddRange(new object[] { System.Design.SR.GetString("DGPg_Pos_Top"), System.Design.SR.GetString("DGPg_Pos_Bottom"), System.Design.SR.GetString("DGPg_Pos_TopBottom") }); this.posCombo.SelectedIndexChanged += new EventHandler(this.OnPagerChanged); label6.SetBounds(12, 0xa6, 150, 14); label6.Text = System.Design.SR.GetString("DGPg_Mode"); label6.TabStop = false; label6.TabIndex = 10; this.modeCombo.SetBounds(12, 0xb6, 0x90, 0x40); this.modeCombo.TabIndex = 11; this.modeCombo.DropDownStyle = ComboBoxStyle.DropDownList; this.modeCombo.Items.AddRange(new object[] { System.Design.SR.GetString("DGPg_Mode_Buttons"), System.Design.SR.GetString("DGPg_Mode_Numbers") }); this.modeCombo.SelectedIndexChanged += new EventHandler(this.OnPagerChanged); label7.SetBounds(12, 210, 200, 14); label7.Text = System.Design.SR.GetString("DGPg_NextPage"); label7.TabStop = false; label7.TabIndex = 12; this.nextPageTextEdit.SetBounds(12, 0xe2, 0x90, 0x18); this.nextPageTextEdit.TabIndex = 13; this.nextPageTextEdit.TextChanged += new EventHandler(this.OnPagerChanged); label8.SetBounds(220, 210, 200, 14); label8.Text = System.Design.SR.GetString("DGPg_PrevPage"); label8.TabStop = false; label8.TabIndex = 14; this.prevPageTextEdit.SetBounds(220, 0xe2, 140, 0x18); this.prevPageTextEdit.TabIndex = 15; this.prevPageTextEdit.TextChanged += new EventHandler(this.OnPagerChanged); label9.SetBounds(12, 0xfe, 200, 14); label9.Text = System.Design.SR.GetString("DGPg_ButtonCount"); label9.TabStop = false; label9.TabIndex = 0x10; this.pageButtonCountEdit.SetBounds(12, 270, 40, 0x18); this.pageButtonCountEdit.TabIndex = 0x11; this.pageButtonCountEdit.AllowDecimal = false; this.pageButtonCountEdit.AllowNegative = false; this.pageButtonCountEdit.TextChanged += new EventHandler(this.OnPagerChanged); this.Text = System.Design.SR.GetString("DGPg_Text"); base.AccessibleDescription = System.Design.SR.GetString("DGPg_Desc"); base.Size = new Size(0x1d0, 300); base.CommitOnDeactivate = true; base.Icon = new Icon(base.GetType(), "DataGridPagingPage.ico"); base.Controls.Clear(); base.Controls.AddRange(new Control[] { this.pageButtonCountEdit, label9, this.prevPageTextEdit, label8, this.nextPageTextEdit, label7, this.modeCombo, label6, this.posCombo, label5, this.visibleCheck, label4, label3, this.pageSizeEdit, label2, this.allowCustomPagingCheck, this.allowPagingCheck, label }); }
private void InitForm() { GroupLabel label = new GroupLabel(); System.Windows.Forms.Label label2 = new System.Windows.Forms.Label(); this.cellPaddingEdit = new NumberEdit(); System.Windows.Forms.Label label3 = new System.Windows.Forms.Label(); this.cellSpacingEdit = new NumberEdit(); GroupLabel label4 = new GroupLabel(); System.Windows.Forms.Label label5 = new System.Windows.Forms.Label(); this.gridLinesCombo = new ComboBox(); System.Windows.Forms.Label label6 = new System.Windows.Forms.Label(); this.borderColorCombo = new ColorComboBox(); this.borderColorPickerButton = new System.Windows.Forms.Button(); System.Windows.Forms.Label label7 = new System.Windows.Forms.Label(); this.borderWidthUnit = new UnitControl(); label.SetBounds(4, 4, 300, 0x10); label.Text = System.Design.SR.GetString("BDLBor_CellMarginsGroup"); label.TabStop = false; label.TabIndex = 0; label2.Text = System.Design.SR.GetString("BDLBor_CellPadding"); label2.SetBounds(12, 0x18, 120, 14); label2.TabStop = false; label2.TabIndex = 1; this.cellPaddingEdit.SetBounds(12, 40, 70, 20); this.cellPaddingEdit.AllowDecimal = false; this.cellPaddingEdit.AllowNegative = false; this.cellPaddingEdit.TabIndex = 2; this.cellPaddingEdit.TextChanged += new EventHandler(this.OnBordersChanged); label3.Text = System.Design.SR.GetString("BDLBor_CellSpacing"); label3.SetBounds(160, 0x18, 120, 14); label3.TabStop = false; label3.TabIndex = 3; this.cellSpacingEdit.SetBounds(160, 40, 70, 20); this.cellSpacingEdit.AllowDecimal = false; this.cellSpacingEdit.AllowNegative = false; this.cellSpacingEdit.TabIndex = 4; this.cellSpacingEdit.TextChanged += new EventHandler(this.OnBordersChanged); label4.SetBounds(4, 70, 300, 0x10); label4.Text = System.Design.SR.GetString("BDLBor_BorderLinesGroup"); label4.TabStop = false; label4.TabIndex = 5; label5.Text = System.Design.SR.GetString("BDLBor_GridLines"); label5.SetBounds(12, 90, 150, 14); label5.TabStop = false; label5.TabIndex = 6; this.gridLinesCombo.SetBounds(12, 0x6a, 140, 0x15); this.gridLinesCombo.DropDownStyle = ComboBoxStyle.DropDownList; this.gridLinesCombo.Items.Clear(); this.gridLinesCombo.Items.AddRange(new object[] { System.Design.SR.GetString("BDLBor_GL_Horz"), System.Design.SR.GetString("BDLBor_GL_Vert"), System.Design.SR.GetString("BDLBor_GL_Both"), System.Design.SR.GetString("BDLBor_GL_None") }); this.gridLinesCombo.TabIndex = 7; this.gridLinesCombo.SelectedIndexChanged += new EventHandler(this.OnBordersChanged); label6.Text = System.Design.SR.GetString("BDLBor_BorderColor"); label6.SetBounds(12, 0x86, 150, 14); label6.TabStop = false; label6.TabIndex = 8; this.borderColorCombo.SetBounds(12, 150, 140, 0x15); this.borderColorCombo.TabIndex = 9; this.borderColorCombo.TextChanged += new EventHandler(this.OnBordersChanged); this.borderColorCombo.SelectedIndexChanged += new EventHandler(this.OnBordersChanged); this.borderColorPickerButton.SetBounds(0x9c, 0x95, 0x18, 0x16); this.borderColorPickerButton.Text = "..."; this.borderColorPickerButton.TabIndex = 10; this.borderColorPickerButton.FlatStyle = FlatStyle.System; this.borderColorPickerButton.Click += new EventHandler(this.OnClickColorPicker); this.borderColorPickerButton.AccessibleName = System.Design.SR.GetString("BDLBor_ChooseColorButton"); this.borderColorPickerButton.AccessibleDescription = System.Design.SR.GetString("BDLBor_ChooseColorDesc"); label7.Text = System.Design.SR.GetString("BDLBor_BorderWidth"); label7.SetBounds(12, 0xb2, 150, 14); label7.TabStop = false; label7.TabIndex = 11; this.borderWidthUnit.SetBounds(12, 0xc2, 0x66, 0x16); this.borderWidthUnit.AllowNegativeValues = false; this.borderWidthUnit.AllowPercentValues = false; this.borderWidthUnit.DefaultUnit = 0; this.borderWidthUnit.TabIndex = 12; this.borderWidthUnit.Changed += new EventHandler(this.OnBordersChanged); this.borderWidthUnit.ValueAccessibleDescription = System.Design.SR.GetString("BDLBor_BorderWidthValueDesc"); this.borderWidthUnit.ValueAccessibleName = System.Design.SR.GetString("BDLBor_BorderWidthValueName"); this.borderWidthUnit.UnitAccessibleDescription = System.Design.SR.GetString("BDLBor_BorderWidthUnitDesc"); this.borderWidthUnit.UnitAccessibleName = System.Design.SR.GetString("BDLBor_BorderWidthUnitName"); this.Text = System.Design.SR.GetString("BDLBor_Text"); base.AccessibleDescription = System.Design.SR.GetString("BDLBor_Desc"); base.Size = new Size(0x134, 0x9c); base.CommitOnDeactivate = true; base.Icon = new Icon(base.GetType(), "BordersPage.ico"); base.Controls.Clear(); base.Controls.AddRange(new Control[] { this.borderWidthUnit, label7, this.borderColorPickerButton, this.borderColorCombo, label6, this.gridLinesCombo, label5, label4, this.cellSpacingEdit, label3, this.cellPaddingEdit, label2, label }); }
private void AddAdjustmentControls(FlowLayoutWidget controlsTopToBottomLayout) { GroupBox adjustmentControlsGroupBox = new GroupBox(new LocalizedString("Tuning Adjustment (while printing)").Translated); adjustmentControlsGroupBox.Margin = new BorderDouble(0); adjustmentControlsGroupBox.TextColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.BorderColor = ActiveTheme.Instance.PrimaryTextColor; adjustmentControlsGroupBox.HAnchor = Agg.UI.HAnchor.ParentLeftRight; adjustmentControlsGroupBox.Height = 93; { FlowLayoutWidget tuningRatiosLayout = new FlowLayoutWidget(FlowDirection.TopToBottom); tuningRatiosLayout.Margin = new BorderDouble(0, 0, 0, 6); tuningRatiosLayout.AnchorAll(); tuningRatiosLayout.Padding = new BorderDouble(3, 5, 3, 0); TextWidget feedRateDescription; { FlowLayoutWidget feedRateLeftToRight; { feedRateValue = new NumberEdit(1, allowDecimals: true, minValue: minFeedRateRatio, maxValue: maxFeedRateRatio, pixelWidth: 40); feedRateLeftToRight = new FlowLayoutWidget(); feedRateDescription = new TextWidget(new LocalizedString("Speed Multiplier").Translated); feedRateDescription.TextColor = RGBA_Bytes.White; feedRateLeftToRight.AddChild(feedRateDescription); feedRateRatioSlider = new Slider(new Vector2(), 300, minFeedRateRatio, maxFeedRateRatio); feedRateRatioSlider.Margin = new BorderDouble(5, 0); feedRateRatioSlider.Value = PrinterCommunication.Instance.FeedRateRatio; feedRateRatioSlider.View.BackgroundColor = new RGBA_Bytes(); feedRateRatioSlider.ValueChanged += (sender, e) => { PrinterCommunication.Instance.FeedRateRatio = feedRateRatioSlider.Value; }; PrinterCommunication.Instance.FeedRateRatioChanged.RegisterEvent(FeedRateRatioChanged_Event, ref unregisterEvents); feedRateValue.EditComplete += (sender, e) => { feedRateRatioSlider.Value = feedRateValue.Value; }; feedRateLeftToRight.AddChild(feedRateRatioSlider); tuningRatiosLayout.AddChild(feedRateLeftToRight); feedRateLeftToRight.AddChild(feedRateValue); feedRateValue.Margin = new BorderDouble(0, 0, 5, 0); textImageButtonFactory.FixedHeight = (int)feedRateValue.Height + 1; feedRateLeftToRight.AddChild(textImageButtonFactory.Generate(new LocalizedString("Set").Translated)); } TextWidget extrusionDescription; { extrusionValue = new NumberEdit(1, allowDecimals: true, minValue: minExtrutionRatio, maxValue: maxExtrusionRatio, pixelWidth: 40); FlowLayoutWidget leftToRight = new FlowLayoutWidget(); extrusionDescription = new TextWidget(new LocalizedString("Extrusion Multiplier").Translated); extrusionDescription.TextColor = RGBA_Bytes.White; leftToRight.AddChild(extrusionDescription); extrusionRatioSlider = new Slider(new Vector2(), 300, minExtrutionRatio, maxExtrusionRatio); extrusionRatioSlider.Margin = new BorderDouble(5, 0); extrusionRatioSlider.Value = PrinterCommunication.Instance.ExtrusionRatio; extrusionRatioSlider.View.BackgroundColor = new RGBA_Bytes(); extrusionRatioSlider.ValueChanged += (sender, e) => { PrinterCommunication.Instance.ExtrusionRatio = extrusionRatioSlider.Value; }; PrinterCommunication.Instance.ExtrusionRatioChanged.RegisterEvent(ExtrusionRatioChanged_Event, ref unregisterEvents); extrusionValue.EditComplete += (sender, e) => { extrusionRatioSlider.Value = extrusionValue.Value; }; leftToRight.AddChild(extrusionRatioSlider); tuningRatiosLayout.AddChild(leftToRight); leftToRight.AddChild(extrusionValue); extrusionValue.Margin = new BorderDouble(0, 0, 5, 0); textImageButtonFactory.FixedHeight = (int)extrusionValue.Height + 1; leftToRight.AddChild(textImageButtonFactory.Generate(new LocalizedString("Set").Translated)); } feedRateDescription.Width = extrusionDescription.Width; feedRateDescription.MinimumSize = new Vector2(extrusionDescription.Width, feedRateDescription.MinimumSize.y); feedRateLeftToRight.HAnchor = HAnchor.FitToChildren; feedRateLeftToRight.VAnchor = VAnchor.FitToChildren; } adjustmentControlsGroupBox.AddChild(tuningRatiosLayout); } tuningAdjustmentControlsContainer = new DisablablableWidget(); tuningAdjustmentControlsContainer.AddChild(adjustmentControlsGroupBox); controlsTopToBottomLayout.AddChild(tuningAdjustmentControlsContainer); }
public void NumEditHandlesNonNumberChars() { { GuiWidget container = new GuiWidget(); container.DoubleBuffer = true; container.LocalBounds = new RectangleDouble(0, 0, 200, 200); NumberEdit numberEdit = new NumberEdit(0, 0, 0, 12, 200, 16, true, true); container.AddChild(numberEdit); container.OnMouseDown(new MouseEventArgs(MouseButtons.Left, 1, 1, numberEdit.Height - 1, 0)); container.OnMouseUp(new MouseEventArgs(MouseButtons.Left, 1, 1, numberEdit.Height - 1, 0)); Assert.IsTrue(numberEdit.CharIndexToInsertBefore == 0); Assert.IsTrue(numberEdit.TopLeftOffset.y == 0); // type a . (non numeric character) SendKey(Keys.Back, ' ', container); SendKey(Keys.Delete, ' ', container); SendKey(Keys.OemMinus, '-', container); Assert.IsTrue(numberEdit.Value == 0); SendKey(Keys.OemPeriod, '.', container); Assert.IsTrue(numberEdit.Value == 0); SendKey(Keys.D0, '.', container); Assert.IsTrue(numberEdit.Value == 0); SendKey(Keys.A, 'A', container); Assert.IsTrue(numberEdit.Value == 0); container.Close(); } }
/// <include file='doc\DataGridPagingPage.uex' path='docs/doc[@for="DataGridPagingPage.InitForm"]/*' /> /// <devdoc> /// Creates the UI of the page. /// </devdoc> private void InitForm() { GroupLabel pagingGroup = new GroupLabel(); this.allowPagingCheck = new CheckBox(); this.allowCustomPagingCheck = new CheckBox(); Label pageSizeLabel = new Label(); this.pageSizeEdit = new NumberEdit(); Label miscLabel = new Label(); GroupLabel navigationGroup = new GroupLabel(); this.visibleCheck = new CheckBox(); Label pagingPosLabel = new Label(); this.posCombo = new ComboBox(); Label pagingModeLabel = new Label(); this.modeCombo = new ComboBox(); Label nextPageLabel = new Label(); this.nextPageTextEdit = new TextBox(); Label prevPageLabel = new Label(); this.prevPageTextEdit = new TextBox(); Label pageButtonCountLabel = new Label(); this.pageButtonCountEdit = new NumberEdit(); pagingGroup.SetBounds(4, 4, 431, 16); pagingGroup.Text = SR.GetString(SR.DGPg_PagingGroup); pagingGroup.TabStop = false; pagingGroup.TabIndex = 0; allowPagingCheck.SetBounds(12, 24, 180, 16); allowPagingCheck.Text = SR.GetString(SR.DGPg_AllowPaging); allowPagingCheck.TextAlign = ContentAlignment.MiddleLeft; allowPagingCheck.TabIndex = 1; allowPagingCheck.FlatStyle = FlatStyle.System; allowPagingCheck.CheckedChanged += new EventHandler(this.OnCheckChangedAllowPaging); allowCustomPagingCheck.SetBounds(220, 24, 180, 16); allowCustomPagingCheck.Text = SR.GetString(SR.DGPg_AllowCustomPaging); allowCustomPagingCheck.TextAlign = ContentAlignment.MiddleLeft; allowCustomPagingCheck.TabIndex = 2; allowCustomPagingCheck.FlatStyle = FlatStyle.System; allowCustomPagingCheck.CheckedChanged += new EventHandler(this.OnCheckChangedAllowCustomPaging); pageSizeLabel.SetBounds(12, 50, 100, 14); pageSizeLabel.Text = SR.GetString(SR.DGPg_PageSize); pageSizeLabel.TabStop = false; pageSizeLabel.TabIndex = 3; pageSizeEdit.SetBounds(112, 46, 40, 24); pageSizeEdit.TabIndex = 4; pageSizeEdit.AllowDecimal = false; pageSizeEdit.AllowNegative = false; pageSizeEdit.TextChanged += new EventHandler(this.OnTextChangedPageSize); miscLabel.SetBounds(158, 50, 80, 14); miscLabel.Text = SR.GetString(SR.DGPg_Rows); miscLabel.TabStop = false; miscLabel.TabIndex = 5; navigationGroup.SetBounds(4, 78, 431, 14); navigationGroup.Text = SR.GetString(SR.DGPg_NavigationGroup); navigationGroup.TabStop = false; navigationGroup.TabIndex = 6; visibleCheck.SetBounds(12, 100, 260, 16); visibleCheck.Text = SR.GetString(SR.DGPg_Visible); visibleCheck.TextAlign = ContentAlignment.MiddleLeft; visibleCheck.TabIndex = 7; visibleCheck.FlatStyle = FlatStyle.System; visibleCheck.CheckedChanged += new EventHandler(this.OnCheckChangedVisible); pagingPosLabel.SetBounds(12, 122, 150, 14); pagingPosLabel.Text = SR.GetString(SR.DGPg_Position); pagingPosLabel.TabStop = false; pagingPosLabel.TabIndex = 8; posCombo.SetBounds(12, 138, 144, 21); posCombo.TabIndex = 9; posCombo.DropDownStyle = ComboBoxStyle.DropDownList; posCombo.Items.AddRange(new object[] { SR.GetString(SR.DGPg_Pos_Top), SR.GetString(SR.DGPg_Pos_Bottom), SR.GetString(SR.DGPg_Pos_TopBottom) }); posCombo.SelectedIndexChanged += new EventHandler(this.OnPagerChanged); pagingModeLabel.SetBounds(12, 166, 150, 14); pagingModeLabel.Text = SR.GetString(SR.DGPg_Mode); pagingModeLabel.TabStop = false; pagingModeLabel.TabIndex = 10; modeCombo.SetBounds(12, 182, 144, 64); modeCombo.TabIndex = 11; modeCombo.DropDownStyle = ComboBoxStyle.DropDownList; modeCombo.Items.AddRange(new object[] { SR.GetString(SR.DGPg_Mode_Buttons), SR.GetString(SR.DGPg_Mode_Numbers) }); modeCombo.SelectedIndexChanged += new EventHandler(this.OnPagerChanged); nextPageLabel.SetBounds(12, 210, 200, 14); nextPageLabel.Text = SR.GetString(SR.DGPg_NextPage); nextPageLabel.TabStop = false; nextPageLabel.TabIndex = 12; nextPageTextEdit.SetBounds(12, 226, 144, 24); nextPageTextEdit.TabIndex = 13; nextPageTextEdit.TextChanged += new EventHandler(this.OnPagerChanged); prevPageLabel.SetBounds(220, 210, 200, 14); prevPageLabel.Text = SR.GetString(SR.DGPg_PrevPage); prevPageLabel.TabStop = false; prevPageLabel.TabIndex = 14; prevPageTextEdit.SetBounds(220, 226, 140, 24); prevPageTextEdit.TabIndex = 15; prevPageTextEdit.TextChanged += new EventHandler(this.OnPagerChanged); pageButtonCountLabel.SetBounds(12, 254, 200, 14); pageButtonCountLabel.Text = SR.GetString(SR.DGPg_ButtonCount); pageButtonCountLabel.TabStop = false; pageButtonCountLabel.TabIndex = 16; pageButtonCountEdit.SetBounds(12, 270, 40, 24); pageButtonCountEdit.TabIndex = 17; pageButtonCountEdit.AllowDecimal = false; pageButtonCountEdit.AllowNegative = false; pageButtonCountEdit.TextChanged += new EventHandler(this.OnPagerChanged); this.Text = SR.GetString(SR.DGPg_Text); this.Size = new Size(464, 300); this.CommitOnDeactivate = true; this.Icon = new Icon(this.GetType(), "DataGridPagingPage.ico"); this.Controls.Clear(); this.Controls.AddRange(new Control[] { pageButtonCountEdit, pageButtonCountLabel, prevPageTextEdit, prevPageLabel, nextPageTextEdit, nextPageLabel, modeCombo, pagingModeLabel, posCombo, pagingPosLabel, visibleCheck, navigationGroup, miscLabel, pageSizeEdit, pageSizeLabel, allowCustomPagingCheck, allowPagingCheck, pagingGroup }); }
/// <include file='doc\BordersPage.uex' path='docs/doc[@for="BordersPage.InitForm"]/*' /> /// <devdoc> /// Creates the UI of the page. /// </devdoc> private void InitForm() { GroupLabel cellMarginGroup = new GroupLabel(); Label cellPaddingLabel = new Label(); this.cellPaddingEdit = new NumberEdit(); Label cellSpacingLabel = new Label(); this.cellSpacingEdit = new NumberEdit(); GroupLabel borderLinesGroup = new GroupLabel(); Label gridLinesLabel = new Label(); this.gridLinesCombo = new ComboBox(); Label colorLabel = new Label(); this.borderColorCombo = new ColorComboBox(); this.borderColorPickerButton = new Button(); Label borderWidthLabel = new Label(); this.borderWidthUnit = new UnitControl(); cellMarginGroup.SetBounds(4, 4, 300, 16); cellMarginGroup.Text = SR.GetString(SR.BDLBor_CellMarginsGroup); cellMarginGroup.TabStop = false; cellMarginGroup.TabIndex = 0; cellPaddingLabel.Text = SR.GetString(SR.BDLBor_CellPadding); cellPaddingLabel.SetBounds(12, 24, 120, 14); cellPaddingLabel.TabStop = false; cellPaddingLabel.TabIndex = 1; cellPaddingEdit.SetBounds(12, 40, 70, 20); cellPaddingEdit.AllowDecimal = false; cellPaddingEdit.AllowNegative = false; cellPaddingEdit.TabIndex = 2; cellPaddingEdit.TextChanged += new EventHandler(this.OnBordersChanged); cellSpacingLabel.Text = SR.GetString(SR.BDLBor_CellSpacing); cellSpacingLabel.SetBounds(160, 24, 120, 14); cellSpacingLabel.TabStop = false; cellSpacingLabel.TabIndex = 3; cellSpacingEdit.SetBounds(160, 40, 70, 20); cellSpacingEdit.AllowDecimal = false; cellSpacingEdit.AllowNegative = false; cellSpacingEdit.TabIndex = 4; cellSpacingEdit.TextChanged += new EventHandler(this.OnBordersChanged); borderLinesGroup.SetBounds(4, 70, 300, 16); borderLinesGroup.Text = SR.GetString(SR.BDLBor_BorderLinesGroup); borderLinesGroup.TabStop = false; borderLinesGroup.TabIndex = 5; gridLinesLabel.Text = SR.GetString(SR.BDLBor_GridLines); gridLinesLabel.SetBounds(12, 90, 150, 14); gridLinesLabel.TabStop = false; gridLinesLabel.TabIndex = 6; gridLinesCombo.SetBounds(12, 106, 140, 21); gridLinesCombo.DropDownStyle = ComboBoxStyle.DropDownList; gridLinesCombo.Items.Clear(); gridLinesCombo.Items.AddRange(new object[] { SR.GetString(SR.BDLBor_GL_Horz), SR.GetString(SR.BDLBor_GL_Vert), SR.GetString(SR.BDLBor_GL_Both), SR.GetString(SR.BDLBor_GL_None) }); gridLinesCombo.TabIndex = 7; gridLinesCombo.SelectedIndexChanged += new EventHandler(this.OnBordersChanged); colorLabel.Text = SR.GetString(SR.BDLBor_BorderColor); colorLabel.SetBounds(12, 134, 150, 14); colorLabel.TabStop = false; colorLabel.TabIndex = 8; borderColorCombo.SetBounds(12, 150, 140, 21); borderColorCombo.TabIndex = 9; borderColorCombo.TextChanged += new EventHandler(this.OnBordersChanged); borderColorCombo.SelectedIndexChanged += new EventHandler(this.OnBordersChanged); borderColorPickerButton.SetBounds(156, 149, 24, 22); borderColorPickerButton.Text = "..."; borderColorPickerButton.TabIndex = 10; borderColorPickerButton.FlatStyle = FlatStyle.System; borderColorPickerButton.Click += new EventHandler(this.OnClickColorPicker); borderWidthLabel.Text = SR.GetString(SR.BDLBor_BorderWidth); borderWidthLabel.SetBounds(12, 178, 150, 14); borderWidthLabel.TabStop = false; borderWidthLabel.TabIndex = 11; borderWidthUnit.SetBounds(12, 194, 102, 22); borderWidthUnit.AllowNegativeValues = false; borderWidthUnit.AllowPercentValues = false; borderWidthUnit.DefaultUnit = UnitControl.UNIT_PX; borderWidthUnit.TabIndex = 12; borderWidthUnit.Changed += new EventHandler(OnBordersChanged); this.Text = SR.GetString(SR.BDLBor_Text); this.Size = new Size(308, 156); this.CommitOnDeactivate = true; this.Icon = new Icon(this.GetType(), "BordersPage.ico"); this.Controls.Clear(); this.Controls.AddRange(new Control[] { borderWidthUnit, borderWidthLabel, borderColorPickerButton, borderColorCombo, colorLabel, gridLinesCombo, gridLinesLabel, borderLinesGroup, cellSpacingEdit, cellSpacingLabel, cellPaddingEdit, cellPaddingLabel, cellMarginGroup }); }
private void InitForm() { GroupLabel label = new GroupLabel(); this.showHeaderCheck = new System.Windows.Forms.CheckBox(); this.showFooterCheck = new System.Windows.Forms.CheckBox(); GroupLabel label2 = new GroupLabel(); System.Windows.Forms.Label label3 = new System.Windows.Forms.Label(); this.repeatColumnsEdit = new NumberEdit(); System.Windows.Forms.Label label4 = new System.Windows.Forms.Label(); this.repeatDirectionCombo = new ComboBox(); System.Windows.Forms.Label label5 = new System.Windows.Forms.Label(); this.repeatLayoutCombo = new ComboBox(); GroupLabel label6 = new GroupLabel(); this.extractRowsCheck = new System.Windows.Forms.CheckBox(); label.SetBounds(4, 4, 360, 0x10); label.Text = System.Design.SR.GetString("DLGen_HeaderFooterGroup"); label.TabIndex = 7; label.TabStop = false; this.showHeaderCheck.SetBounds(8, 0x18, 170, 0x10); this.showHeaderCheck.TabIndex = 8; this.showHeaderCheck.Text = System.Design.SR.GetString("DLGen_ShowHeader"); this.showHeaderCheck.TextAlign = ContentAlignment.MiddleLeft; this.showHeaderCheck.FlatStyle = FlatStyle.System; this.showHeaderCheck.CheckedChanged += new EventHandler(this.OnCheckChangedShowHeader); this.showFooterCheck.SetBounds(8, 0x2a, 170, 0x10); this.showFooterCheck.TabIndex = 9; this.showFooterCheck.Text = System.Design.SR.GetString("DLGen_ShowFooter"); this.showFooterCheck.TextAlign = ContentAlignment.MiddleLeft; this.showFooterCheck.FlatStyle = FlatStyle.System; this.showFooterCheck.CheckedChanged += new EventHandler(this.OnCheckChangedShowFooter); label2.SetBounds(4, 0x44, 360, 0x10); label2.Text = System.Design.SR.GetString("DLGen_RepeatLayoutGroup"); label2.TabIndex = 10; label2.TabStop = false; label3.SetBounds(8, 0x58, 0x6a, 0x10); label3.Text = System.Design.SR.GetString("DLGen_RepeatColumns"); label3.TabStop = false; label3.TabIndex = 11; this.repeatColumnsEdit.SetBounds(0x70, 0x54, 40, 0x15); this.repeatColumnsEdit.AllowDecimal = false; this.repeatColumnsEdit.AllowNegative = false; this.repeatColumnsEdit.TabIndex = 12; this.repeatColumnsEdit.TextChanged += new EventHandler(this.OnChangedRepeatProps); label4.SetBounds(8, 0x71, 0x6a, 0x10); label4.Text = System.Design.SR.GetString("DLGen_RepeatDirection"); label4.TabStop = false; label4.TabIndex = 13; this.repeatDirectionCombo.SetBounds(0x70, 0x6d, 140, 0x38); this.repeatDirectionCombo.DropDownStyle = ComboBoxStyle.DropDownList; this.repeatDirectionCombo.Items.AddRange(new object[] { System.Design.SR.GetString("DLGen_RD_Horz"), System.Design.SR.GetString("DLGen_RD_Vert") }); this.repeatDirectionCombo.TabIndex = 14; this.repeatDirectionCombo.SelectedIndexChanged += new EventHandler(this.OnChangedRepeatProps); label5.SetBounds(8, 0x8a, 0x6a, 0x10); label5.Text = System.Design.SR.GetString("DLGen_RepeatLayout"); label5.TabStop = false; label5.TabIndex = 15; this.repeatLayoutCombo.SetBounds(0x70, 0x86, 140, 0x15); this.repeatLayoutCombo.DropDownStyle = ComboBoxStyle.DropDownList; this.repeatLayoutCombo.Items.AddRange(new object[] { System.Design.SR.GetString("DLGen_RL_Table"), System.Design.SR.GetString("DLGen_RL_Flow") }); this.repeatLayoutCombo.TabIndex = 0x10; this.repeatLayoutCombo.SelectedIndexChanged += new EventHandler(this.OnChangedRepeatProps); label6.SetBounds(4, 0xa2, 360, 0x10); label6.Text = System.Design.SR.GetString("DLGen_Templates"); label6.TabIndex = 0x11; label6.TabStop = false; label6.Visible = false; this.extractRowsCheck.SetBounds(8, 0xb6, 260, 0x10); this.extractRowsCheck.Text = System.Design.SR.GetString("DLGen_ExtractRows"); this.extractRowsCheck.TabIndex = 0x12; this.extractRowsCheck.Visible = false; this.extractRowsCheck.FlatStyle = FlatStyle.System; this.extractRowsCheck.CheckedChanged += new EventHandler(this.OnCheckChangedExtractRows); this.Text = System.Design.SR.GetString("DLGen_Text"); base.AccessibleDescription = System.Design.SR.GetString("DLGen_Desc"); base.Size = new Size(0x170, 280); base.CommitOnDeactivate = true; base.Icon = new Icon(base.GetType(), "DataListGeneralPage.ico"); base.Controls.Clear(); base.Controls.AddRange(new Control[] { this.extractRowsCheck, label6, this.repeatLayoutCombo, label5, this.repeatDirectionCombo, label4, this.repeatColumnsEdit, label3, label2, this.showFooterCheck, this.showHeaderCheck, label }); }