Re: ScrollWindowEx and drawing in C#

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Yes I do, Rectangle in System.Drawing != Rectangle in User32.
So you need to declare a structure like this:

struct Rect{
public int left;
public int top;
public int right;
public int bottom;
}

Willy.


"Ivonne Riedel" <ivonneundlars@xxxxxxxxxxx> wrote in message
news:drfsbr$ghq$00$1@xxxxxxxxxxxxxxxxxxxx
|I used the C# System.Drawing Rectangle.
| I did not make any modifications to it.
| Do you see this as the mistake?
|
| Thanks
|
| Ivonne.
|
| "Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx> schrieb im
Newsbeitrag
| news:eKrnbG$IGHA.1132@xxxxxxxxxxxxxxxxxxxxxxx
| > Check or post your declararation of Rectangle.
| >
| > Willy.
| >
| > "Ivonne Riedel" <ivonneundlars@xxxxxxxxxxx> wrote in message
| > news:dredvj$e70$01$1@xxxxxxxxxxxxxxxxxxxx
| > | Working on an incremental drawing algorithm I am facing a problem
| > PInvoking
| > | ScrollWindowEx:
| > | The code is as follows...
| > |
| > |
| > | C#:
| > | [DllImport("user32.dll")]
| > | public static extern int ScrollWindowEx(IntPtr hWnd, int
| > | dx, int dy, IntPtr scrollRect, IntPtr clipRect, IntPtr
| > | hrgn, ref Rectangle updateRect, uint flags);
| > |
| > | Rectangle update = new Rectangle();
| > |
| > | ScrollWindowEx(
| > | this.Handle,
| > | this.ClientRectangle.X - hScrollBar.Value,
| > | 0,
| > | IntPtr.Zero,
| > | IntPtr.Zero,
| > | IntPtr.Zero,
| > | ref update,
| > | 0);
| > |
| > | C++:
| > |
| > |
| >
child->ScrollWindowEx(child->fenster_pos.x-pos,0,NULL,NULL,NULL,&update,0);
| > |
| > | There is a difference in the values between calling ScrollWindowEx in
| > C++
| > | and through the PInvoke with C#.
| > | The arguments are identical but not the results (update.left,
scrolling
| > only
| > | horizontally).
| > | Can anybody identify the problem or my mistake?
| > | Thanks in advance.
| > |
| > | Ivonne.
| > |
| > |
| >
| >
|
|


.



Relevant Pages

  • Input/Output program Compiles but doesnt run
    ... This code uses the rectangle class (which I just included in the code, ... JLabel calculateArea; ... public void main throws IOException { ... public int calcPerimeter() { ...
    (comp.lang.java.help)
  • Rendering performance while dragging
    ... To move a rectangle, click inside the rectangle and drag. ... static private final Cursor rightDragCursor = ... private void setDraggedEventStart{ ...
    (comp.lang.java.gui)
  • Re: More Interop
    ... You should declare the return type as bool. ... The marshaller by default ... You need to pass the Rectangle structure by reference, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: In VB.Net How do you use the "ScrollWindowEx" function?
    ... Declare Function ScrollWindowEx Lib "user32" (ByVal hwnd As Integer, ... dx As Integer, ByVal dy As Integer, ByRef lprcScroll As Rectangle, ByRef ... lprcClip As Rectangle, ByVal hrgnUpdate As Integer, ByRef lprcUpdate As ...
    (microsoft.public.dotnet.languages.vb)
  • Re: EMF - ETO_CLIPPED flag
    ... colored rectangle that I draw is way off the text where it should be. ... } and declare the variable ... Note that you just have to move the CDC declaration and cdc.Attach lines to precede ... I'm curious why you are doing any scaling at all here. ...
    (microsoft.public.vc.mfc)