Windows Develop Bookmark and Share   
 index > Windows Forms Designer > how to add one more control in open dialog box
 

how to add one more control in open dialog box

hi
i need to add one more button or label in open dialog box, how can i do it. can we add some more controls in file open dialog box?

thanks in advance.
Prashant Malviya  Wednesday, February 18, 2009 10:56 AM
Hi Prashant,

To add controls on the OpenFileDialog, you must extend the OpenFileDialog.However, the OpenFileDialog class in .NET Framework in sealed which means we cannot derive from this class. OpenFileDialog is not a native implementation in .NET, instead it makes use of a Win32 API "GetOpenFileName".

Generally there're two ways to extend the OpenFileDialog:
1. Derive from the CommonDialog class and make use of the Win32 API GetOpenFileName function to implement the OpenFileDialog function.
2. Hack the OpenFileDialog and add the function you need to it.

The following is a sample on how to do the above second option:
http://www.codeproject.com/KB/dialog/CustomizeFileDialog.aspx

Hope this helps.

Sincerely,
Linda Liu
Linda Liu  Friday, February 20, 2009 6:17 AM
Hi Prashant,

To add controls on the OpenFileDialog, you must extend the OpenFileDialog.However, the OpenFileDialog class in .NET Framework in sealed which means we cannot derive from this class. OpenFileDialog is not a native implementation in .NET, instead it makes use of a Win32 API "GetOpenFileName".

Generally there're two ways to extend the OpenFileDialog:
1. Derive from the CommonDialog class and make use of the Win32 API GetOpenFileName function to implement the OpenFileDialog function.
2. Hack the OpenFileDialog and add the function you need to it.

The following is a sample on how to do the above second option:
http://www.codeproject.com/KB/dialog/CustomizeFileDialog.aspx

Hope this helps.

Sincerely,
Linda Liu
Linda Liu  Friday, February 20, 2009 6:17 AM

You can use google to search for other answers

Custom Search

More Threads

• Replace cell of propertygrid with custum Textbox
• Designer Host Max No of Objects, Controls Resize Problem
• Clear all Winform controls on Winform
• Best way to substitute customized datagridview for standard datagridview??
• Data binding in Win Forms
• the datagrid columns backcolor did not take effect c# 2005
• Custom Title Bar and Bigger Scrollbar buttons
• ComboBox in a DesignerActionItemCollection
• Transparency - Controls on top of controls just makes a hole in the windows form
• Has the Ctrl+Tab behavior changed in visual studio?