Hi Eric,
The DrawReversibleLine method simply calls Windows GDI APIs to have its
task done. Looks like this:
[UIPermission(SecurityAction.LinkDemand,
Window=UIPermissionWindow.AllWindows)]
public static void DrawReversibleLine(Point start, Point end, Color
backColor)
{
int nDrawMode = GetColorRop(backColor, 10, 7);
IntPtr handle = UnsafeNativeMethods.GetDCEx(new HandleRef(null,
UnsafeNativeMethods.GetDesktopWindow()), NativeMethods.NullHandleRef,
0x403);
IntPtr ptr2 = SafeNativeMethods.CreatePen(0, 1,
ColorTranslator.ToWin32(backColor));
int num2 = SafeNativeMethods.SetROP2(new HandleRef(null, handle),
nDrawMode);
IntPtr ptr3 = SafeNativeMethods.SelectObject(new HandleRef(null,
handle), new HandleRef(null, UnsafeNativeMethods.GetStockObject(5)));
IntPtr ptr4 = SafeNativeMethods.SelectObject(new HandleRef(null,
handle), new HandleRef(null, ptr2));
SafeNativeMethods.MoveToEx(new HandleRef(null, handle), start.X,
start.Y, null);
SafeNativeMethods.LineTo(new HandleRef(null, handle), end.X, end.Y);
SafeNativeMethods.SetROP2(new HandleRef(null, handle), num2);
SafeNativeMethods.SelectObject(new HandleRef(null, handle), new
HandleRef(null, ptr3));
SafeNativeMethods.SelectObject(new HandleRef(null, handle), new
HandleRef(null, ptr4));
SafeNativeMethods.DeleteObject(new HandleRef(null, ptr2));
UnsafeNativeMethods.ReleaseDC(NativeMethods.NullHandleRef, new
HandleRef(null, handle));
}
And the Splitter control uses a similar approach to draw the splitter (GDI
function PatBlt).
If you're familiar with some other unmanaged language (VB6 or C++), you
can
try call these functions in the exactly the same way to simulate the same
task you want to do in your project, and see if the machine still gets
hung. This way you may be able to narrow down the problem - to see if this
is .NET specific or it is in GDI.
The problem could also be caused by the video driver (I've seen cases
where
app got hung/crash while doing certain graphic operations, and the problem
gone after upgrading/downgrading the video driver). Especially if this
problem only happens on a single machine or on machines with the same
hardware/driver configuration but not reproducable on other machines.
So could you let me know whether or not the problem is reproducable on all
Vista machines with different graphic cards/drivers? If you don't have
spare machines to test, you can also try on a virtual machine.
Waiting for more information.
Regards,
Jie Wang (
[email protected], remove 'online.')
Microsoft Online Community Support
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.
Note: MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 2 business days is acceptable. Please note that each
follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions. Issues of this
nature are best handled working with a dedicated Microsoft Support
Engineer
by contacting Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/en-us/subscriptions/aa948874.aspx
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.