Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Common dialog control-color dialog

Status
Not open for further replies.

bsanthu

Programmer
Oct 31, 2002
14
IN
Hi all,
I am using Microsoft common dialog control 6.0 for color dialog. When I show the color dialog using .showcolor property it is coming in the top left corner of my form. Can I position that color window where ever I want in my form. I am unable to position the window.


Any idea?

-thanks in advance
Santhakumar B

 
You have, in fact, inadvertently spotted the solution to your own problem.

What you have noticed is that the common dialog always appears at the top left of your form. More accurately, it always the top left of the common dialog is always positioned at the top left of its hosting form.

So, to get complete control of where the common dialog appears you just need an additional form (set its visible property to false, just to be on the safe side) in your project, and drop the common dialog control onto that.

Then you can do things like the following:
Option Explicit

Private Sub Command1_Click()
Form2.Top = 512 * 15 ' Value in twips
Form2.Left = 512 * 15 ' Value in twips
Form2.CommonDialog1.ShowColor 'common dialog will appear at 512,512 (pixels)
' Warning - accessing Form2's properties will cause it to Load,
' so you may need to ensure that you Unload it before exiting the program.
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top