|
|
|
The CommonDialog control doesn't provide any direct way to decide where a common dialog appears on the screen. In all cases, in fact, the control tries to display the common dialog centered on its owner form. This behavior suggests a simple way to affect the approximate position of the common dialog.
The trick is simple: instead of using a CommonDialog control on the current form, you place the CommonDialog control on another form. This form will be always invisible, and its only purpose is to affect where the common dialog be be displayed.
Create a form, name it frmCD, and place a CommonDialog control on it. Then, run the following code from another form when you want to display the Color common dialog in the upper-left corner of the screen: |
Similarly, here's how you display the common dialog approximately at the center of the screen: |
Note that this method lets you affect the position of the common dialog only approximately. For a more precise placement you must resort to more advanced techniques, such as subclassing.
|
|
|
|
Submitted By :
Nayan Patel
(Member Since : 5/26/2004 12:23:06 PM)
|
|
|
Job Description :
He is the moderator of this site and currently working as an independent consultant. He works with VB.net/ASP.net, SQL Server and other MS technologies. He is MCSD.net, MCDBA and MCSE. In his free time he likes to watch funny movies and doing oil painting. |
View all (893) submissions by this author
(Birth Date : 7/14/1981 ) |
|
|