/// <summary> /// Constructor</summary> public StringTagSearchInputUI(TagLabelListControl tagListControl) { m_tagListControl = tagListControl; Visible = true; GripStyle = ToolStripGripStyle.Hidden; RenderMode = ToolStripRenderMode.System; ToolStripDropDownButton dropDownButton = new ToolStripDropDownButton(); dropDownButton.DisplayStyle = ToolStripItemDisplayStyle.Image; dropDownButton.Image = ResourceUtil.GetImage16(Resources.SearchImage); dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; dropDownButton.Name = "SearchButton"; dropDownButton.Size = new System.Drawing.Size(29, 22); dropDownButton.Text = "Search".Localize("'Search' is a verb"); m_patternTextBox = new ToolStripAutoFitTextBox(); m_patternTextBox.KeyDown += patternTextBox_KeyDown; m_patternTextBox.TextChanged += patternTextBox_TextChanged; m_patternTextBox.TextBox.PreviewKeyDown += textBox_PreviewKeyDown; m_patternTextBox.MaximumWidth = 1080; Items.AddRange(new ToolStripItem[] { dropDownButton, m_patternTextBox, //clearSearchButton }); }
/// <summary> /// Configures the BookmarkLister</summary> /// <param name="controlInfo">Information about the control for the hosting service</param> protected virtual void Configure( out ControlInfo controlInfo) { Image bkmImage = ResourceUtil.GetImage16(LevelEditorCore.Resources.BookmarkImage); controlInfo = new ControlInfo( "Bookmarks".Localize(), "Edits document bookmarks".Localize(), StandardControlGroup.Hidden, bkmImage); TreeControl.ShowRoot = false; TreeControl.AllowDrop = false; TreeControl.SelectionMode = SelectionMode.One; TreeControl.MouseDown += TreeControl_MouseDown; }
public LayeringCommands() { m_contextMenuStrip = new ContextMenuStrip(); m_contextMenuStrip.AutoClose = true; m_addLayer = new ToolStripMenuItem("New Layer".Localize()); m_addLayer.Click += (sender, e) => AddNewLayer(); m_deleteLayer = new ToolStripMenuItem("Delete".Localize()); m_deleteLayer.Click += (sender, e) => Delete(); m_deleteLayer.ShortcutKeys = Keys.Delete; m_deleteLayer.ShortcutKeyDisplayString = KeysUtil.KeysToString(Keys.Delete, true); m_deleteLayer.Image = ResourceUtil.GetImage16(CommandInfo.EditDelete.ImageName); m_contextMenuStrip.Items.Add(m_addLayer); m_contextMenuStrip.Items.Add(m_deleteLayer); }
public BookmarkLister(ICommandService commandService) : base(commandService) { Configure(out m_controlInfo); m_commandService = commandService; m_contextMenuStrip = new ContextMenuStrip(); m_contextMenuStrip.AutoClose = true; m_addBookmark = new ToolStripMenuItem("Add Bookmark".Localize()); m_addBookmark.Click += (sender, e) => AddBookmark(); m_deleteBookmark = new ToolStripMenuItem("Delete".Localize()); m_deleteBookmark.Click += (sender, e) => Delete(); m_deleteBookmark.ShortcutKeys = Keys.Delete; m_deleteBookmark.ShortcutKeyDisplayString = KeysUtil.KeysToString(Keys.Delete, true); m_deleteBookmark.Image = ResourceUtil.GetImage16(CommandInfo.EditDelete.ImageName); m_contextMenuStrip.Items.Add(m_addBookmark); m_contextMenuStrip.Items.Add(m_deleteBookmark); }
/// <summary> /// Constructor for simply tracking a pre-registered image. /// Because it was not created here, Image will not be disposed of in IDispose.Dispose().</summary> /// <param name="id">Image identifier</param> /// <param name="size">Image size</param> public EmbeddedImage(string id, ImageSizes size) { m_isOwner = false; m_id = id; switch (size) { case ImageSizes.e16x16: Image = ResourceUtil.GetImage16(id); break; case ImageSizes.e24x24: Image = ResourceUtil.GetImage24(id); break; case ImageSizes.e32x32: Image = ResourceUtil.GetImage32(id); break; default: throw new ArgumentException("Invalid size specified"); } if (Image == null) { throw new ArgumentException("No image registered with this id and size"); } }
/// <summary> /// Constructor</summary> public StringSearchInputUI() { m_patternTextRegex = string.Empty; Visible = true; GripStyle = ToolStripGripStyle.Hidden; RenderMode = ToolStripRenderMode.System; ToolStripDropDownButton dropDownButton = new ToolStripDropDownButton(); dropDownButton.DisplayStyle = ToolStripItemDisplayStyle.Image; dropDownButton.Image = ResourceUtil.GetImage16(Resources.SearchImage); dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; dropDownButton.Name = "SearchButton"; dropDownButton.Size = new System.Drawing.Size(29, 22); dropDownButton.Text = "Search".Localize("'Search' is a verb"); ToolStripButton clearSearchButton = new ToolStripButton(); clearSearchButton.DisplayStyle = ToolStripItemDisplayStyle.Image; clearSearchButton.Image = ResourceUtil.GetImage16(Resources.DeleteImage); dropDownButton.ImageTransparentColor = System.Drawing.Color.Magenta; clearSearchButton.Name = "ClearSearchButton"; clearSearchButton.Size = new System.Drawing.Size(29, 22); clearSearchButton.Text = "Clear Search".Localize("'Clear' is a verb"); clearSearchButton.Click += clearSearchButton_Click; m_patternTextBox = new ToolStripAutoFitTextBox(); m_patternTextBox.KeyUp += patternTextBox_KeyUp; m_patternTextBox.TextChanged += patternTextBox_TextChanged; m_patternTextBox.TextBox.PreviewKeyDown += textBox_PreviewKeyDown; m_patternTextBox.MaximumWidth = 1080; Items.AddRange(new ToolStripItem[] { dropDownButton, m_patternTextBox, clearSearchButton }); }
/// <summary> /// Helper function to return properly sized images based on user preferences</summary> /// <param name="imageName">Image name</param> /// <returns>Image of given name</returns> public Image GetProperlySizedImage(string imageName) { Image image = null; if (!string.IsNullOrEmpty(imageName)) { if (m_imageSize == ImageSizes.Size16x16) { image = ResourceUtil.GetImage16(imageName); } else if (m_imageSize == ImageSizes.Size24x24) { image = ResourceUtil.GetImage24(imageName); } else if (m_imageSize == ImageSizes.Size32x32) { image = ResourceUtil.GetImage32(imageName); } } return(image); }
public ClonedPropertyEditor(PropertyEditor propEditor) { var editingContext = propEditor.PropertyGrid.PropertyGridView.EditingContext; // there is no reason to clone empty property editor. if (editingContext == null) { throw new ArgumentException("propEditor"); } // don't create cloned property editor // if there is nothing to edit if (editingContext.PropertyDescriptors == null || !editingContext.PropertyDescriptors.Any()) { return; } if (editingContext is SelectionPropertyEditingContext) { m_context = ((SelectionPropertyEditingContext)editingContext).SelectionContext; } else { m_context = editingContext; } m_propertyEditor = propEditor; m_propertyEditor.Configure(out m_propertyGrid, out m_controlInfo); m_selectionButton = new ToolStripButton(); m_selectionButton.DisplayStyle = ToolStripItemDisplayStyle.Image; m_selectionButton.Image = ResourceUtil.GetImage16(Resources.SelectionFindImage); m_selectionButton.Name = "selectionButton"; m_selectionButton.Size = new Size(29, 22); m_selectionButton.ToolTipText = "Select bound object(s)".Localize(); m_selectionButton.Click += (sender, e) => { // select bound object ISelectionContext selCntx = m_context.As <ISelectionContext>(); var edCntx = m_propertyGrid.PropertyGridView.EditingContext; if (selCntx != null && edCntx != null) { selCntx.SetRange(edCntx.Items); } }; m_propertyGrid.ToolStrip.Items.Add(m_selectionButton); m_propertyGrid.PropertyGridView.ContextRegistry = propEditor.ContextRegistry; m_controlInfo.Name = propEditor.m_controlInfo.DisplayName + "_" + ++s_cloneId; m_controlInfo.Group = PropertyEditor.ClonedEditorGroup; m_controlInfo.UnregisterOnClose = true; m_propertyEditor.ControlHostService.RegisterControl(m_propertyGrid, m_controlInfo, this); m_propertyEditingContext = new CustomPropertyEditingContext(editingContext); m_propertyGrid.Bind(m_propertyEditingContext); m_propertyGrid.PropertySorting = propEditor.PropertyGrid.PropertySorting; // copy expansion state var zip = propEditor.PropertyGrid.PropertyGridView.Categories.Zip(m_propertyGrid.PropertyGridView.Categories, (src, dest) => new { src, dest }); foreach (var pair in zip) { if (pair.dest.Name == pair.src.Name) { pair.dest.Expanded = pair.src.Expanded; } } m_propertyGrid.MouseUp += (sender, e) => OnPropertyGridMouseUp(e); // subscribe to events. // It is necessary to unsubscribe to allow this object to be garbage collected. if (m_propertyEditor.DocumentRegistry != null) { m_propertyEditor.DocumentRegistry.DocumentRemoved += DocumentRegistry_DocumentRemoved; m_propertyEditor.DocumentRegistry.ActiveDocumentChanged += DocumentRegistry_ActiveDocumentChanged; } m_observableContext = m_context.As <IObservableContext>(); m_validationContext = m_context.As <IValidationContext>(); if (m_observableContext != null) { m_observableContext.ItemChanged += observableContext_ItemChanged; m_observableContext.ItemInserted += observableContext_ItemInserted; m_observableContext.ItemRemoved += observableContext_ItemRemoved; } if (m_validationContext != null) { m_validationContext.Beginning += validationContext_Beginning; m_validationContext.Ended += validationContext_Ended; m_validationContext.Cancelled += validationContext_Cancelled; } }
/// <summary> /// Initializes the MEF component</summary> public void Initialize() { m_treeControl = new TreeControl(); m_treeControl.Dock = DockStyle.Fill; m_treeControl.AllowDrop = true; m_treeControl.SelectionMode = SelectionMode.MultiExtended; m_treeControl.ImageList = ResourceUtil.GetImageList16(); m_treeControl.StateImageList = ResourceUtil.GetImageList16(); m_treeControl.DragOver += treeControl_DragOver; m_treeControl.DragDrop += treeControl_DragDrop; m_treeControl.MouseUp += treeControl_MouseUp; m_treeControlAdapter = new TreeControlAdapter(m_treeControl); m_listView = new ListView(); m_listView.View = View.Details; m_listView.Dock = DockStyle.Fill; m_listView.AllowDrop = true; m_listView.LabelEdit = false; m_listView.MouseUp += thumbnailControl_MouseUp; m_listView.MouseMove += thumbnailControl_MouseMove; m_listView.MouseLeave += thumbnailControl_MouseLeave; m_listView.DragOver += thumbnailControl_DragOver; m_listViewAdapter = new ListViewAdapter(m_listView); m_thumbnailControl = new ThumbnailControl(); m_thumbnailControl.Dock = DockStyle.Fill; m_thumbnailControl.AllowDrop = true; m_thumbnailControl.BackColor = SystemColors.Window; m_thumbnailControl.SelectionChanged += thumbnailControl_SelectionChanged; m_thumbnailControl.MouseMove += thumbnailControl_MouseMove; m_thumbnailControl.MouseUp += thumbnailControl_MouseUp; m_thumbnailControl.MouseLeave += thumbnailControl_MouseLeave; m_thumbnailControl.DragOver += thumbnailControl_DragOver; m_splitContainer = new SplitContainer(); m_splitContainer.Name = "Resources".Localize(); m_splitContainer.Orientation = Orientation.Vertical; m_splitContainer.Panel1.Controls.Add(m_treeControl); m_splitContainer.Panel2.Controls.Add(m_thumbnailControl); m_splitContainer.Panel2.Controls.Add(m_listView); m_splitContainer.SplitterDistance = 10; m_listView.Hide(); Image resourceImage = ResourceUtil.GetImage16(Resources.ResourceImage); // on initialization, register our tree control with the hosting service m_controlHostService.RegisterControl( m_splitContainer, new ControlInfo( "Resources".Localize(), "Lists available resources".Localize(), StandardControlGroup.Left, resourceImage), this); RegisterCommands(m_commandService); RegisterSettings(); }
/// <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(); }
/// <summary> /// Initializes the MEF component</summary> public void Initialize() { // tree control m_treeControl = new TreeControl(); m_treeControl.SelectionMode = SelectionMode.One; m_treeControl.Dock = DockStyle.Fill; m_treeControl.AllowDrop = true; m_treeControl.ImageList = ResourceUtil.GetImageList16(); m_treeControl.StateImageList = ResourceUtil.GetImageList16(); m_treeControl.MouseUp += treeControl_MouseUp; m_treeControlAdapter = new TreeControlAdapter(m_treeControl); // list view m_listView = new CustomListView(); m_listView.View = View.Details; m_listView.Dock = DockStyle.Fill; m_listView.AllowDrop = true; m_listView.LabelEdit = false; m_listView.MouseDown += ThumbnailControl_MouseDown; m_listView.MouseMove += ThumbnailControl_MouseMove; m_listView.MouseUp += ThumbnailControl_MouseUp; m_listView.MouseLeave += ThumbnailControl_MouseLeave; m_listViewAdapter = new ListViewAdapter(m_listView); // thumbnail control m_thumbnailControl = new ThumbnailControl(); m_thumbnailControl.Dock = DockStyle.Fill; m_thumbnailControl.AllowDrop = true; m_thumbnailControl.BackColor = SystemColors.Window; m_thumbnailControl.Selection.Changed += thumbnailControl_SelectionChanged; m_thumbnailControl.MouseDown += ThumbnailControl_MouseDown; m_thumbnailControl.MouseMove += ThumbnailControl_MouseMove; m_thumbnailControl.MouseUp += ThumbnailControl_MouseUp; m_thumbnailControl.MouseLeave += ThumbnailControl_MouseLeave; // split m_splitContainer = new SplitContainer(); m_splitContainer.Name = "Resources".Localize(); m_splitContainer.Orientation = Orientation.Vertical; m_splitContainer.Panel1.Controls.Add(m_treeControl); m_splitContainer.Panel2.Controls.Add(m_thumbnailControl); m_splitContainer.Panel2.Controls.Add(m_listView); m_splitContainer.SplitterDistance = 10; m_listView.Hide(); Image resourceImage = ResourceUtil.GetImage16(Sce.Atf.Resources.ResourceImage); // on initialization, register our tree control with the hosting service m_controlHostService.RegisterControl( m_splitContainer, new ControlInfo( "Resources".Localize(), "Lists available resources".Localize(), StandardControlGroup.Left, resourceImage), this); m_thumbnailService.ThumbnailReady += ThumbnailManager_ThumbnailReady; Application.ApplicationExit += delegate { foreach (var item in m_thumbnailControl.Items) { if (item.Image != null) { item.Image.Dispose(); } } m_thumbnailControl.Items.Clear(); }; m_mainForm.Loaded += delegate { m_splitContainer.SplitterDistance = m_splitterDistance; }; RegisterCommands(); RegisterSettings(); }
public TerrainEditorControl() { InitializeComponent(); int itemHieght = m_header + m_thumbSize + 6; m_decoList.ItemHeight = itemHieght; m_layerList.ItemHeight = itemHieght; m_decoList.DrawItem2 += DrawItem; m_layerList.DrawItem2 += DrawItem; m_addBtn.Image = ResourceUtil.GetImage16(ATFResources.AddImage); m_deleteBtn.Image = ResourceUtil.GetImage16(ATFResources.RemoveImage); m_moveUpBtn.Image = ResourceUtil.GetImage16(ATFResources.ArrowUpImage); m_moveDownBtn.Image = ResourceUtil.GetImage16(ATFResources.ArrowDownImage); Application.Idle += (sender, e) => { UpdateButtonStatus(); }; m_thumbnailReslovers = Globals.MEFContainer.GetExportedValues <IThumbnailResolver>(); // create no-tex bmp. m_noTexBmp = new Bitmap(m_thumbSize, m_thumbSize); Graphics g = Graphics.FromImage(m_noTexBmp); StringFormat strFormat = new StringFormat(); strFormat.Alignment = StringAlignment.Center; strFormat.LineAlignment = StringAlignment.Center; g.Clear(Color.White); Rectangle texRect = new Rectangle(0, 0, m_noTexBmp.Width, m_noTexBmp.Height); g.DrawString("No\n\rTexture", Font, Brushes.Red, texRect, strFormat); strFormat.Dispose(); g.Dispose(); m_flattenRdo.Text = "Flatten".Localize(); m_flattenRdo.Tag = new FlattenBrush(m_flattenRdo.Text); m_brushRiseLowRdo.Text = "Raise/Lower".Localize(); m_brushRiseLowRdo.Tag = new RaiseLowerBrush(m_brushRiseLowRdo.Text); m_brushSmoothRdo.Text = "Smooth".Localize(); m_brushSmoothRdo.Tag = new SmoothenBrush(m_brushSmoothRdo.Text); m_noiseRdo.Text = "Noise".Localize(); m_noiseRdo.Tag = new NoiseBrush(m_noiseRdo.Text); m_paintEraseRdo.Text = "Paint/Erase".Localize(); m_paintEraseRdo.Tag = new PaintEraseBrush(m_paintEraseRdo.Text); SizeChanged += (sender, e) => { m_propertyGrid.Width = Width - m_propertyGrid.Left; m_brushProps.Width = Width - m_brushProps.Left; }; }
/// <summary> /// Constructor</summary> public FilteredFileDialogBase() { InitializeComponent(); // Initialize ListView listView1.View = View.Details; listView1.VirtualMode = true; // virtual mode is necessary for processing large number of files in a reasonable time // Suspending automatic refreshes as items are added/removed. listView1.BeginUpdate(); listView1.Columns.Add("Name", 250, HorizontalAlignment.Left); listView1.Columns.Add("Date Modified", 130, HorizontalAlignment.Left); listView1.Columns.Add("Size", listView1.Width - 250 - 130 - 20, HorizontalAlignment.Right); listView1.ColumnClick += listView1_ColumnClick; m_listViewItemComparer = new ListViewItemComparer(); listView1.SmallImageList = new ImageList(); listView1.SmallImageList.Images.Add(ResourceUtil.GetImage16(Resources.FolderIcon)); listView1.SmallImageList.Images.Add(ResourceUtil.GetImage16(Resources.DocumentImage)); listView1.SmallImageList.Images.Add(ResourceUtil.GetImage16(Resources.DiskDriveImage)); listView1.SmallImageList.Images.Add(ResourceUtil.GetImage16(Resources.ComputerImage)); listView1.LargeImageList = new ImageList(); listView1.LargeImageList.Images.Add(ResourceUtil.GetImage32(Resources.FolderImage)); listView1.LargeImageList.Images.Add(ResourceUtil.GetImage32(Resources.DocumentImage)); listView1.LargeImageList.Images.Add(ResourceUtil.GetImage32(Resources.DiskDriveImage)); listView1.DoubleClick += listView1_DoubleClick; listView1.VirtualItemsSelectionRangeChanged += listView1_VirtualItemsSelectionRangeChanged; listView1.SelectedIndexChanged += listView1_SelectedIndexChanged; listView1.AfterLabelEdit += listView1_AfterLabelEdit; listView1.RetrieveVirtualItem += listView1_RetrieveVirtualItem; listView1.CacheVirtualItems += listView1_CacheVirtualItems; // Re-enable the display. listView1.EndUpdate(); toolStripButton1.Click += backButton_Click; toolStripButton2.Click += upButton_Click; toolStripButton3.Click += newFolder_Click; fileTypeComboBox.DropDownStyle = ComboBoxStyle.DropDownList; fileTypeComboBox.SelectedIndexChanged += fileTypeComboBox_SelectedIndexChanged; fileNameComboBox.SelectedIndexChanged += fileNameComboBox_SelectedIndexChanged; fileNameComboBox.PreviewKeyDown += fileNameComboBox_PreviewKeyDown; fileNameComboBox.TextChanged += fileNameComboBox_TextChanged; lookInComboBox.SelectedIndexChanged += path_SelectedIndexChanged; lookInComboBox.DrawMode = DrawMode.OwnerDrawFixed; lookInComboBox.DrawItem += lookInComboBox_DrawItem; m_timer = new Timer { Interval = SELECTION_DELAY }; // timer is needed to avoid excessive delay of fileNameComboBox update when large number of files are selected m_timer.Tick += timer_Tick; this.Load += fileDialogBase_Load; m_backgroundWorker = new BackgroundWorker(); m_backgroundWorker.WorkerSupportsCancellation = true; m_backgroundWorker.DoWork += backgroundWorker_DoWork; // cache time-consuming ListView file information items asynchronously }