I use common dialog. How to make it center?
Code:CommonDialog5.ShowColor
Printable View
I use common dialog. How to make it center?
Code:CommonDialog5.ShowColor
I don't think this is that easy. It might need subclassing.
When I click at green book, the common dialog appear on the top of the form. How to make it appear on the center of the screen?
Put 'SetHook' in the Form_Load event.
Put 'ReleaseHook' in the Form_Unload event.
This will give you everything.
http://vbnet.mvps.org/code/hooks/cho...rcustomize.htm
It good but have problemQuote:
Originally Posted by Chris001
I have try this..When I run, the common dialog appear on the center. But When I try end the project, the program hang.. What the cause of this problem?
There are 3 possibilities that I can think of..
- You didn't "Put 'ReleaseHook' in the Form_Unload event.", as Chris001 specified.
- You aren't unloading the form properly (perhaps by using the evil "End" command), so the Form_Unload event is not running.
- The code that Chris001 provided has issues (I've had a quick look, and it seems fine).
Based on how often we see it, I would expect number 2 to be the issue. To check if it is, put a MsgBox at the start of the Form_Unload event - if it doesn't show, you aren't closing your form properly.
I used this button to end the programQuote:
Originally Posted by si_the_geek
That is basically the same thing as the "End" command, and should not really be used (in any situation) unless you have no other alternative - like if your code is stuck in an infinite loop.
In cases where you are using sub-classing (as you are here), it results in an obvious crash.. but in many cases it will do permanent damage that you don't notice until it is too late (like corrupting databases that you are connected to).
Check out this link
http://www.vbaccelerator.com/codelib/cmdlgd/cmdlgct.htm
hope this helps