/// <summary> /// Registers an image resource in the Object Explorer /// </summary> /// <param name="imgResource">The img resource.</param> public void RegisterImage(string imgResource) { if (!imgList.Images.ContainsKey(imgResource)) { imgList.Images.Add(imgResource, ResourceService.GetBitmap(imgResource)); } }
public ManagerForm() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); #if !STANDALONE ICSharpCode.SharpDevelop.Gui.FormLocationHelper.Apply(this, "AddInManager.WindowBounds", true); #endif #if STANDALONE actionFlowLayoutPanel.BackgroundImage = new Bitmap(typeof(ManagerForm).Assembly.GetManifestResourceStream("ICSharpCode.AddInManager.Modules.png")); //actionFlowLayoutPanel.BackgroundImageLayout = ImageLayout.Stretch; #else actionFlowLayoutPanel.BackgroundImage = ResourceService.GetBitmap("GeneralWizardBackground"); #endif installButton.Text = ResourceService.GetString("AddInManager.InstallButton"); uninstallButton.Text = ResourceService.GetString("AddInManager.ActionUninstall"); closeButton.Text = ResourceService.GetString("AddInManager.CloseButtonText"); showPreinstalledAddInsCheckBox.Text = ResourceService.GetString("AddInManager.ShowPreinstalledAddIns"); this.Text = ResourceService.GetString("AddInManager.Title"); CreateAddInList(); }
private void InitContextMenus() { ctxClass = new ContextMenuStrip(); ctxProperty = new ContextMenuStrip(); ctxSchema = new ContextMenuStrip(); bool canAdd = !_context.IsConnected || _context.CanModifyExistingSchemas; bool canDelete = !_context.IsConnected || _context.CanModifyExistingSchemas; //Schema if (canAdd) { var schemaAdd = new ToolStripMenuItem("Add"); if (_context.IsSupportedClass(ClassType.ClassType_FeatureClass)) { schemaAdd.DropDown.Items.Add("Feature Class", ResourceService.GetBitmap("feature_class"), (s, e) => { AddClass(ClassType.ClassType_FeatureClass); }); } if (_context.IsSupportedClass(ClassType.ClassType_Class)) { schemaAdd.DropDown.Items.Add("Class", ResourceService.GetBitmap("database_table"), (s, e) => { AddClass(ClassType.ClassType_Class); }); } var classAdd = new ToolStripMenuItem("Add"); if (_context.IsSupportedProperty(PropertyType.PropertyType_DataProperty)) { classAdd.DropDown.Items.Add("Data Property", ResourceService.GetBitmap("database_table"), (s, e) => { AddProperty(PropertyType.PropertyType_DataProperty); }); } if (_context.IsSupportedProperty(PropertyType.PropertyType_GeometricProperty)) { classAdd.DropDown.Items.Add("Geometric Property", ResourceService.GetBitmap("shape_handles"), (s, e) => { AddProperty(PropertyType.PropertyType_GeometricProperty); }); } if (_context.IsSupportedProperty(PropertyType.PropertyType_AssociationProperty)) { classAdd.DropDown.Items.Add("Association Property", ResourceService.GetBitmap("table_relationship"), (s, e) => { AddProperty(PropertyType.PropertyType_AssociationProperty); }); } if (_context.IsSupportedProperty(PropertyType.PropertyType_ObjectProperty)) { classAdd.DropDown.Items.Add("Object Property", ResourceService.GetBitmap("package"), (s, e) => { AddProperty(PropertyType.PropertyType_ObjectProperty); }); } ctxSchema.Items.Add(schemaAdd); ctxClass.Items.Add(classAdd); } //Add delete item to all if (canDelete) { ctxClass.Items.Add(new ToolStripSeparator()); ctxClass.Items.Add("Delete", ResourceService.GetBitmap("cross"), OnDeleteClass); ctxProperty.Items.Add("Delete", ResourceService.GetBitmap("cross"), OnDeleteProperty); } }
void AddImages() { goButton.Image = ResourceService.GetBitmap("Icons.16x16.RunProgramIcon"); refreshButton.Image = ResourceService.GetBitmap("Icons.16x16.BrowserRefresh"); backButton.Image = ResourceService.GetBitmap("Icons.16x16.BrowserBefore"); forwardButton.Image = ResourceService.GetBitmap("Icons.16x16.BrowserAfter"); stopButton.Image = ResourceService.GetBitmap("Icons.16x16.BrowserCancel"); Icon = ResourceService.GetIcon("Icons.16x16.WebSearchIcon"); }
public static Bitmap GetBitmap(string name) { if (ResourceService.GetBitmap(name) != null) { return(ResourceService.GetBitmap(name)); } return(ResourceService.GetBitmap("Icons.16x16.MiscFiles")); }
protected virtual void InitializeView() { ImageList smalllist = new ImageList(); ImageList imglist = new ImageList(); smalllist.ColorDepth = ColorDepth.Depth32Bit; imglist.ColorDepth = ColorDepth.Depth32Bit; imglist.ImageSize = new Size(32, 32); smalllist.ImageSize = new Size(16, 16); smalllist.Images.Add(ResourceService.GetBitmap("Icons.32x32.EmptyProjectIcon")); imglist.Images.Add(ResourceService.GetBitmap("Icons.32x32.EmptyProjectIcon")); // load the icons and set their index from the image list in the hashtable int i = 0; Dictionary <string, int> tmp = new Dictionary <string, int>(icons); foreach (KeyValuePair <string, int> entry in icons) { Bitmap bitmap = IconService.GetBitmap(entry.Key); if (bitmap != null) { smalllist.Images.Add(bitmap); imglist.Images.Add(bitmap); tmp[entry.Key] = ++i; } else { LoggingService.Warn("NewProjectDialog: can't load bitmap " + entry.Key.ToString() + " using default"); } } // set the correct imageindex for all templates icons = tmp; foreach (TemplateItem item in alltemplates) { if (item.Template.Icon == null) { item.ImageIndex = 0; } else { item.ImageIndex = icons[item.Template.Icon]; } } ((ListView)ControlDictionary["templateListView"]).LargeImageList = imglist; ((ListView)ControlDictionary["templateListView"]).SmallImageList = smalllist; InsertCategories(null, categories); ((TreeView)ControlDictionary["categoryTreeView"]).TreeViewNodeSorter = new TemplateCategoryComparer(); ((TreeView)ControlDictionary["categoryTreeView"]).Sort(); SelectLastSelectedCategoryNode(((TreeView)ControlDictionary["categoryTreeView"]).Nodes, PropertyService.Get("Dialogs.NewProjectDialog.LastSelectedCategory", "C#")); }
void AddImages() { ImageList imageList = new ImageList(); imageList.Images.Add(ResourceService.GetBitmap("Icons.16x16.Library")); imageList.Images.Add(ResourceService.GetBitmap("Icons.16x16.Interface")); imageList.Images.Add(ResourceService.GetBitmap("Icons.16x16.Class")); imageList.Images.Add(ResourceService.GetBitmap("Icons.16x16.Method")); webServicesTreeView.ImageList = imageList; }
internal FdoDataPreviewCtl() { InitializeComponent(); ImageList list = new ImageList(); list.Images.Add(ResourceService.GetBitmap("table")); list.Images.Add(ResourceService.GetBitmap("map")); resultTab.ImageList = list; TAB_GRID.ImageIndex = 0; TAB_MAP.ImageIndex = 1; }
public AbstractPadContent(string title, string iconResoureName) { StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService)); this.title = stringParserService.Parse(title); if (iconResoureName != null) { ResourceService ResourceService = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService)); this.icon = ResourceService.GetBitmap(iconResoureName); } }
public HelpBrowserPad() : base("${res:MainWindow.Windows.HelpScoutLabel}", "Icons.16x16.HelpIcon") { treeView.Dock = DockStyle.Fill; treeView.BorderStyle = BorderStyle.None; treeView.ImageList = new ImageList(); ResourceService ResourceService = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService)); treeView.ImageList.Images.Add(ResourceService.GetBitmap("Icons.16x16.HelpClosedFolder")); treeView.ImageList.Images.Add(ResourceService.GetBitmap("Icons.16x16.HelpOpenFolder")); treeView.ImageList.Images.Add(ResourceService.GetBitmap("Icons.16x16.HelpTopic")); treeView.BeforeExpand += new TreeViewCancelEventHandler(BeforeExpand); treeView.BeforeCollapse += new TreeViewCancelEventHandler(BeforeCollapse); treeView.DoubleClick += new EventHandler(DoubleClick); browserPanel.DockPadding.All = 2; browserPanel.Controls.Add(treeView); browserPanel.Paint += new PaintEventHandler(browserPanel_Paint); LoadHelpfile(); }
private static ContextMenuStrip BuildSelectedPropertyContextMenu(ClassDefinition cd, EventHandler mapHandler, EventHandler removeMappingHandler, EventHandler autoCreateHandler) { ContextMenuStrip ctxSelectedProperty = new ContextMenuStrip(); ctxSelectedProperty.Items.Add("Remove Mapping", ResourceService.GetBitmap("cross"), removeMappingHandler); ctxSelectedProperty.Items.Add(new ToolStripSeparator()); ctxSelectedProperty.Items.Add("Map to property of same name (create if necessary)", null, autoCreateHandler); ctxSelectedProperty.Items.Add(new ToolStripSeparator()); SortedList <string, ToolStripMenuItem> items = new SortedList <string, ToolStripMenuItem>(); if (cd != null) { foreach (PropertyDefinition p in cd.Properties) { if (p.PropertyType == PropertyType.PropertyType_DataProperty || p.PropertyType == PropertyType.PropertyType_GeometricProperty) { DataPropertyDefinition d = p as DataPropertyDefinition; GeometricPropertyDefinition g = p as GeometricPropertyDefinition; string name = p.Name; string text = "Map to property: " + name; Image icon = null; if (d != null) { if (d.IsAutoGenerated || d.ReadOnly) { continue; } icon = ResourceService.GetBitmap("table"); } else if (g != null) { if (g.ReadOnly) { continue; } icon = ResourceService.GetBitmap("shape_handles"); } ToolStripMenuItem itm1 = new ToolStripMenuItem(text, icon, mapHandler); itm1.Tag = name; items.Add(name, itm1); } } } foreach (ToolStripMenuItem item in items.Values) { ctxSelectedProperty.Items.Add(item); } return(ctxSelectedProperty); }
void InitImageList() { ImageList imglist = new ImageList(); imglist.ColorDepth = ColorDepth.Depth32Bit; imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ClosedFolderBitmap")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.OpenFolderBitmap")); imglist.Images.Add(new Bitmap(1, 1)); //imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.SelectionArrow")); imglist.Images.Add(ResourceService.GetBitmap("Icons.AboutImage")); ((TreeView)ControlDictionary["optionsTreeView"]).ImageList = imglist; }
public object CreateValue(Type propertyType, string valueString) { if (propertyType == typeof(Icon)) { return(ResourceService.GetIcon(valueString)); } if (propertyType == typeof(Image)) { return(ResourceService.GetBitmap(valueString)); } return(null); }
public ProjectScout() { Dock = DockStyle.Fill; filetree.Dock = DockStyle.Fill; filetree.BorderStyle = BorderStyle.Fixed3D; filetree.Location = new System.Drawing.Point(0, 22); filetree.Size = new System.Drawing.Size(184, 157); filetree.TabIndex = 1; filetree.AfterSelect += new TreeViewEventHandler(DirectorySelected); ImageList imglist = new ImageList(); imglist.ColorDepth = ColorDepth.Depth32Bit; imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ClosedFolderBitmap")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.OpenFolderBitmap")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.FLOPPY")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.DRIVE")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.CDROM")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.NETWORK")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Desktop")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.PersonalFiles")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.MyComputer")); filetree.ImageList = imglist; /* * filelister.Dock = DockStyle.Fill; * filelister.BorderStyle = BorderStyle.Fixed3D; * filelister.Location = new System.Drawing.Point(0, 184); * * filelister.Sorting = SortOrder.Ascending; * filelister.Size = new System.Drawing.Size(184, 450); * filelister.TabIndex = 3; * filelister.ItemActivate += new EventHandler(FileSelected); * * splitter1.Dock = DockStyle.Top; * splitter1.Location = new System.Drawing.Point(0, 179); * splitter1.Size = new System.Drawing.Size(184, 5); * splitter1.TabIndex = 2; * splitter1.TabStop = false; * splitter1.MinSize = 50; * splitter1.MinExtra = 50; * * this.Controls.Add(filelister); * this.Controls.Add(splitter1); */ this.Controls.Add(filetree); }
/// <summary> /// Registers the root node in the Object Explorer /// </summary> /// <param name="name">The name.</param> /// <param name="text">The text.</param> /// <param name="imgResource">The img resource.</param> /// <param name="addInTreePath">The add in tree path.</param> public void RegisterRootNode(string name, string text, string imgResource, string addInTreePath) { if (!imgList.Images.ContainsKey(imgResource)) { imgList.Images.Add(imgResource, ResourceService.GetBitmap(imgResource)); } TreeNode node = new TreeNode(); node.Name = name; node.Text = text; node.ImageKey = node.SelectedImageKey = imgResource; node.ContextMenuStrip = MenuService.CreateContextMenu(node, addInTreePath); objTreeView.Nodes.Add(node); }
public StatusPanel(WizardDialog wizard) { smallFont = ResourceService.LoadFont("Tahoma", 14, GraphicsUnit.World); normalFont = ResourceService.LoadFont("Tahoma", 14, GraphicsUnit.World); boldFont = ResourceService.LoadFont("Tahoma", 14, FontStyle.Bold, GraphicsUnit.World); this.wizard = wizard; this.BackgroundImage = ResourceService.GetBitmap("GeneralWizardBackground"); Size = new Size(198, 400); ResizeRedraw = false; SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.OptimizedDoubleBuffer, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); }
object CreateImage(Type propertyType, string valueString) { ResourceService ResourceService = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService)); if (propertyType == typeof(Icon)) { return(ResourceService.GetIcon(valueString)); } if (propertyType == typeof(Image)) { return(ResourceService.GetBitmap(valueString)); } return(null); }
public TaskView() : base() { RefreshColumnNames(); this.Columns.Add(type); this.Columns.Add(line); this.Columns.Add(description); this.Columns.Add(file); this.Columns.Add(path); this.FullRowSelect = true; this.AutoArrange = true; this.Alignment = ListViewAlignment.Left; this.View = View.Details; this.Dock = DockStyle.Fill; this.GridLines = true; this.Activation = ItemActivation.OneClick; OnResize(EventArgs.Empty); // ... ImageList imglist = new ImageList(); imglist.ColorDepth = ColorDepth.Depth32Bit; // HACK: these images must be in the same order as the TaskType enumeration. // because of how the ListViewItem's ImageIndex is set in TaskView.AddTask(); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Error")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Warning")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Information")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Question")); // TODO: use reflection and a custom attribute on the TaskType enumeration to tie this ImageList to TaskType // imglist.Images.Add(ResourceService.GetBitmap(Task.GetBitmapName(TaskType.Error))); // imglist.Images.Add(ResourceService.GetBitmap(Task.GetBitmapName(TaskType.Warning))); // imglist.Images.Add(ResourceService.GetBitmap(Task.GetBitmapName(TaskType.Message))); // imglist.Images.Add(ResourceService.GetBitmap(Task.GetBitmapName(TaskType.Comment))); this.SmallImageList = this.LargeImageList = imglist; // Set up the delays for the ToolTip. taskToolTip.InitialDelay = 500; taskToolTip.ReshowDelay = 100; taskToolTip.AutoPopDelay = 5000; // // // Force the ToolTip text to be displayed whether or not the form is active. // taskToolTip.ShowAlways = false; SortBy(TaskViewCols.Path); }
public StringListEditor() { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); this.ManualOrder = true; this.BrowseForDirectory = false; // init enabled states: ListBoxSelectedIndexChanged(null, null); EditTextBoxTextChanged(null, null); updateButton.Text = StringParser.Parse(updateButton.Text); removeButton.Text = StringParser.Parse(removeButton.Text); moveUpButton.Image = ResourceService.GetBitmap("Icons.16x16.ArrowUp"); moveDownButton.Image = ResourceService.GetBitmap("Icons.16x16.ArrowDown"); deleteButton.Image = ResourceService.GetBitmap("Icons.16x16.DeleteIcon"); }
bool AddDependencyRow(Dictionary <string, Version> addInDict, AddInReference dep, int rowIndex, string requiredByName) { string text = requiredByName ?? GetDisplayName(dep.Name); Version versionFound; Label label = new Label(); label.AutoSize = true; label.Text = text; PictureBox box = new PictureBox(); box.BorderStyle = BorderStyle.None; box.Size = new Size(16, 16); bool isOK = dep.Check(addInDict, out versionFound); box.SizeMode = PictureBoxSizeMode.CenterImage; box.Image = isOK ? ResourceService.GetBitmap("Icons.16x16.OK") : ResourceService.GetBitmap("Icons.16x16.DeleteIcon"); dependencyTable.Controls.Add(label, 1, rowIndex); dependencyTable.Controls.Add(box, 0, rowIndex); return(isOK); }
public static Bitmap GetBitmap(string name) { Bitmap bmp = null; try { bmp = ResourceService.GetBitmap(name); } catch { return(new Bitmap(16, 16)); } if (bmp != null) { return(bmp); } else { return(ResourceService.GetBitmap("Icons.16x16.MiscFiles")); } }
public ExceptionBox(Exception e, string message, bool mustTerminate) { this.exceptionThrown = e; this.message = message; InitializeComponent(); if (mustTerminate) { closeButton.Visible = false; continueButton.Text = closeButton.Text; continueButton.Left -= closeButton.Width - continueButton.Width; continueButton.Width = closeButton.Width; } try { Translate(this); } catch {} exceptionTextBox.Text = getClipboardString(); try { this.pictureBox.Image = ResourceService.GetBitmap("ErrorReport"); } catch {} }
static ClassBrowserIconService() { imglist = new ImageList(); imglist.ColorDepth = ColorDepth.Depth32Bit; imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Assembly")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.OpenAssembly")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Library")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.NameSpace")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.SubTypes")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.SuperTypes")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ClosedFolderBitmap")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.OpenFolderBitmap")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Reference")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ClosedReferenceFolder")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.OpenReferenceFolder")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ResourceFileIcon")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Event")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.SelectionArrow")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.CombineIcon")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Literal")); // const imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Local")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Parameter")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Class")); //18 imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.InternalClass")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ProtectedClass")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.PrivateClass")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Struct")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.InternalStruct")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ProtectedStruct")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.PrivateStruct")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Interface")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.InternalInterface")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ProtectedInterface")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.PrivateInterface")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Enum")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.InternalEnum")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ProtectedEnum")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.PrivateEnum")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Method")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.InternalMethod")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ProtectedMethod")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.PrivateMethod")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Property")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.InternalProperty")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ProtectedProperty")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.PrivateProperty")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Field")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.InternalField")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ProtectedField")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.PrivateField")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Delegate")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.InternalDelegate")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ProtectedDelegate")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.PrivateDelegate")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Event")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.InternalEvent")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ProtectedEvent")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.PrivateEvent")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.Indexer")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.InternalIndexer")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.ProtectedIndexer")); imglist.Images.Add(ResourceService.GetBitmap("Icons.16x16.PrivateIndexer")); }
public SharpDevelopSideTabItem(string name, object tag) : base(name, tag) { Icon = ResourceService.GetBitmap("Icons.16x16.SideBarDocument"); }
public override object BuildItem(object owner, ArrayList subItems, ConditionCollection conditions) { SdMenuCommand newItem = null; StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService)); object o = null; if (Class != null) { o = AddIn.CreateObject(Class); //说明当前菜单项是没有子菜单项�?即它有自己的功能,其功能由Class类具体实�?这种菜单项也是最常见�? } if (o != null) { if (o is ISubmenuBuilder) { return(((ISubmenuBuilder)o).BuildSubmenu(owner)); } if (o is IMenuCommand) { newItem = new SdMenuCommand(stringParserService.Parse(Label), new EventHandler(new MenuEventHandler(owner, (IMenuCommand)o).Execute)); if (beginGroup == "true") { newItem.BeginGroup = true; } } } if (newItem == null) { //说明当前菜单项既不是Link类型�?也没有指出其Class属�?所以有可能是一个包含子菜单的菜单项. newItem = new SdMenuCommand(stringParserService.Parse(Label)); if (subItems != null && subItems.Count > 0) { //判断是否有子菜单�? foreach (object item in subItems) { if (item is ButtonItem) { //添加一个子菜单�? newItem.SubItems.Add((ButtonItem)item); } else { //添加一组子菜单�? newItem.SubItems.AddRange((ButtonItem[])item); } } } } Debug.Assert(newItem != null); //到这里为�?newItem即当前菜单项不应该为空了. if (Icon != null) { //为菜单设置Icon. ResourceService ResourceService = (ResourceService)ServiceManager.Services.GetService(typeof(ResourceService)); newItem.Image = ResourceService.GetBitmap(Icon); } newItem.Description = description; newItem.MouseEnter += new EventHandler(newItem_MouseEnter); newItem.MouseLeave += new EventHandler(newItem_MouseLeave); if (Shortcut != null) { //为菜单设置Shortcut. try { newItem.Shortcuts.Add((eShortcut)Enum.Parse(eShortcut.F1.GetType(), Shortcut)); } catch (Exception) { } } return(newItem); //最后返回当前菜单项. }
private void InitContextMenus() { _mappingsMenu = new ContextMenuStrip(); _mapExprContextMenu = new ContextMenuStrip(); //Mappings _mappingsMenu.Items.Add("Add Computed Expression", null, OnAddExpression); //Selected expression _mapExprContextMenu.Items.Add("Edit Expression", null, OnEditExpression); _mapExprContextMenu.Items.Add("Rename alias", null, OnRenameAlias); _mapExprContextMenu.Items.Add(new ToolStripSeparator()); _mapExprContextMenu.Items.Add("Remove Alias", ResourceService.GetBitmap("cross"), OnRemoveAlias); _mapExprContextMenu.Items.Add("Remove Mapping", ResourceService.GetBitmap("cross"), OnRemoveExpressionMapping); _mapExprContextMenu.Items.Add(new ToolStripSeparator()); _mapExprContextMenu.Items.Add("Map Expression to property of same alias name (create if necessary)", null, OnMapAutoCreate); _mapExprContextMenu.Items.Add(new ToolStripSeparator()); SortedList <string, ToolStripMenuItem> items = new SortedList <string, ToolStripMenuItem>(); if (Parent.TargetClass != null) { foreach (PropertyDefinition p in Parent.TargetClass.Properties) { if (p.PropertyType == PropertyType.PropertyType_DataProperty || p.PropertyType == PropertyType.PropertyType_GeometricProperty) { DataPropertyDefinition d = p as DataPropertyDefinition; GeometricPropertyDefinition g = p as GeometricPropertyDefinition; string name = p.Name; string text = "Map to property: " + name; Image icon = null; if (d != null) { if (d.IsAutoGenerated || d.ReadOnly) { continue; } icon = ResourceService.GetBitmap("table"); } else if (g != null) { if (g.ReadOnly) { continue; } icon = ResourceService.GetBitmap("shape_handles"); } ToolStripMenuItem itm1 = new ToolStripMenuItem(text, icon, OnMapExpression); itm1.Tag = name; items.Add(name, itm1); } } } foreach (ToolStripMenuItem item in items.Values) { _mapExprContextMenu.Items.Add(item); } }