MFC and GDI+ - the resolution.

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



I asked a question on 16 April, and got some useful hints.
For which my thanks. I can now report the resolution for anyone
interested.
[The inspiration came from
http://www.codeproject.com:80/vcpp/gdiplus/gdipprint.asp to which a friend
pointed me.]

The problem:

Replacing

==
pDC->MoveTo(...);
pDC->LineTo(....);
===

by

===
Graphics graphics( pDC->m_hDC );
graphics.SetSmoothingMode( SmoothingModeAntiAlias );
graphics.DrawLine(....);
===

was working on any kind of DC except the printer.

The resolution:

===
Graphics graphics( pDC->m_hDC );
graphics.SetPageUnit( UnitPixel ); //***********!!!!!
graphics.SetSmoothingMode( SmoothingModeAntiAlias );
graphics.DrawLine(....);
===

(as I was using MM_TEXT in pDC) and Bob's your uncle!

[I *think* I can now carry a Graphics object throughout my complicated
drawing code in parallel with pDC and use GDI+ where desirable.] I'll may
have more problems with GDI+ in due course, but so far it is looking good.

Dave
--
David Webber
Author MOZART the music processor for Windows -
http://www.mozart.co.uk
For discussion/support see
http://www.mozart.co.uk/mzusers/mailinglist.htm




.



Relevant Pages

  • RE: Text Rendering accuracy problem in TextBox/RichTextBox
    ... The difference you see is the GDI vs GDI+ rendering. ... wrapped win32 controls which use the resolution dependent GDI. ... actually uses GDI, which will let you draw text like the RichTextBox does, ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Text Rendering accuracy problem in TextBox/RichTextBox
    ... The difference you see is the GDI vs GDI+ rendering. ... wrapped win32 controls which use the resolution dependent GDI. ... actually uses GDI, which will let you draw text like the RichTextBox does, ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Re: Printing PictureBox Image
    ... page for example the page will be around 8.5 X 11 inches at the priner ... resolution is higher the size of the file will be correspondingly higher. ... Answer those GDI+ questions with the GDI+ FAQ ... > When I try to print the image from a picturebox with: ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: struggling to save tiff as png and keep file size down
    ... Find great Windows Forms articles in Windows Forms Tips and Tricks ... Answer those GDI+ questions with the GDI+ FAQ ... the png it saves is a 1BBP and the one gdi+ saved is an 8BPP. ... x resolution: 204 ...
    (microsoft.public.dotnet.framework.drawing)
  • Re: struggling to save tiff as png and keep file size down
    ... It's possible that photoshop is saving the file in an 8 bit palettised mode with an optimised colour palette. ... Answer those GDI+ questions with the GDI+ FAQ ... x resolution: 204 ... If I resize the tiff with gdi+ and save as png ...
    (microsoft.public.dotnet.framework.drawing)