public override void PaintCollapsiblePanel(PaintEventArgs args, CollapsiblePanel panel) { Graphics graphics = args.Graphics; graphics.SmoothingMode = SmoothingMode.HighQuality; graphics.FillRectangle(new SolidBrush(Color.FromArgb(212, 212, 212)), new Rectangle(0, 0, panel.Width, panel.HeaderHeight)); if (panel.Icon != null) { graphics.DrawImage(panel.Icon, new Point(4, HeaderHeight / 2 - panel.Icon.Height / 2)); } graphics.DrawString(panel.HeaderText, CollapsiblePanelFont, new SolidBrush(CollapsiblePanelTextColor), new PointF(24, HeaderHeight / 2 - 10)); PointF circleCenter = new PointF(panel.Width - 14, HeaderHeight / 2 + 1); graphics.FillEllipse(new SolidBrush(Color.FromArgb(241, 241, 241)), new RectangleF(circleCenter.X - 8, circleCenter.Y - 8, 16, 16)); if (panel.State == CollapsedState.Collapsed) { graphics.FillPolygon(new SolidBrush(Color.FromArgb(110, 110, 110)), new PointF[] { new PointF(circleCenter.X, circleCenter.Y - 4), new PointF(circleCenter.X + 4, circleCenter.Y + 3), new PointF(circleCenter.X - 4, circleCenter.Y + 3) }); } else { graphics.FillPolygon(new SolidBrush(Color.FromArgb(110, 110, 110)), new PointF[] { new PointF(circleCenter.X, circleCenter.Y + 4), new PointF(circleCenter.X + 4, circleCenter.Y - 3), new PointF(circleCenter.X - 4, circleCenter.Y - 3) }); } }
/// <summary> /// Binds the specified service. /// </summary> /// <param name="service">The service.</param> public override void Bind(IEditorService service) { _fs = service.GetEditedResource() as IFeatureSource; service.RegisterCustomNotifier(this); Debug.Assert(_fs != null); CollapsiblePanel panel = FsEditorMap.GetPanel(_fs.Provider); var b = panel as IEditorBindable; if (b != null) { b.Bind(service); } panel.Dock = DockStyle.Top; var ov = new CoordSysOverrideCtrl(); ov.Bind(service); ov.Dock = DockStyle.Top; var ext = new ExtensionsCtrl(); ext.Bind(service); ext.Dock = DockStyle.Top; this.Controls.Add(ext); this.Controls.Add(ov); this.Controls.Add(panel); }
public static CollapsiblePanel GetPanel(string provider) { CollapsiblePanel panel = null; provider = Normalize(provider); //Try to obtain a specialized editor if possible, otherwise //fall back to the generic one string name = provider.ToUpper(); try { if (_editors.ContainsKey(name)) { panel = (CollapsiblePanel)Activator.CreateInstance(_editors[name]); } else { panel = new GenericCtrl(); } } finally { if (panel == null) { panel = new GenericCtrl(); } } return(panel); }
private CollapsiblePanel CreatePanel(string text, HotkeyManager hotkeyManager) { SubPanel spnl = new SubPanel("", true, false); int yOffset = 3; foreach (var hotkeyEntry in hotkeyManager.Hotkeys) { UtinniLabel lbl = new UtinniLabel { Text = hotkeyEntry.Value.Text, Location = new Point(0, yOffset), Width = 350 }; UtinniButton btn = new UtinniButton { Width = 350, Text = hotkeyEntry.Value.GetKeyComboString(), Location = new Point(350, yOffset), }; btn.Click += (sender, args) => { FormHotkeyEditorDialog form = new FormHotkeyEditorDialog(hotkeyEntry.Value); form.Top = (this.Top + (this.Height / 2)) - form.Height / 2; form.Left = (this.Left + (this.Width / 2)) - form.Width / 2; DialogResult dialogResult = form.ShowDialog(this); if (dialogResult == DialogResult.OK) { hotkeyEntry.Value.UpdateKeys(form.NewValue); btn.Text = form.NewValue; HasChanges = true; // ToDo have HasChanges specific to each hotkeyManager and only save those that are changed? } }; spnl.Controls.Add(lbl); spnl.Controls.Add(btn); yOffset += 23; } spnl.Height = yOffset + 23; var cpnl = new CollapsiblePanel(spnl, text, 700) { Margin = new Padding(0, 3, 0, 3), Height = spnl.Height + 3 }; return(cpnl); }
void ResizeCollapsablePanel(object sender, EventArgs args) { int m = 3; Control senderAsControl = sender as Control; CollapsiblePanel parent = senderAsControl.Parent as CollapsiblePanel; int panelHeight = Math.Min(parent.ExpandedHeight, parent.Height); // Hack! If the panel height is 20, it's being collapsed // Hack part 2. I don't really know why but if I add 20 the first // time this is called then the collpsible panel is sized properly. // But after that all is sized okay if I don't add. if (parent.PanelState == PanelStateOptions.Expanded && panelHeight != 20) { int senderHeight = senderAsControl.Height; int bottom = senderHeight; if (!panelsResized.Contains(parent)) { bottom += 20; panelsResized.Add(parent); } if (bottom > panelHeight) { parent.ExpandedHeight = bottom; parent.Height = parent.ExpandedHeight; } if (bottom < panelHeight) { parent.ExpandedHeight = bottom; parent.Height = parent.ExpandedHeight; } } }
private CollapsiblePanel GetBottomPanel() { int maxY = int.MinValue; CollapsiblePanel bottomPanel = null; foreach (var control in mForm.Controls) { if (control is CollapsiblePanel) { CollapsiblePanel cp = control as CollapsiblePanel; if (cp.Location.Y > maxY) { maxY = cp.Location.Y; bottomPanel = cp; } } } return(bottomPanel); }
/// <summary> /// Binds the specified service. /// </summary> /// <param name="service">The service.</param> public override void Bind(IEditorService service) { _ed = service; _lp = _ed.GetEditedResource() as OSGeo.MapGuide.ObjectModels.LoadProcedure.ILoadProcedure; Debug.Assert(_lp != null); service.RegisterCustomNotifier(this); CollapsiblePanel tp = null; switch (_lp.SubType.Type) { case LoadType.Sdf: { var trans = new SdfTransformationCtrl(); trans.Bind(service); tp = trans; } break; case LoadType.Shp: { var trans = new ShpTransformationCtrl(); trans.Bind(service); tp = trans; } break; case LoadType.Dwf: { var trans = new DwfTransformationCtrl(); trans.Bind(service); tp = trans; } break; case LoadType.Sqlite: { var trans = new SqliteTransformationCtrl(); trans.Bind(service); tp = trans; } break; default: throw new NotSupportedException(); } var input = new InputFilesCtrl(); input.Bind(service); var target = new LoadTargetCtrl(); target.Bind(service); tp.Dock = DockStyle.Top; input.Dock = DockStyle.Top; target.Dock = DockStyle.Top; var exec = new ExecuteCtrl(); exec.Dock = DockStyle.Bottom; exec.Execute += new EventHandler(OnExecute); this.Controls.Add(exec); this.Controls.Add(target); this.Controls.Add(tp); this.Controls.Add(input); }
public abstract void PaintCollapsiblePanel(PaintEventArgs args, CollapsiblePanel panel);