Re: Graphics objects --- passing the object vs the handle
- From: "Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 21 Apr 2007 12:32:01 +0200
I think rendering to a bitmap and then painting that with GDI+ is the only way to go. I don't see why you think the result will be poor.. Am I missing something important?
--
--
Bob Powell [MVP]
Visual C#, System.Drawing
Ramuseco Limited .NET consulting
http://www.ramuseco.com
Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm
Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm
All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
"Michael C" <nospam@xxxxxxxxxx> wrote in message news:%23sSLbhWgHHA.668@xxxxxxxxxxxxxxxxxxxxxxx
"Jeff" <jrush@xxxxxxx> wrote in message news:1176841241.275965.313110@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxI have designed a set of classes which all accept a graphics object
and then render lines, rectanges, text, etc to that object. There is
a "parent" class which controls the instantiation of each class and
also calls the render method for each class, passing the form's
graphic object. This parent class also controls the zooming in/out
via a matrix. Everything works wonderfully.
I now have a need for an additional class which will accept a PDF file
and render it onto the same form. I want to build this class just
like the others, which means giving it a method which accepts a
Graphics object. I'm using a 3rd party control by Visage as part of
this new class. This Visage control even has a method called
"PaintToDC". The documentation for this method is as follows:
"PaintToDC (DC: HDC; em11, em12, em21, em22, dx, dy: Double)
Render the current page to the device context specifed from DC
parameter.the additional
parameters are for specifying the tranformation matrix used for
rendering.
By using transformation matrixes you will be able to scale/rotate/skew
etc the rendered page.
The default transformation matrix is 1,0,0,1,0,0"
The Problem: This control does not mesh with my current setup. The
"paint" does not scroll like the other classes. Is this because I'm
doing a GetHDC and then a ReleaseHDC on the Graphics object as opposed
to simply passing the Graphics object ByRef? If so, is there
something I can do within my "parent" class which will force this
Visage control to behave like my other classes when it comes to
scrolling and zooming?
AFAIK, you're stuck. It looks like the control does not use GDI+ which is what is needed to use matrix transforms. It appears the control is using plain old GDI which simply does not support this feature. You could paint to a bitmap and then paint that bitmap to the form but the result will be poor. The only solution I can think of is to find a control that does support GDI+ but I don't think that's going to be easy.
BTW, you should pass objects around ByVal generally.
Michael
.
- Follow-Ups:
- Re: Graphics objects --- passing the object vs the handle
- From: Michael C
- Re: Graphics objects --- passing the object vs the handle
- References:
- Graphics objects --- passing the object vs the handle
- From: Jeff
- Re: Graphics objects --- passing the object vs the handle
- From: Michael C
- Graphics objects --- passing the object vs the handle
- Prev by Date: Re: imprecise Graphics.RotateTransform
- Next by Date: Re: imprecise Graphics.RotateTransform
- Previous by thread: Re: Graphics objects --- passing the object vs the handle
- Next by thread: Re: Graphics objects --- passing the object vs the handle
- Index(es):
Relevant Pages
|