.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

ColorDialog

10 REPLIES 10
SOLVED
Reply
Message 1 of 11
matus.brlit
838 Views, 10 Replies

ColorDialog

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

 

10 REPLIES 10
Message 2 of 11

Hi, which version of AutoCAD are you using? I cannot see this behavior on 2012/Win7

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 3 of 11
HomeBoyLV
in reply to: matus.brlit

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

Message 4 of 11
quigs
in reply to: matus.brlit

I

 have the exact same problem.  I am running Autocad 2011

My name is Martin.. 😄
Message 5 of 11
matus.brlit
in reply to: matus.brlit

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

Message 6 of 11

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

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 7 of 11

Augusto, are you trying to reproduce it on AutoCAD 2011?

 

i will extract the code from my project, so i can upload it

Message 8 of 11
matus.brlit
in reply to: matus.brlit

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

Message 9 of 11

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?

Regards,



Augusto Goncalves
Twitter @augustomaia
Autodesk Developer Network
Message 10 of 11

thank you, it works perfect

Message 11 of 11
quigs
in reply to: augusto.goncalves

****,

That won't help me, as I have 450 picture boxes calling a color pallete.

Thanks as well any way for the help!

My name is Martin.. 😄

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost