draw inverted rectangle

  • Thread starter Thread starter meicher
  • Start date Start date
M

meicher

Hello,
There exists a very good methode in C++ and MFC:
pDC->invertRectangle(pRec);
Is there any simular methode in C# and .Net ?
How can I use the API function <invertRectangle> in C# ?
Regards mike. :?:
 
This should work for you

Add this:

[DllImport("user32.dll")]
[return:MarshalAs(UnmanagedType.Bool)]
public static bool InvertRect(IntPtr hDC, ref System.Drawing.Rectangle
lprc);

and call it like this

Graphics g = /* a valid graphics object */
Rectangle rect = /* the area you want inverted */

bool result = InvertRect( g.GetHdc(), ref rect);



HTH
Brian W

P.S. Before anyone starts flaming me, System.Drawing.Rectangle CAN be used
in P/Invoke calls try it for yourself. Ther is no need to recreate the RECT
structure.




meicher said:
Hello,
There exists a very good methode in C++ and MFC:
pDC->invertRectangle(pRec);
Is there any simular methode in C# and .Net ?
How can I use the API function <invertRectangle> in C# ?
Regards mike. :?:
 
Back
Top