// Constructor. public FileIconListBox(FileDialogForm dialog) { // Set the appropriate style properties for this control. this.dialog = dialog; ForeColor = SystemColors.WindowText; BackColor = SystemColors.Window; BorderStyleInternal = BorderStyle.Fixed3D; ResizeRedraw = true; TabStop = true; // Create the horizontal scroll bar and position it. scrollBar = new HScrollBar(); scrollBar.ForeColor = SystemColors.ControlText; scrollBar.BackColor = SystemColors.Control; scrollBar.Visible = false; scrollBar.Dock = DockStyle.Bottom; scrollBar.TabStop = false; scrollBar.ValueChanged += new EventHandler(ViewScrolled); Controls.Add(scrollBar); // Load the icons. We need icons for drives and links. icons = new Icon [IconCode_Num]; icons[0] = new Icon(typeof(FileDialog), "small_folder.ico"); icons[1] = new Icon(typeof(FileDialog), "small_folder.ico"); icons[2] = new Icon (typeof(FileDialog), "small_document.ico"); icons[3] = new Icon (typeof(FileDialog), "small_document.ico"); icons[4] = new Icon (typeof(FileDialog), "small_application.ico"); icons[5] = new Icon (typeof(FileDialog), "small_dll.ico"); icons[6] = new Icon (typeof(FileDialog), "small_text.ico"); }
internal override DialogResult RunDialog(IWin32Window owner) { // If the dialog is already visible, then bail out. if(form != null) { return DialogResult.Cancel; } // Construct the file dialog form. form = new FileDialogForm(this); // Run the dialog and get its result. DialogResult result; try { result = form.ShowDialog(owner); } finally { form.DisposeDialog(); form = null; } // Return the final dialog result to the caller. return result; }