bon j'ai fait comme ça
[Serializable, StructLayout(LayoutKind.Sequential)]
public struct RECT
{
public int Left;
public int Top;
public int Right;
public int Bottom;
public RECT(int left, int top, int right, int bottom)
{
Left = left;
Top = top;
Right = right;
Bottom = bottom;
}
}
[DllImport("user32.dll")]
private static extern bool InvertRect(IntPtr hDC, ref RECT lpRect);
plus loint je l'utilise comme ça :
private void InvertsColors(IntPtr hDC, Rectangle rect)
{
RECT r = new RECT(rect.Left, rect.Top, rect.Right, rect.Bottom);
bool result ;
result = InvertRect(hDC, ref r);
Console.WriteLine(result.ToString());
}
et la fonction est appelée comme ça :
private void picGraph_MouseDown(object sender, MouseEventArgs e)
{
base.OnMouseDown(e);
if (e.Button == MouseButtons.Left)
{
this.bSelecting = true;
InvertsColors(picGraph.Handle, picGraph.DisplayRectangle);
}
}
apparement rien ne se passe ,le résultat est tjs à false
quelqu'un peut me dire se que j'ai pu oublier.....
S.
|