コード例 #1
0
        void DoChangePanel(object state)
        {
            // remember which tab we were on
            int topTabIndex = this.advancedControlsTabControl.SelectedTabIndex;

            // remove the advance control and replace it with new ones build for the selected printer
            int advancedControlsWidgetIndex = RightPanel.GetChildIndex(this.advancedControlsTabControl);

            RightPanel.RemoveChild(advancedControlsWidgetIndex);

            this.advancedControlsTabControl = CreateNewAdvancedControlsTab(sliceSettingsUiState);

            RightPanel.AddChild(this.advancedControlsTabControl, advancedControlsWidgetIndex);

            // set the selected tab back to the one it was before we replace the control
            this.advancedControlsTabControl.SelectTab(topTabIndex);

            // This is a hack to make the pannel remain on the screen.  It would be great to debug it and understand
            // why it does not work without this code in here.
            RectangleDouble localBounds = this.LocalBounds;

            this.LocalBounds = new RectangleDouble(0, 0, this.LocalBounds.Width - 1, 10);
            this.LocalBounds = localBounds;
            OnAdvancedControlsLoaded();
        }
コード例 #2
0
        private void CreateRightGrid()
        {
            if (RightPanel != null)
            {
                var rightGrid = GdiMapper.ToGdiGrid(ChartGridModel);
                rightGrid.CellSize = CellSize;
                rightGrid.Size     = RightPanel.Size;

                RightPanel.AddChild(rightGrid);
            }
        }
コード例 #3
0
        private void AddBarSeries(DataSeries series, int offsetY)
        {
            var y = (CellSize.Height / 2) + offsetY;

            foreach (var value in series.Data)
            {
                var length = WidthUnit * value;

                var bar = new GdiRectangle
                {
                    Size            = new SizeF(Math.Abs(length), BarSettingModel.Size),
                    Margin          = new PointF(0, y),
                    BackgroundColor = series.Color,
                };

                var text = new GdiText
                {
                    Margin            = new PointF(bar.Size.Width + 2, 0),
                    Content           = string.Format(BarSettingModel.FormatValue, value),
                    Font              = BarSettingModel.ValueFont,
                    TextColor         = Color.Gray,
                    VerticalAlignment = GdiSharp.Enum.GdiVerticalAlign.Middle
                };

                if (length > 0)
                {
                    RightPanel.AddChild(bar);
                }
                else if (length < 0)
                {
                    LeftPanel.AddChild(bar);
                    bar.HorizontalAlignment  = GdiSharp.Enum.GdiHorizontalAlign.Right;
                    text.HorizontalAlignment = GdiSharp.Enum.GdiHorizontalAlign.Right;
                }

                bar.AddChild(text);

                y += CellSize.Height;
            }
        }