[Mono-list] Using System.Drawing.Graphics.FromHwnd without X?

Vincent Povirk madewokherd at gmail.com
Sun Oct 24 17:31:41 EDT 2010

FromHwnd(0) creates a Graphics object for drawing directly to the
screen, and I can't think of a reason for a well-behaved program to do
that. So I would say PdfSharp should not do that.

In theory, libgdiplus should be able to function without an X server
if all of the work is done on bitmaps. It should be possible to create
a bitmap and get a Graphics object for it without an X server. But I
don't know if this is true in practice.

On Sat, Oct 23, 2010 at 7:23 PM, RobWalker <Rob.Walker at cedarridge.com> wrote:
> I am running mono on EC2 and using fastcgi-mono-server2 ... mostly everything
> works great.  Part of the app uses the PdfSharp library for manipulating
> pdf's.
> PdfSharp allows for 'drawing' on a PDF page, and calls
> System.Drawing.Graphics.FromHwnd(0) as part of that code.  This is failing
> with a 'System.NotSupportedException' exception and saying "Could not open
> display (X-Server required. Check you DISPLAY environment variable)"
> libgdiplus is installed correctly  (I had different errors before I got that
> far).  Is there any way around this?
> Thanks!
> --
> View this message in context: http://mono.1490590.n4.nabble.com/Using-System-Drawing-Graphics-FromHwnd-without-X-tp3008885p3008885.html
> Sent from the Mono - General mailing list archive at Nabble.com.
> _______________________________________________
> Mono-list maillist  -  Mono-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/mono-list

More information about the Mono-list mailing list