Discussion:
CScrollView behaves different on XP than on Vista .
(too old to reply)
Vilhelm
2007-08-05 14:06:02 UTC
Permalink
Hello,

I have an old MFC application that I want to run on Vista.

I compile it in VS2005 with MFC80.
It is written in C++, and I use the the compiler option clr:oldsyntax to
make it work.

It runs fine on XP, but when I try to run this on Vista I get some problems
with drawing into a CScrollView object.
When the scrollposition is at 0,0 it looks fine, but when I start to scroll
down coordinates are messed up and things are drawn in wrong positions.
I use the following drawing commands:
CWnd::GetClientRect()
CDC:FillRect()
CDC:FrameRect()
CDC:DrawText()
CSrcollView::GetDeviceScrollPosition()

When debugging the coordinates I get from GetClientRect and
GetDeviceScrollPosition, they are the same on XP and Vista, but it seems like
the drawing commands handle them differently.

Has there been any changes to the Windows SDK on Vista that is making this
happen?

Thankful for any help.

-- Vilhelm Heiberg
Vilhelm
2007-08-05 14:26:01 UTC
Permalink
Here are some important details that I forgot to mention in the previous post

I also pass the pDC->m_hDC to some C# code that uses GDI+ to draw images.
It seems that after GDI+ has used the DC and control is passed back to C++
something is messed up in the DC.

Here is the C# code that uses the DC to draw an image:

public void Draw(IntPtr hDC, Bitmap bitmap, Rectangle rect)
{
Graphics g = Graphics.FromHdc(hDC);
g.SmoothingMode = SmoothingMode.AntiAlias;
g.CompositingQuality = CompositingQuality.HighQuality;
g.DrawImage(bitmap, rect);
}

-- Vilhelm
Post by Vilhelm
Hello,
I have an old MFC application that I want to run on Vista.
I compile it in VS2005 with MFC80.
It is written in C++, and I use the the compiler option clr:oldsyntax to
make it work.
It runs fine on XP, but when I try to run this on Vista I get some problems
with drawing into a CScrollView object.
When the scrollposition is at 0,0 it looks fine, but when I start to scroll
down coordinates are messed up and things are drawn in wrong positions.
CWnd::GetClientRect()
CDC:FillRect()
CDC:FrameRect()
CDC:DrawText()
CSrcollView::GetDeviceScrollPosition()
When debugging the coordinates I get from GetClientRect and
GetDeviceScrollPosition, they are the same on XP and Vista, but it seems like
the drawing commands handle them differently.
Has there been any changes to the Windows SDK on Vista that is making this
happen?
Thankful for any help.
-- Vilhelm Heiberg
Loading...