/// <summary> /// Constructor. /// </summary> /// <param name="action">The action to which this view is bound.</param> public LayoutChangerToolStripItem(LayoutChangerAction action) : base(new Panel()) { const int cellWidth = 25; int idealPickerWidth = (action.MaxColumns - 1) * cellWidth * 6 / 5 + cellWidth; int idealPickerHeight = (action.MaxRows - 1) * cellWidth * 6 / 5 + cellWidth; _action = action; const int borderWidth = 1; _picker = new TableDimensionsPicker(_action.MaxRows, _action.MaxColumns); _picker.Dock = DockStyle.Left; _picker.BackColor = Color.Transparent; _picker.CellSpacing = new TableDimensionsCellSpacing(cellWidth / 5, cellWidth / 5); _picker.CellStyle = new TableDimensionsCellStyle(Color.FromArgb(0, 71, 98), borderWidth); _picker.HotCellStyle = new TableDimensionsCellStyle(Macro_BLUE, Macro_BLUE, borderWidth); _picker.SelectedCellStyle = new TableDimensionsCellStyle(); _picker.Size = new Size(idealPickerWidth, idealPickerHeight); _picker.DimensionsSelected += OnDimensionsSelected; _picker.HotDimensionsChanged += OnHotTrackingDimensionsChanged; _label = new CustomLabel(); _label.AutoSize = false; _label.BackColor = Color.Transparent; _label.Click += OnCancel; _label.Dock = DockStyle.Top; _label.Size = new Size(idealPickerWidth, 21); _label.Text = _action.Label; _spacerL = new Panel(); _spacerL.BackColor = Color.Transparent; _spacerL.Dock = DockStyle.Left; _spacerL.Size = new Size(0, idealPickerHeight); _spacerR = new Panel(); _spacerR.BackColor = Color.Transparent; _spacerR.Dock = DockStyle.Fill; _spacerR.Size = new Size(0, idealPickerHeight); _panel = (Panel)base.Control; _panel.Size = _defaultSize = new Size(Math.Max(base.Width, idealPickerWidth), idealPickerHeight + _label.Height); _panel.Controls.Add(_spacerR); _panel.Controls.Add(_picker); _panel.Controls.Add(_spacerL); _panel.Controls.Add(_label); _panel.Resize += OnContentPanelResize; base.AutoSize = false; base.BackColor = Color.Transparent; base.ControlAlign = ContentAlignment.TopCenter; this.MyOwner = base.Owner; base.Size = _defaultSize = new Size(Math.Max(base.Width, idealPickerWidth), idealPickerHeight + _label.Height); }
/// <summary> /// Constructor. /// </summary> /// <param name="action">The action to which this view is bound.</param> public LayoutChangerToolStripItem(LayoutChangerAction action) : base(new Panel()) { const int cellWidth = 25; int idealPickerWidth = (action.MaxColumns - 1)*cellWidth*6/5 + cellWidth; int idealPickerHeight = (action.MaxRows - 1)*cellWidth*6/5 + cellWidth; _action = action; const int borderWidth = 1; _picker = new TableDimensionsPicker(_action.MaxRows, _action.MaxColumns); _picker.Dock = DockStyle.Left; _picker.BackColor = Color.Transparent; _picker.CellSpacing = new TableDimensionsCellSpacing(cellWidth/5, cellWidth/5); _picker.CellStyle = new TableDimensionsCellStyle(Color.FromArgb(0, 71, 98), borderWidth); _picker.HotCellStyle = new TableDimensionsCellStyle(CLEARCANVAS_BLUE, CLEARCANVAS_BLUE, borderWidth); _picker.SelectedCellStyle = new TableDimensionsCellStyle(); _picker.Size = new Size(idealPickerWidth, idealPickerHeight); _picker.DimensionsSelected += OnDimensionsSelected; _picker.HotDimensionsChanged += OnHotTrackingDimensionsChanged; _label = new CustomLabel(); _label.AutoSize = false; _label.BackColor = Color.Transparent; _label.Click += OnCancel; _label.Dock = DockStyle.Top; _label.Size = new Size(idealPickerWidth, 21); _label.Text = _action.Label; _spacerL = new Panel(); _spacerL.BackColor = Color.Transparent; _spacerL.Dock = DockStyle.Left; _spacerL.Size = new Size(0, idealPickerHeight); _spacerR = new Panel(); _spacerR.BackColor = Color.Transparent; _spacerR.Dock = DockStyle.Fill; _spacerR.Size = new Size(0, idealPickerHeight); _panel = (Panel) base.Control; _panel.Size = _defaultSize = new Size(Math.Max(base.Width, idealPickerWidth), idealPickerHeight + _label.Height); _panel.Controls.Add(_spacerR); _panel.Controls.Add(_picker); _panel.Controls.Add(_spacerL); _panel.Controls.Add(_label); _panel.Resize += OnContentPanelResize; base.AutoSize = false; base.BackColor = Color.Transparent; base.ControlAlign = ContentAlignment.TopCenter; this.MyOwner = base.Owner; base.Size = _defaultSize = new Size(Math.Max(base.Width, idealPickerWidth), idealPickerHeight + _label.Height); }