Working on an incremental drawing algorithm I am facing a problem PInvoking
ScrollWindowEx:
The code is as follows...
C#:
[DllImport("user 32.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.ClientRect angle.X - hScrollBar.Valu e,
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 4828
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("user 32.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.ClientRect angle.X - hScrollBar.Valu e,
| 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******** ******@TK2MSFTN GP10.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("user 32.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.ClientRect angle.X - hScrollBar.Valu e, | 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******** ******@TK2MSFTN GP10.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("user 32.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.ClientRect angle.X - hScrollBar.Valu e,
| > | 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 ScrollWindowEx (IntPtr handle, int dx, int dy, Rectangle
lprcScroll , Rectangle lprcClip, IntPtr hrgnUpdate, out Rectangle
lprcUpdate, int fuScroll);
|
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 send to back feature etc.
How can I do this .. where should I start?
|
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 get the best performance for the utility class, its members, as well as
the System.Drawing.Graphics object, are static:
|
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 - I tried using Handle but
nothing happens
Can anyone shed some light on how to use this function or give an example?
Many Thanks
TBS
|
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 is my code:
Public Class Win32
| |
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, when I did this I got the
following error:
'System.Drawing.Image.Image()' is inaccessible due to its protection level
Looking at other online examples, I found that the proper way to use it is
like this:
|
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 am wanting to draw my own non-client area (including the scrollbar).
I have had the following ideas but each idea has failed:
|
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 line is added after a very small delay.
2-Because I use AddLine(), it adds very short lines from one point to another and it does not give a very good result. Also because of this and my "not real time" problem, when the mouse moves fast it adds...
|
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 response object but how do I write it to screen?
Dim objBitmap As New System.Drawing.Bitmap(400, 440)
Dim objGraphics As System.Drawing.Graphics
objGraphics = System.Drawing.Graphics.FromImage(objBitmap)
objGraphics.Clear(Drawing.Color.White)
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |