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

Paint with GDI in the HDC acad window

9 REPLIES 9
Reply
Message 1 of 10
Anonymous
685 Views, 9 Replies

Paint with GDI in the HDC acad window

I Need to paint with GDI in the background of the map window of the current window document.
But I have an error.


I get correctly the child hWND from the current MDI document window...

Document doc = Application.DocumentManager.MdiActiveDocument;
foreach (IntPtr child in Win32.GetChildWindows(doc.Window.Handle))
{
int style = Win32.GetClassLong(child, Win32.GCL_STYLE);
if ((style&Win32.CS_OWNDC)==Win32.CS_OWNDC) // -> MAP WINDOW!!!
{
hMapView = child;
break;
}
}
and Subclass the window to catch the WM_PAINT message.

then I paint with GDI before the map window execute your paint function, but it clears the background of the window and it hides my work!
I don't get the WM_ERASEBKGND message.
How can I do it?


thanks in avance
9 REPLIES 9
Message 2 of 10
ggr
Contributor
in reply to: Anonymous

Sounds dangerous to me.

Why dont you paint to a image file and use the image as a reference?

Gertwin
Message 3 of 10
Anonymous
in reply to: Anonymous

it sounds very dangerous 🙂

I would like to avoid save the image to a file, I am developing a raster client that cosume images from a remotting imageserver .
Message 4 of 10
ggr
Contributor
in reply to: Anonymous

Maybe you can use AcDbRasterImageDef for the image definition and AcDbRasterImage as the reference in the drawing.
AcDbRasterImage is derived from AcDbEntity so AutoCAD does the drawing.

Problem with using GDI function is (besides that it is slow) that AutoCAD wil frequently update portions of the drawing area wich will wipeout your drawing.

Gertwin
Message 5 of 10
Anonymous
in reply to: Anonymous

can I override the paint function from a AcDbRasterImage ?¿

there is examples ?

tanks in avance
Message 6 of 10
ggr
Contributor
in reply to: Anonymous

No, not painting the image yourself.
It's more like the blockdefinition, blockreference relation.

The image definition is in AcDbRasterImageDef and the visible reference is AcDbRasterImage, just like a block reference.
The problem is how do you get the AcDbRasterImageDef, loading from disc is in an example: "Arx200X\samples\misc\ism"
But i think it is possible to set the image directly making use of AcDbRasterImageDef::setImage().

I
Message 7 of 10
Anonymous
in reply to: Anonymous

If you're using AutoCAD 2009, have a look at the
Transient Graphics API.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


wrote in message news:6128483@discussion.autodesk.com...
can I override the paint function from a AcDbRasterImage ?¿ there is
examples ? tanks in avance
Message 8 of 10
Anonymous
in reply to: Anonymous

Sorry to interrupt but is this something I should be looking at to help me
with my "Automation" (should have said animation) posting 02/12/2009 2:09pm?


"Tony Tanzillo" wrote in message
news:6128770@discussion.autodesk.com...
If you're using AutoCAD 2009, have a look at the
Transient Graphics API.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2009
Supporting AutoCAD 2000 through 2009

http://www.acadxtabs.com

Introducing AcadXTabs 2010:
http://www.caddzone.com/acadxtabs/AcadXTabs2010.htm


wrote in message news:6128483@discussion.autodesk.com...
can I override the paint function from a AcDbRasterImage ?¿ there is
examples ? tanks in avance
Message 9 of 10
Anonymous
in reply to: Anonymous

Uf, I am using AutoCAD 2006

But I will look this API

thank you very much
Message 10 of 10
Anonymous
in reply to: Anonymous

HI,i have the same question as you ,I would like to avoid save the image to a file, I am developing a raster client that cosume images from a remotting imageserver .
i come from China,can you help me,please?wwwqtao@qq.com,thanks!

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

Post to forums  

Autodesk Design & Make Report

”Boost