private void OnRemoving(object sender, ComponentEventArgs e) { IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); //Removing a button if (e.Component is OMETabStripItem) { OMETabStripItem itm = e.Component as OMETabStripItem; if (Control.Items.Contains(itm)) { changeService.OnComponentChanging(Control, null); Control.RemoveTab(itm); changeService.OnComponentChanged(Control, null, null, null); return; } } if (e.Component is OMETabStrip) { for (int i = Control.Items.Count - 1; i >= 0; i--) { OMETabStripItem itm = Control.Items[i]; changeService.OnComponentChanging(Control, null); Control.RemoveTab(itm); host.DestroyComponent(itm); changeService.OnComponentChanged(Control, null, null, null); } } }
private void OnRemoveTabStrip(object sender, EventArgs e) { IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); DesignerTransaction transaction = host.CreateTransaction("Remove Button"); changeService.OnComponentChanging(Control, null); OMETabStripItem itm = Control.Items[Control.Items.Count - 1]; Control.UnSelectItem(itm); Control.Items.Remove(itm); changeService.OnComponentChanged(Control, null, null, null); transaction.Commit(); }
private void OnAddTabStrip(object sender, EventArgs e) { IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); DesignerTransaction transaction = host.CreateTransaction("Add TabStrip"); OMETabStripItem itm = (OMETabStripItem)host.CreateComponent(typeof(OMETabStripItem)); changeService.OnComponentChanging(Control, null); Control.AddTab(itm); int indx = Control.Items.IndexOf(itm) + 1; itm.Title = "TabStrip Page " + indx.ToString(); Control.SelectItem(itm); changeService.OnComponentChanged(Control, null, null, null); transaction.Commit(); }
protected override void WndProc(ref Message msg) { if (msg.Msg == 0x201) { Point pt = Control.PointToClient(Cursor.Position); OMETabStripItem itm = Control.GetTabItemByPoint(pt); if (itm != null) { Control.SelectedItem = itm; ArrayList selection = new ArrayList(); selection.Add(itm); ISelectionService selectionService = (ISelectionService)GetService(typeof(ISelectionService)); selectionService.SetSelectedComponents(selection); } } base.WndProc(ref msg); }
public override void Initialize(IComponent component) { base.Initialize(component); TabStrip = component as OMETabStripItem; }
public override void Initialize(IComponent component) { base.Initialize(component); TabStrip = component as OMETabStripItem; }