when i use Autodesk.AutoCAD.Windows.ColorDialog from a modeless form, the colordialog doesn't get focus, so you have to click twice to pick the color (the first click only sets focus to the dialog)
when i put the same code in a command and run it from commandline, it gets focus
Dim cd As New Autodesk.AutoCAD.Windows.ColorDialog If cd.ShowDialog <> Windows.Forms.DialogResult.OK Then Exit Sub
Solved! Go to Solution.
Solved by augusto.goncalves. Go to Solution.
Hi, which version of AutoCAD are you using? I cannot see this behavior on 2012/Win7
Try this
myPalette.KeepFocus = False
Dim cd As New Autodesk.AutoCAD.Windows.ColorDialog
Dim dr as DialogResult = cd.ShowDialog
MyPalette.KeepFocus = True
If dr <> Windows.Forms.DialogResult.OK Then Exit Sub
Hav'nt done any palette programming lately, but last time I did, you needed to manage the focus yourself for the palette. Should be plenty of examples, just search on the 'KeepFocus'.'
HomeBoy Out
I
have the exact same problem. I am running Autocad 2011
to augusto: I'm using AutoCAD 2011, i will try it in 2012, but i don't have it installed here
to HomeBoy: I'm not opening the ColorDialog from palette, but from the Windows.Form
hi,
I could not repro this here...I tried with modeless form using Application.ShowModelessDialog and Form.ShowDialog, but the ColorDialog is always working fine....if you manage to have a sample uploaded, I can take a look.
HomeBoy: I believe the issue you´re talking is related to combo boxes on palettes, not the case here. Or do you have something different?
Augusto Goncalves
Autodesk Developer Network
Augusto, are you trying to reproduce it on AutoCAD 2011?
i will extract the code from my project, so i can upload it
i found out, that it works fine, when i open the ColorDialog d\from button.click event, but wrong, when i open it from imagebox.click event
you can test it from the attached project
I can see it now...
Apparently there is a limitation with PictureBox: it cannot receive focus. It seems that this is causing the problem we see here, so I would suggest you use a flat button with no border, which is visually equal a picturebox, but can receive focus and work in this case.
How that sounds?
****,
That won't help me, as I have 450 picture boxes calling a color pallete.
Thanks as well any way for the help!