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. 3 4787
Check or post your declararation of Rectangle.
Willy.
"Ivonne Riedel" <iv***********@t-online.de> wrote in message
news:dr*************@news.t-online.com...
| 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.
|
|
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]" <wi*************@telenet.be> schrieb im Newsbeitrag
news:eK**************@TK2MSFTNGP10.phx.gbl... Check or post your declararation of Rectangle.
Willy.
"Ivonne Riedel" <iv***********@t-online.de> wrote in message news:dr*************@news.t-online.com... | 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. | |
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" <iv***********@t-online.de> wrote in message
news:dr*************@news.t-online.com...
|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]" <wi*************@telenet.be> schrieb im
Newsbeitrag
| news:eK**************@TK2MSFTNGP10.phx.gbl...
| > Check or post your declararation of Rectangle.
| >
| > Willy.
| >
| > "Ivonne Riedel" <iv***********@t-online.de> wrote in message
| > news:dr*************@news.t-online.com...
| > | 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.
| > |
| > |
| >
| >
|
| This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Tony Liu |
last post by:
Hi, I am having problem to scroll only a partion of a window using the
ScrollWindowEx api function. The code is below and any help is pleased.
Thanks in advance.
private extern int...
|
by: Champika Nirosh |
last post by:
Hi,
I want to create drawing board application that can draw Line, rectagle,
circle and free hand drawing.
Each drawing need to be transparent, moveable (draggable), have bring to
front and...
|
by: Hadar |
last post by:
Hi,
I'm getting "object is currently in use elsewhere" when I use
System.Drawing.Graphics.MesureString.
This is what I do:
My controls use a utility class the helps it to mesure strings.
To...
|
by: Scott Gunn |
last post by:
I have looked all over the net for an example on how to use this function
but got no joy, lots of jargon explaining the function but no examples.
In VB.Net the hwnd has gone there was one in vb6...
|
by: Scott Gunn |
last post by:
Hello
I'm trying to scroll a region of graphics, the best way I can see is to use
the ScrollWindowEx API because it is designed for doing this
However it doesn't work correctly, Why?
Here...
|
by: Jerry J |
last post by:
I want to use the System.Drawing.Image class. According to the help file,
this is an abstract base class. Because it is supposedly abstract, I created
another class that inherits from it. However,...
|
by: evan |
last post by:
Hi,
Is anyone able to give me an example on how to scroll the contents of
a ListBox without forcing the user to click on the scroll up/down
internal buttons?
==============================
I...
|
by: YouPoP |
last post by:
I am doing an app (C# 2.0) where you can draw in a panel with your mouse in "real time". I actually have 2 problems;
1- it does not really is "real time", if your mouse move fast or very fast the...
|
by: ThatsIT.net.au |
last post by:
I have this code that writes a pie chart in a asp.net page, but I want to
use it in a server control.
When I try I get a error on the last line "Response.OutputStream"
Obviously there is no...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: Defcon1945 |
last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
| |