/// <summary> /// Add property page for this object /// </summary> /// <param name="lpfnAddPage"></param> /// <param name="lParam"></param> /// <returns></returns> int IShellPropSheetExt.AddPages(LPFNSVADDPROPSHEETPAGE pfnAddPage, IntPtr lParam) { try { // ADD PAGES HERE PropertySheetControl samplePage; PROPSHEETPAGE psp; IntPtr hPage; // In ActiveDirectory extensions, Get type of object, and show page according to class // GetADPath(); // if(sClass.ToLower() == "organizationalunit") {...} // create new inherited property page(s) and pass dobj to it samplePage = new DescriptionControl(); psp = samplePage.GetPSP(250, 230); hPage = Comctl32.CreatePropertySheetPage(ref psp); bool result = pfnAddPage(hPage, lParam); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } return(0); }
public ExchangeSummaryControl(SummaryControlStyle style, DescriptionControl descriptionControl) { this.InitializeComponent(); switch (style) { case SummaryControlStyle.VariableDescriptionSize: this.tableLayoutPanel.ColumnStyles.Add(new ColumnStyle()); this.tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100f)); break; case SummaryControlStyle.Percentage: this.tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60f)); this.tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40f)); break; case SummaryControlStyle.Percentage40: this.tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 40f)); this.tableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 60f)); break; } this.summaryControlStyle = style; this.descriptionControl = descriptionControl; this.objectInfoCollection.ListChanged += this.objectInfoCollection_ListChanged; this.objectInfoCollection.ListChanging += this.objectInfoCollection_ListChanging; }
private void descriptionControl1_Change(DescriptionControl sender, DescriptionControl.ChangeKind kind, int line, int box, object newValue) { this.eventLabel.Text = string.Format("Change: {0}", kind); lineLabel.Text = string.Format("Line: {0}", line); boxLabel.Text = string.Format("Box: {0}", box); if (newValue == null) newValueLabel.Text = "New Value: no symbol"; else if (newValue is Symbol) newValueLabel.Text = string.Format("New Value: Symbol {0}", ((Symbol)newValue).Id); else newValueLabel.Text = String.Format("New Value: '{0}", (string)newValue); }
private void descriptionControl1_Change(DescriptionControl sender, DescriptionControl.ChangeKind kind, int line, int box, object newValue) { this.eventLabel.Text = string.Format("Change: {0}", kind); lineLabel.Text = string.Format("Line: {0}", line); boxLabel.Text = string.Format("Box: {0}", box); if (newValue == null) { newValueLabel.Text = "New Value: no symbol"; } else if (newValue is Symbol) { newValueLabel.Text = string.Format("New Value: Symbol {0}", ((Symbol)newValue).Id); } else { newValueLabel.Text = String.Format("New Value: '{0}", (string)newValue); } }
/// <summary> /// Constructor using given PropertyGridView and mode flags</summary> /// <param name="mode">The flags specifying the PropertyGrid's features and appearance</param> /// <param name="propertyGridView">The customized PropertyGridView</param> public PropertyGrid(PropertyGridMode mode, PropertyGridView propertyGridView) { m_propertyGridView = propertyGridView; m_propertyGridView.BackColor = SystemColors.Window; m_propertyGridView.Dock = DockStyle.Fill; m_propertyGridView.EditingContextChanged += propertyGrid_EditingContextChanged; m_propertyGridView.MouseUp += propertyGrid_MouseUp; m_propertyGridView.DragOver += propertyGrid_DragOver; m_propertyGridView.DragDrop += propertyGrid_DragDrop; m_propertyGridView.MouseHover += propertyGrid_MouseHover; m_propertyGridView.MouseLeave += propertyGrid_MouseLeave; if (m_descriptionTextBox != null) { m_propertyGridView.DescriptionSetter = p => { if (p != null) m_descriptionTextBox.SetDescription(p.DisplayName, p.Description); else m_descriptionTextBox.ClearDescription(); }; } m_toolStrip = new ToolStrip(); m_toolStrip.GripStyle = ToolStripGripStyle.Hidden; m_toolStrip.Dock = DockStyle.Top; if ((mode & PropertyGridMode.PropertySorting) != 0) { m_propertyOrganization = new ToolStripDropDownButton(null, s_categoryImage); m_propertyOrganization.ToolTipText = "Property Organization".Localize( "Could be rephrased as 'How do you want these properties to be organized?'"); m_propertyOrganization.ImageTransparentColor = Color.Magenta; m_propertyOrganization.DropDownItemClicked += organization_DropDownItemClicked; var item1 = new ToolStripMenuItem("Unsorted".Localize()); item1.Tag = PropertySorting.None; var item2 = new ToolStripMenuItem("Alphabetical".Localize()); item2.Tag = PropertySorting.Alphabetical; var item3 = new ToolStripMenuItem("Categorized".Localize()); item3.Tag = PropertySorting.Categorized; var item4 = new ToolStripMenuItem("Categorized Alphabetical Properties".Localize()); item4.Tag = PropertySorting.Categorized | PropertySorting.Alphabetical; var item5 = new ToolStripMenuItem("Alphabetical Categories".Localize()); item5.Tag = PropertySorting.Categorized | PropertySorting.CategoryAlphabetical; var item6 = new ToolStripMenuItem("Alphabetical Categories And Properties".Localize()); item6.Tag = PropertySorting.ByCategory; m_propertyOrganization.DropDownItems.Add(item1); m_propertyOrganization.DropDownItems.Add(item2); m_propertyOrganization.DropDownItems.Add(item3); m_propertyOrganization.DropDownItems.Add(item4); m_propertyOrganization.DropDownItems.Add(item5); m_propertyOrganization.DropDownItems.Add(item6); m_toolStrip.Items.Add(m_propertyOrganization); m_toolStrip.Items.Add(new ToolStripSeparator()); } if ((mode & PropertyGridMode.DisableSearchControls) == 0) { var dropDownButton = new ToolStripDropDownButton(); dropDownButton.DisplayStyle = ToolStripItemDisplayStyle.Image; dropDownButton.Image = ResourceUtil.GetImage16(Resources.SearchImage); dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; dropDownButton.Name = "PropertyGridSearchButton"; dropDownButton.Size = new System.Drawing.Size(29, 22); dropDownButton.Text = "Search".Localize("'Search' is a verb"); m_patternTextBox = new ToolStripAutoFitTextBox(); m_patternTextBox.Name = "patternTextBox"; m_patternTextBox.MaximumWidth = 1080; m_patternTextBox.KeyUp += patternTextBox_KeyUp; m_patternTextBox.TextBox.PreviewKeyDown += patternTextBox_PreviewKeyDown; var clearSearchButton = new ToolStripButton(); clearSearchButton.DisplayStyle = ToolStripItemDisplayStyle.Image; clearSearchButton.Image = ResourceUtil.GetImage16(Resources.DeleteImage); dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; clearSearchButton.Name = "PropertyGridClearSearchButton"; clearSearchButton.Size = new System.Drawing.Size(29, 22); clearSearchButton.Text = "Clear Search".Localize("'Clear' is a verb"); clearSearchButton.Click += clearSearchButton_Click; m_toolStrip.Items.AddRange( new ToolStripItem[] { dropDownButton, m_patternTextBox, clearSearchButton }); } if ((mode & PropertyGridMode.HideResetAllButton) == 0) { // Reset all button. var resetAllButton = new ToolStripButton(); resetAllButton.DisplayStyle = ToolStripItemDisplayStyle.Image; resetAllButton.Image = ResourceUtil.GetImage16(Resources.ResetImage); resetAllButton.ImageTransparentColor = System.Drawing.Color.Magenta; resetAllButton.Name = "PropertyGridResetAllButton"; resetAllButton.Size = new Size(29, 22); resetAllButton.ToolTipText = "Reset all properties".Localize(); resetAllButton.Click += (sender, e) => { ITransactionContext transaction = m_propertyGridView.EditingContext.As<ITransactionContext>(); transaction.DoTransaction(delegate { ResetAll(); }, "Reset All Properties".Localize("'Reset' is a verb and this is the name of a command")); }; m_toolStrip.Items.Add(resetAllButton); } if ((mode & PropertyGridMode.AllowEditingComposites) != 0) { m_navigateOut = new ToolStripButton(null, s_navigateOutImage, navigateOut_Click); m_navigateOut.Enabled = true; m_navigateOut.ToolTipText = "Navigate back to parent of selected object".Localize(); m_toolStrip.Items.Add(m_navigateOut); m_propertyGridView.AllowEditingComposites = true; } SuspendLayout(); if ((mode & PropertyGridMode.DisplayTooltips) != 0) m_propertyGridView.AllowTooltips = true; if ((mode & PropertyGridMode.DisplayDescriptions) == 0) Controls.Add(m_propertyGridView); else { m_splitContainer.Orientation = Orientation.Horizontal; m_splitContainer.BackColor = SystemColors.InactiveBorder; m_splitContainer.FixedPanel = FixedPanel.Panel2; m_splitContainer.SplitterWidth = 8; m_splitContainer.Dock = DockStyle.Fill; m_splitContainer.Panel1.Controls.Add(m_propertyGridView); m_descriptionTextBox = new DescriptionControl(this); m_descriptionTextBox.BackColor = SystemColors.Window; m_descriptionTextBox.Dock = DockStyle.Fill; m_splitContainer.Panel2.Controls.Add(m_descriptionTextBox); Controls.Add(m_splitContainer); m_propertyGridView.SelectedPropertyChanged += propertyGrid_SelectedRowChanged; m_descriptionTextBox.ClearDescription(); } if (m_toolStrip.Items.Count > 0) { UpdateToolstripItems(); Controls.Add(m_toolStrip); } else { m_toolStrip.Dispose(); m_toolStrip = null; } Name = "PropertyGrid"; Font = m_propertyGridView.Font; FontChanged += (sender, e) => m_propertyGridView.Font = Font; ResumeLayout(false); PerformLayout(); }
/// <summary> /// Constructor using given PropertyGridView and mode flags</summary> /// <param name="mode">The flags specifying the PropertyGrid's features and appearance</param> /// <param name="propertyGridView">The customized PropertyGridView</param> public PropertyGrid(PropertyGridMode mode, PropertyGridView propertyGridView) { m_propertyGridView = propertyGridView; m_propertyGridView.BackColor = SystemColors.Window; m_propertyGridView.Dock = DockStyle.Fill; m_propertyGridView.EditingContextChanged += propertyGrid_EditingContextChanged; m_propertyGridView.MouseUp += propertyGrid_MouseUp; m_propertyGridView.DragOver += propertyGrid_DragOver; m_propertyGridView.DragDrop += propertyGrid_DragDrop; m_propertyGridView.MouseHover += propertyGrid_MouseHover; m_propertyGridView.MouseLeave += propertyGrid_MouseLeave; m_propertyGridView.DescriptionSetter = p => { if (p != null) { m_descriptionTextBox.SetDescription(p.DisplayName, p.Description); } else { m_descriptionTextBox.ClearDescription(); } }; m_toolStrip = new ToolStrip(); m_toolStrip.GripStyle = ToolStripGripStyle.Hidden; m_toolStrip.Dock = DockStyle.Top; if ((mode & PropertyGridMode.PropertySorting) != 0) { m_propertyOrganization = new ToolStripDropDownButton(null, s_categoryImage); m_propertyOrganization.ToolTipText = "Property Organization".Localize( "Could be rephrased as 'How do you want these properties to be organized?'"); m_propertyOrganization.ImageTransparentColor = Color.Magenta; m_propertyOrganization.DropDownItemClicked += organization_DropDownItemClicked; var item1 = new ToolStripMenuItem("Unsorted".Localize()); item1.Tag = PropertySorting.None; var item2 = new ToolStripMenuItem("Alphabetical".Localize()); item2.Tag = PropertySorting.Alphabetical; var item3 = new ToolStripMenuItem("Categorized".Localize()); item3.Tag = PropertySorting.Categorized; var item4 = new ToolStripMenuItem("Categorized Alphabetical Properties".Localize()); item4.Tag = PropertySorting.Categorized | PropertySorting.Alphabetical; var item5 = new ToolStripMenuItem("Alphabetical Categories".Localize()); item5.Tag = PropertySorting.Categorized | PropertySorting.CategoryAlphabetical; var item6 = new ToolStripMenuItem("Alphabetical Categories And Properties".Localize()); item6.Tag = PropertySorting.ByCategory; m_propertyOrganization.DropDownItems.Add(item1); m_propertyOrganization.DropDownItems.Add(item2); m_propertyOrganization.DropDownItems.Add(item3); m_propertyOrganization.DropDownItems.Add(item4); m_propertyOrganization.DropDownItems.Add(item5); m_propertyOrganization.DropDownItems.Add(item6); m_toolStrip.Items.Add(m_propertyOrganization); m_toolStrip.Items.Add(new ToolStripSeparator()); } if ((mode & PropertyGridMode.DisableSearchControls) == 0) { var dropDownButton = new ToolStripDropDownButton(); dropDownButton.DisplayStyle = ToolStripItemDisplayStyle.Image; dropDownButton.Image = ResourceUtil.GetImage16(Resources.SearchImage); dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; dropDownButton.Name = "PropertyGridSearchButton"; dropDownButton.Size = new System.Drawing.Size(29, 22); dropDownButton.Text = "Search".Localize("'Search' is a verb"); m_patternTextBox = new ToolStripAutoFitTextBox(); m_patternTextBox.Name = "patternTextBox"; m_patternTextBox.MaximumWidth = 1080; m_patternTextBox.KeyUp += patternTextBox_KeyUp; m_patternTextBox.TextBox.PreviewKeyDown += patternTextBox_PreviewKeyDown; var clearSearchButton = new ToolStripButton(); clearSearchButton.DisplayStyle = ToolStripItemDisplayStyle.Image; clearSearchButton.Image = ResourceUtil.GetImage16(Resources.DeleteImage); dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; clearSearchButton.Name = "PropertyGridClearSearchButton"; clearSearchButton.Size = new System.Drawing.Size(29, 22); clearSearchButton.Text = "Clear Search".Localize("'Clear' is a verb"); clearSearchButton.Click += clearSearchButton_Click; m_toolStrip.Items.AddRange( new ToolStripItem[] { dropDownButton, m_patternTextBox, clearSearchButton }); } if ((mode & PropertyGridMode.HideResetAllButton) == 0) { // Reset all button. var resetAllButton = new ToolStripButton(); resetAllButton.DisplayStyle = ToolStripItemDisplayStyle.Image; resetAllButton.Image = ResourceUtil.GetImage16(Resources.ResetImage); resetAllButton.ImageTransparentColor = System.Drawing.Color.Magenta; resetAllButton.Name = "PropertyGridResetAllButton"; resetAllButton.Size = new Size(29, 22); resetAllButton.ToolTipText = "Reset all properties".Localize(); resetAllButton.Click += (sender, e) => { ITransactionContext transaction = m_propertyGridView.EditingContext.As <ITransactionContext>(); transaction.DoTransaction(delegate { ResetAll(); }, "Reset All Properties".Localize("'Reset' is a verb and this is the name of a command")); }; m_toolStrip.Items.Add(resetAllButton); } if ((mode & PropertyGridMode.AllowEditingComposites) != 0) { m_navigateOut = new ToolStripButton(null, s_navigateOutImage, navigateOut_Click); m_navigateOut.Enabled = true; m_navigateOut.ToolTipText = "Navigate back to parent of selected object".Localize(); m_toolStrip.Items.Add(m_navigateOut); m_propertyGridView.AllowEditingComposites = true; } SuspendLayout(); if ((mode & PropertyGridMode.DisplayTooltips) != 0) { m_propertyGridView.AllowTooltips = true; } if ((mode & PropertyGridMode.DisplayDescriptions) == 0) { Controls.Add(m_propertyGridView); } else { m_splitContainer.Orientation = Orientation.Horizontal; m_splitContainer.BackColor = SystemColors.InactiveBorder; m_splitContainer.FixedPanel = FixedPanel.Panel2; m_splitContainer.SplitterWidth = 8; m_splitContainer.Dock = DockStyle.Fill; m_splitContainer.Panel1.Controls.Add(m_propertyGridView); m_descriptionTextBox = new DescriptionControl(this); m_descriptionTextBox.BackColor = SystemColors.Window; m_descriptionTextBox.Dock = DockStyle.Fill; m_splitContainer.Panel2.Controls.Add(m_descriptionTextBox); Controls.Add(m_splitContainer); m_propertyGridView.SelectedPropertyChanged += propertyGrid_SelectedRowChanged; m_descriptionTextBox.ClearDescription(); } if (m_toolStrip.Items.Count > 0) { UpdateToolstripItems(); Controls.Add(m_toolStrip); } else { m_toolStrip.Dispose(); m_toolStrip = null; } Name = "PropertyGrid"; Font = m_propertyGridView.Font; FontChanged += (sender, e) => m_propertyGridView.Font = Font; ResumeLayout(false); PerformLayout(); }
private void TvSiteMapNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { TreeNode selectedNode = e.Node; selectedNode.TreeView.SelectedNode = selectedNode; var collec = (Dictionary <string, string>)selectedNode.Tag; TreeNodeHelper.AddContextMenu(e.Node, this); Control existingControl = panelContainer.Controls.Count > 0 ? panelContainer.Controls[0] : null; if (existingControl != null) { panelContainer.Controls.Remove(existingControl); existingControl.Dispose(); GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); } switch (selectedNode.Text.Split(' ')[0]) { case "SiteMap": { var ctrl = new SiteMapControl(collec); ctrl.Saved += CtrlSaved; panelContainer.Controls.Add(ctrl); ctrl.BringToFront(); if (existingControl != null) { panelContainer.Controls.Remove(existingControl); } tsbItemSave.Visible = true; } break; case "Area": { if (collec.Count == 0) { collec.Add("Id", string.Format("tempId_{0}", DateTime.Now.Ticks)); } var ctrl = new AreaControl(collec, webResourcesImageCache, webResourcesHtmlCache, Service); ctrl.Saved += CtrlSaved; panelContainer.Controls.Add(ctrl); ctrl.BringToFront(); if (existingControl != null) { panelContainer.Controls.Remove(existingControl); } tsbItemSave.Visible = true; } break; case "SubArea": { if (collec.Count == 0) { collec.Add("Id", string.Format("tempId_{0}", DateTime.Now.Ticks)); } var ctrl = new SubAreaControl(collec, entityCache, webResourcesImageCache, webResourcesHtmlCache, Service); ctrl.Saved += CtrlSaved; panelContainer.Controls.Add(ctrl); ctrl.BringToFront(); if (existingControl != null) { panelContainer.Controls.Remove(existingControl); } tsbItemSave.Visible = true; } break; case "Group": { if (collec.Count == 0) { collec.Add("Id", string.Format("tempId_{0}", DateTime.Now.Ticks)); } var ctrl = new GroupControl(collec); ctrl.Saved += CtrlSaved; panelContainer.Controls.Add(ctrl); ctrl.BringToFront(); if (existingControl != null) { panelContainer.Controls.Remove(existingControl); } tsbItemSave.Visible = true; } break; case "Privilege": { var ctrl = new PrivilegeControl(collec); ctrl.Saved += CtrlSaved; panelContainer.Controls.Add(ctrl); ctrl.BringToFront(); if (existingControl != null) { panelContainer.Controls.Remove(existingControl); } tsbItemSave.Visible = true; } break; case "Description": { var ctrl = new DescriptionControl(collec); ctrl.Saved += CtrlSaved; panelContainer.Controls.Add(ctrl); ctrl.BringToFront(); if (existingControl != null) { panelContainer.Controls.Remove(existingControl); } tsbItemSave.Visible = true; } break; case "Title": { var ctrl = new TitleControl(collec); ctrl.Saved += CtrlSaved; panelContainer.Controls.Add(ctrl); ctrl.BringToFront(); if (existingControl != null) { panelContainer.Controls.Remove(existingControl); } tsbItemSave.Visible = true; } break; default: { panelContainer.Controls.Clear(); tsbItemSave.Visible = false; } break; } ManageMenuDisplay(); }
private void Awake() { instance = this; }
/// <summary> /// Initializes a new instance of the <see cref="DictionaryWindow"/> class with default settings. /// </summary> /// <param name="designer">The report designer.</param> public DictionaryWindow(Designer designer) : base(designer) { Name = "DictionaryWindow"; Image = Res.GetImage(72); FToolbar = new Bar(); FToolbar.Dock = DockStyle.Top; FToolbar.Font = DrawUtils.DefaultFont; FToolbar.RoundCorners = false; btnActions = new ButtonItem(); btnActions.AutoExpandOnClick = true; btnEdit = AddButton(Res.GetImage(68), miEdit_Click); btnDelete = AddButton(Res.GetImage(51), miDelete_Click); btnView = AddButton(Res.GetImage(54), miView_Click); FToolbar.Items.AddRange(new ButtonItem[] { btnActions, btnEdit, btnDelete, btnView }); miNew = AddButton(Res.GetImage(0), miNew_Click); miOpen = AddButton(Res.GetImage(1), miOpen_Click); miMerge = AddButton(null, miMerge_Click); miSave = AddButton(Res.GetImage(2), miSave_Click); miChooseData = AddButton(null, Designer.cmdChooseData.Invoke); miChooseData.BeginGroup = true; miNewDataSource = AddButton(Res.GetImage(137), Designer.cmdAddData.Invoke); miNewDataSource.BeginGroup = true; miNewRelation = AddButton(Res.GetImage(139), miNewRelation_Click); miNewCalculatedColumn = AddButton(Res.GetImage(55), miNewCalculatedColumn_Click); miNewParameter = AddButton(Res.GetImage(56), miNewParameter_Click); miNewTotal = AddButton(Res.GetImage(65), miNewTotal_Click); btnActions.SubItems.AddRange(new ButtonItem[] { miNew, miOpen, miMerge, miSave, miChooseData, miNewDataSource, miNewRelation, miNewCalculatedColumn, miNewParameter, miNewTotal }); btnActions.PopupOpen += btnActions_PopupOpen; mnuContext = new ContextMenuBar(); mnuContextRoot = new ButtonItem(); mnuContext.Items.Add(mnuContextRoot); miRename = AddButton(null, miRename_Click); miRename.Shortcuts.Add(eShortcut.F2); miEdit = AddButton(Res.GetImage(68), miEdit_Click); miDelete = AddButton(Res.GetImage(51), miDelete_Click); miDeleteAlias = AddButton(null, miDeleteAlias_Click); miView = AddButton(Res.GetImage(54), miView_Click); mnuContextRoot.SubItems.AddRange(new ButtonItem[] { miRename, miEdit, miDelete, miDeleteAlias, miView }); mnuContextRoot.PopupOpen += mnuContextRoot_PopupOpen; FTree = new TreeView(); FTree.Dock = DockStyle.Fill; FTree.BorderStyle = BorderStyle.None; FTree.ImageList = Res.GetImages(); FTree.LabelEdit = true; FTree.HideSelection = false; FTree.AllowDrop = true; FTree.MouseDown += FTree_MouseDown; FTree.BeforeLabelEdit += FTree_BeforeLabelEdit; FTree.AfterLabelEdit += FTree_AfterLabelEdit; FTree.KeyDown += FTree_KeyDown; FTree.AfterSelect += FTree_AfterSelect; FTree.DoubleClick += miEdit_Click; FTree.ItemDrag += FTree_ItemDrag; FTree.DragOver += FTree_DragOver; FTree.DragDrop += FTree_DragDrop; mnuContext.SetContextMenuEx(FTree, mnuContextRoot); FSplitter = new Splitter(); FSplitter.Dock = DockStyle.Bottom; FSplitter.Visible = false; lblDescription = new DescriptionControl(); lblDescription.Dock = DockStyle.Bottom; lblDescription.Height = 70; lblDescription.Visible = false; ParentControl.Controls.AddRange(new Control[] { FTree, FSplitter, lblDescription, FToolbar }); FExpandedNodes = new List <string>(); Localize(); }