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

True Color Dialog

8 REPLIES 8
Reply
Message 1 of 9
Anonymous
510 Views, 8 Replies

True Color Dialog

I am cross posting this in a vain attempt that someone her can either help
with the following problem or show how to utilize the colordialog with
vb.net in such a way that I can access the netloaded dll as a com object for
VBA to use. Basically create a wrapper for the Truecolor dialog box so that
I can access it with VBA. It seems to be non-accessable through calling the
functions directly from VBA. Below illustrates the problem.

Has anyone successfully called the acedsetcolorDialogTrueColor function from
acad.exe with VB(A) just like the attached example with the non-true-color
color selection dialog. I understand the code will now have to have a tabs
enumerator and use the new truecolor object passed into to function but I
can not get it to work. I have spent a great deal of time trying to get
this to work and I am starting to think that it can not be done. I am
interested in knowing if anyone else has been able to use the new color
selector without the sendcommand, vlax-lisp call, custom third party com
object, or use the Microsoft version of the color selector.

I am aware of all the work arounds and other options but I am certain that
it can be used correctly with VBA and I feel that I must be missing
something. I find it very hard to believe that this is not an easy thing to
do when it is the most basic type of customization that a user will want to
make with VBA. It kind of defeats the purpose of VBA's ease of use if I
have to tap arx or .net to let a user select a true color.

At this point I am no longer looking for a code example to accomplished this
but I would like to know if anyone has been able to do this with straight
VBA. I am not looking for a hand-out (unless someone is kind enough) but it
is starting to take too much of my time getting it to work and I would
really like to know if I am wasting my efforts attempting it. At this point
I figure I could have re-invented a new version of it for my needs. I do
not have an ADN membership to tell me otherwise.

Thanks in advance

Here is the link to the method that I am referring too
http://discussion.autodesk.com/thread.jspa?messageID=5068036

--
CB
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: Anonymous

Yes you can do this. Here is one way anyway.
Someone please chime in if it's not the right way
to go about this. Simple test works fine for me.


Public Function ShowColorDialog()
Dim dlg As New Autodesk.AutoCAD.Windows.ColorDialog()
dlg.ShowDialog()
ShowColorDialog = dlg.Color().ToString()
End Function



Dim cldg As New ColorDialog_Wrapper.CDlgWrapper
Dim retCol As String
retCol = cldg.ShowColorDialog()


"CB" wrote in message
news:5301211@discussion.autodesk.com...
I am cross posting this in a vain attempt that someone her can either help
with the following problem or show how to utilize the colordialog with
vb.net in such a way that I can access the netloaded dll as a com object for
VBA to use. Basically create a wrapper for the Truecolor dialog box so that
I can access it with VBA. It seems to be non-accessable through calling the
functions directly from VBA. Below illustrates the problem.

Has anyone successfully called the acedsetcolorDialogTrueColor function from
acad.exe with VB(A) just like the attached example with the non-true-color
color selection dialog. I understand the code will now have to have a tabs
enumerator and use the new truecolor object passed into to function but I
can not get it to work. I have spent a great deal of time trying to get
this to work and I am starting to think that it can not be done. I am
interested in knowing if anyone else has been able to use the new color
selector without the sendcommand, vlax-lisp call, custom third party com
object, or use the Microsoft version of the color selector.

I am aware of all the work arounds and other options but I am certain that
it can be used correctly with VBA and I feel that I must be missing
something. I find it very hard to believe that this is not an easy thing to
do when it is the most basic type of customization that a user will want to
make with VBA. It kind of defeats the purpose of VBA's ease of use if I
have to tap arx or .net to let a user select a true color.

At this point I am no longer looking for a code example to accomplished this
but I would like to know if anyone has been able to do this with straight
VBA. I am not looking for a hand-out (unless someone is kind enough) but it
is starting to take too much of my time getting it to work and I would
really like to know if I am wasting my efforts attempting it. At this point
I figure I could have re-invented a new version of it for my needs. I do
not have an ADN membership to tell me otherwise.

Thanks in advance

Here is the link to the method that I am referring too
http://discussion.autodesk.com/thread.jspa?messageID=5068036

--
CB
Message 3 of 9
Anonymous
in reply to: Anonymous

I will give this a try. I have tried similar code but I am having trouble
creating a dll that I can use with vba after a netload. I was not sure if
there is something special that has to be done with the build to allow vba
to access the new Wrapper.

Thanks again
--
CB



"Paul Richardson" wrote in message
news:5301725@discussion.autodesk.com...
Yes you can do this. Here is one way anyway.
Someone please chime in if it's not the right way
to go about this. Simple test works fine for me.


Public Function ShowColorDialog()
Dim dlg As New Autodesk.AutoCAD.Windows.ColorDialog()
dlg.ShowDialog()
ShowColorDialog = dlg.Color().ToString()
End Function



Dim cldg As New ColorDialog_Wrapper.CDlgWrapper
Dim retCol As String
retCol = cldg.ShowColorDialog()


"CB" wrote in message
news:5301211@discussion.autodesk.com...
I am cross posting this in a vain attempt that someone her can either help
with the following problem or show how to utilize the colordialog with
vb.net in such a way that I can access the netloaded dll as a com object for
VBA to use. Basically create a wrapper for the Truecolor dialog box so that
I can access it with VBA. It seems to be non-accessable through calling the
functions directly from VBA. Below illustrates the problem.

Has anyone successfully called the acedsetcolorDialogTrueColor function from
acad.exe with VB(A) just like the attached example with the non-true-color
color selection dialog. I understand the code will now have to have a tabs
enumerator and use the new truecolor object passed into to function but I
can not get it to work. I have spent a great deal of time trying to get
this to work and I am starting to think that it can not be done. I am
interested in knowing if anyone else has been able to use the new color
selector without the sendcommand, vlax-lisp call, custom third party com
object, or use the Microsoft version of the color selector.

I am aware of all the work arounds and other options but I am certain that
it can be used correctly with VBA and I feel that I must be missing
something. I find it very hard to believe that this is not an easy thing to
do when it is the most basic type of customization that a user will want to
make with VBA. It kind of defeats the purpose of VBA's ease of use if I
have to tap arx or .net to let a user select a true color.

At this point I am no longer looking for a code example to accomplished this
but I would like to know if anyone has been able to do this with straight
VBA. I am not looking for a hand-out (unless someone is kind enough) but it
is starting to take too much of my time getting it to work and I would
really like to know if I am wasting my efforts attempting it. At this point
I figure I could have re-invented a new version of it for my needs. I do
not have an ADN membership to tell me otherwise.

Thanks in advance

Here is the link to the method that I am referring too
http://discussion.autodesk.com/thread.jspa?messageID=5068036

--
CB
Message 4 of 9
Anonymous
in reply to: Anonymous

reference the .tlb not the .dll in vba.
"CB" wrote in message
news:5302026@discussion.autodesk.com...
I will give this a try. I have tried similar code but I am having trouble
creating a dll that I can use with vba after a netload. I was not sure if
there is something special that has to be done with the build to allow vba
to access the new Wrapper.

Thanks again
--
CB



"Paul Richardson" wrote in message
news:5301725@discussion.autodesk.com...
Yes you can do this. Here is one way anyway.
Someone please chime in if it's not the right way
to go about this. Simple test works fine for me.


Public Function ShowColorDialog()
Dim dlg As New Autodesk.AutoCAD.Windows.ColorDialog()
dlg.ShowDialog()
ShowColorDialog = dlg.Color().ToString()
End Function



Dim cldg As New ColorDialog_Wrapper.CDlgWrapper
Dim retCol As String
retCol = cldg.ShowColorDialog()


"CB" wrote in message
news:5301211@discussion.autodesk.com...
I am cross posting this in a vain attempt that someone her can either help
with the following problem or show how to utilize the colordialog with
vb.net in such a way that I can access the netloaded dll as a com object for
VBA to use. Basically create a wrapper for the Truecolor dialog box so that
I can access it with VBA. It seems to be non-accessable through calling the
functions directly from VBA. Below illustrates the problem.

Has anyone successfully called the acedsetcolorDialogTrueColor function from
acad.exe with VB(A) just like the attached example with the non-true-color
color selection dialog. I understand the code will now have to have a tabs
enumerator and use the new truecolor object passed into to function but I
can not get it to work. I have spent a great deal of time trying to get
this to work and I am starting to think that it can not be done. I am
interested in knowing if anyone else has been able to use the new color
selector without the sendcommand, vlax-lisp call, custom third party com
object, or use the Microsoft version of the color selector.

I am aware of all the work arounds and other options but I am certain that
it can be used correctly with VBA and I feel that I must be missing
something. I find it very hard to believe that this is not an easy thing to
do when it is the most basic type of customization that a user will want to
make with VBA. It kind of defeats the purpose of VBA's ease of use if I
have to tap arx or .net to let a user select a true color.

At this point I am no longer looking for a code example to accomplished this
but I would like to know if anyone has been able to do this with straight
VBA. I am not looking for a hand-out (unless someone is kind enough) but it
is starting to take too much of my time getting it to work and I would
really like to know if I am wasting my efforts attempting it. At this point
I figure I could have re-invented a new version of it for my needs. I do
not have an ADN membership to tell me otherwise.

Thanks in advance

Here is the link to the method that I am referring too
http://discussion.autodesk.com/thread.jspa?messageID=5068036

--
CB
Message 5 of 9
RonnieWilkins
in reply to: Anonymous

Attached is a working example. The code was thrown together quickly but is functional.

Two things you must do in order to access a .NET class from VB:

1. You have to mark which classes should be visible to COM.
2. You have to make the .tlb. Easiest way is to check 'Register for COM Interop' on the Build tab of your Project Properties.

The way this program is written, it exposes the class to COM but we are not controlling the GUID so evertime we build, a new ID is made/versioned and we have to re-reference the dll.

In this case if you use the References dialog in VB, you will need 'ColorDialogFromVBA'

You can find a little bit of information here: http://msdn.microsoft.com/vbrun/mspress/c0961587x.pdf#search=%22.net%20%3A%20COM%20Interop%22
Ronnie Wilkins, Jr.
Message 6 of 9
Anonymous
in reply to: Anonymous

>together quickly
No, mine was quick, this is nice. I was going to play with
the return type this morning.. Thanks.
wrote in message news:5302102@discussion.autodesk.com...
Attached is a working example. The code was thrown together quickly but is
functional.

Two things you must do in order to access a .NET class from VB:

1. You have to mark which classes should be visible to COM.
2. You have to make the .tlb. Easiest way is to check 'Register for COM
Interop' on the Build tab of your Project Properties.

The way this program is written, it exposes the class to COM but we are not
controlling the GUID so evertime we build, a new ID is made/versioned and =

we have to re-reference the dll.

In this case if you use the References dialog in VB, you will need
'ColorDialogFromVBA'

You can find a little bit of information here:
http://msdn.microsoft.com/vbrun/mspress/c0961587x.pdf#search=%22.net%20%3A%20COM%20Interop%22
Message 7 of 9
Anonymous
in reply to: Anonymous

Thank you greatly for the attached example. I am having a small issue
loading the code into my editor. I am using sharpdevelop for all my .net
development and I am using the .net 1.1 framework and the older editor. I
will have to upgrade to the .net 2.0 framework and update the my editor.
Everyone at the company I am planning to distribute this code is running the
1.1 framework and I do not think that I will be able to force 250+ people to
update to 2.0. If I create the assembly with the 2.0 framework, will it run
with a desktop that is only using the 1.1 framework? Would you suggest that
I make upgrading to 2.0 a necessity to using my programs with acad 2006.

Thanks again.... your help is very much appreciated.
--
CB




wrote in message news:5302102@discussion.autodesk.com...
Attached is a working example. The code was thrown together quickly but is
functional.

Two things you must do in order to access a .NET class from VB:

1. You have to mark which classes should be visible to COM.
2. You have to make the .tlb. Easiest way is to check 'Register for COM
Interop' on the Build tab of your Project Properties.

The way this program is written, it exposes the class to COM but we are not
controlling the GUID so evertime we build, a new ID is made/versioned and =

we have to re-reference the dll.

In this case if you use the References dialog in VB, you will need
'ColorDialogFromVBA'

You can find a little bit of information here:
http://msdn.microsoft.com/vbrun/mspress/c0961587x.pdf#search=%22.net%20%3A%20COM%20Interop%22
Message 8 of 9
RonnieWilkins
in reply to: Anonymous

You should be able to start a new project in Sharpdevelop and add the existing files to the project. I do not believe I used anything specific to .NET 2.0 so once the code files are added to a 1.1 project you should be able to build.
Ronnie Wilkins, Jr.
Message 9 of 9
Anonymous
in reply to: Anonymous

I was able to create a new project in sharpdevelp and add the files. There
was one adjustment that I had to make. It may be the reason I am still
having problems. The following line would not complile with 1.1

using System.Collections.generic;

I had to change it to read

using System.Collections.Specialized

I was not sure if it was a naming convention change or what but it will now
complile. I then create the TLB file using the .net sdk tools and load
everything up. Everything seems to be good except I get an "Activex
component can't create object" error when vba tries to set cd to a New
ColorDialog. I have made sure that I am referencing and loading all of the
correct builds.

Is there anything I am missing here. Thanks
--
CB


wrote in message news:5306127@discussion.autodesk.com...
You should be able to start a new project in Sharpdevelop and add the
existing files to the project. I do not believe I used anything specific to
.NET 2.0 so once the code files are added to a 1.1 project you should be
able to build.

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