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

Change Drawing Editor Background color

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
ericdaniel
2891 Views, 7 Replies

Change Drawing Editor Background color

HI,

 

Is it possible to change the drawing editor background color via code?

 

Thanks,

 

Eric

 

7 REPLIES 7
Message 2 of 8
dan.glassman
in reply to: ericdaniel

Using COM Interop, you need:

 

Application.Preferences.Display.GraphicsWinModelBackgrndColor 

 

and/or

 

Application.Preferences.Display.GraphicsWinLayoutBackgrndColor

 

-drg

Message 3 of 8
ericdaniel
in reply to: dan.glassman

Perfect,

 

Thanks,

 

Eric

 

Message 4 of 8
e.g.
in reply to: ericdaniel

Hi,

 

is there other way to change the background, not using COM?

 

Actually I need to change the model background to different colors, to generate pictures used in a different application. If the pictures will have different colors(some black, some grey, etc) it would be easier to surf through them when finding the right one.

 

Any suggestions?

 

Thanks,

 

e.g.

Message 5 of 8
Alfred.NESWADBA
in reply to: e.g.

Hi,

 

>> is there other way to change the background, not using COM?

why don't you like to use COM?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
Ingenieur Studio HOLLAUS ... www.hollaus.at ... blog.hollaus.at ... CDay 2024
------------------------------------------------------------------------------------
(not an Autodesk consultant)
Message 6 of 8
e.g.
in reply to: ericdaniel

It is ok with COM; it is only from curiosity to know the equivalent in API

 

Thanks,

 

e.g.

Message 7 of 8
fieldguy
in reply to: e.g.

There are several posts on this topic but no examples.  I looked in the vb forum and objectarx but could not find anything I really understand.  I have Option Strict On.

 

Why doesn't this work?  bgcolor changes from 0 to 1 but the background stays black - I want it to change to red.

 

Dim prefs As Autodesk.AutoCAD.Interop.AcadPreferences = CType(Autodesk.AutoCAD.ApplicationServices.Application.Preferences, Autodesk.AutoCAD.Interop.AcadPreferences)
Dim bgcolor As UInteger = prefs.Display.GraphicsWinModelBackgrndColor
msg += "color " & bgcolor & vbLf
prefs.Display.GraphicsWinModelBackgrndColor = CType(Autodesk.AutoCAD.Interop.Common.ACAD_COLOR.acRed, UInteger)

I am creating PNGs of all blocks in any dwg file.  I get a list of blocks, insert them into a new drawing 1 at a time, and plot using publishtowebPNG.pc3.  I want to allow the user to change the background color if they want.  The PNGs will be used in other places.

Message 8 of 8
fieldguy
in reply to: fieldguy

I should have kept looking.  This works.  Don't forget to set it back to the original value.

 

Dim prefs As Autodesk.AutoCAD.Interop.AcadPreferences = CType(Autodesk.AutoCAD.ApplicationServices.Application.Preferences, Autodesk.AutoCAD.Interop.AcadPreferences)
Dim curbg As Color = ColorTranslator.FromOle(CInt(prefs.Display.GraphicsWinModelBackgrndColor))
msg += "color " & curbg.ToString & vbLf
prefs.Display.GraphicsWinModelBackgrndColor = CType(ColorTranslator.ToOle(Color.Red), UInteger)

 

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