Ability to switch screen colors on a button?

Ability to switch screen colors on a button?

Anonymous
Not applicable
840 Views
9 Replies
Message 1 of 10

Ability to switch screen colors on a button?

Anonymous
Not applicable
I work with my background @ color 253 because I can't see a lot of colors on a black background... but most of my colleagues can't see ANYTHING when they look at my screen because they are so used to the OTB black screen.

So I am wondering if there is a macro/lisp out there that I could use to toggle between the 2 colors when I'm trying to show someone something on my screen.

Thanks in advance!
0 Likes
841 Views
9 Replies
Replies (9)
Message 2 of 10

Anonymous
Not applicable

Yes, you can write a very simple VBA macro to
toggle the graphic background color. A quick code example:

 

''Toggle back color between black and
white

Public Sub ToggleModelSpaceBackColor()

 

    If
ThisDrawing.Application.Preferences.Display.GraphicsWinMOdelBackgrndColor=vbBlack
Then

       
ThisDrawing.Application.Preferences.Display.GraphicsWinMOdelBackgrndColor=vbWhite

    Else

       
ThisDrawing.Application.Preferences.Display.GraphicsWinMOdelBackgrndColor=vbBlack

    End If

 

End Sub

 

Then you can create toolbar button to run this
macro by a single click.

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
I
work with my background @ color 253 because I can't see a lot of colors on a
black background... but most of my colleagues can't see ANYTHING when they
look at my screen because they are so used to the OTB black screen. So I am
wondering if there is a macro/lisp out there that I could use to toggle
between the 2 colors when I'm trying to show someone something on my screen.
Thanks in advance!
0 Likes
Message 3 of 10

Anonymous
Not applicable
If I knew the first thing about VBA, which sadly I don't I could write the required macro.

Anyone want to make my Friday and whip something up?

Thanks Again!
0 Likes
Message 4 of 10

Anonymous
Not applicable
Someone correct me if I'm wrong, but the code above looks like enough to do it as is.



I'm gonna run thru this off the top of my head, so someone please correct any oversights:



Go to the Tools Drop-Down Menu in AutoCAD, select Macro, then VBA Manager, and click the New button, which will create a new code window called Global1, or some other number.

Close that dialog box and hit Alt+F11 to bring up the VBA Editor Interface.



In the Project window (top left) will be ACADProject(Global1) and its sub-item ThisDrawing.

DoubleClick ThisDrawing and a blank page will come up for code input.

Paste the code into this page and save it. Make sure you know where you're saving it, so you can find it in the next step.



In AutoCAD, enter the command APPLOAD. Navigate to where you saved the code, and select it.

Hit Load button to load for now, and/or drag the file into the suitcase to keep it loaded anytime.



Make a button (which I won't go into now) and use this macro:

-vbarun;ToggleModelSpaceBackColor;

Something like that. Customization is fun. Don't be shy - jump in and splash around a little.
0 Likes
Message 5 of 10

Anonymous
Not applicable
OK I got it all added and then created my button, assigned the macro -vbarun;ToggleModelSpaceBackColor;

Now when I hit that button it returns:

Compile Error:
Syntax Error

OK/Help

Hitting OK it brings up the VBA editor and highlights (in yellow) Public Sub ToggleModleSpaceBackColor ()


?

Thanks for educating the uneducated!
0 Likes
Message 6 of 10

Anonymous
Not applicable
I couldn't tell from your last post if you were able to run it or not, but the word Model in your last post was misspelled. You have Modle. Have you been able to run it?
0 Likes
Message 7 of 10

Anonymous
Not applicable
I just checked and the macro has it spelled right, and to answer your question no I haven't got it to run yet.
0 Likes
Message 8 of 10

Anonymous
Not applicable
I also noticed that the original code has "vbWhi te" (should be "vbWhite") and "vbBla ck" (should be "vbBlack"). Edited by: Frisby on Oct 29, 2008 1:49 PM
0 Likes
Message 9 of 10

Anonymous
Not applicable
Yep that fixed it!

Now... I want to go from Color 252 - Black. I tried substituting '252', 'Color 252 (space & no space)' for White but it then just seemed to toggle Black-Black. What am I missing to be able to switch from a Black background to Color 252?

TIA
0 Likes
Message 10 of 10

Anonymous
Not applicable

I changed my BG color to 252 and then ran the following macro:

Public Sub BGCtest()

Dim nowColor As Variant
nowColor = ThisDrawing.Application.Preferences.Display.GraphicsWinModelBackgrndColor
MsgBox (nowColor)

End Sub



The message box says that the BG color is 8684676, so replaced "vbWhite" with "8684676" and that worked.
0 Likes