S
Scott Gunn
Hello all
I'm trying to use the scrollwindowex api however I have the same problem as
this guy had. There is an answer here in the reply. I just need some help
converting it to VB.Net
URL: http://www.pcreview.co.uk/forums/thread-1349023.php
I have the same problem
This works:
ScrollWindowEx(Handle, 0, 30, Rectangle.Empty, Rectangle.Empty, IntPtr.Zero,
Rectangle.Empty, 0)
This doesn't work
ScrollWindowEx(Handle, 0, 30, new Rectangle(20, 20, ClientSize.Width,
ClientSize.Height), Rectangle.Empty, IntPtr.Zero, rectangle.empty, 0)
Many Thanks
Scott
I'm trying to use the scrollwindowex api however I have the same problem as
this guy had. There is an answer here in the reply. I just need some help
converting it to VB.Net
Thanks Peter, it works. I have another question for you. What does the
clip rectangle passed on the 5th argument does?
Thanks
Tony
Peter Huang said:Hi Tony,
I consult the MSDN and find that the RECT structure required by the ?
°ScrollWindowEx¡± API is different from the class ¡°Rectangle¡±. I think
you may declare your ¡°ScrollWindowEx¡± API as follows.
public class win32
{
[DllImport("user32.dll")]
public static extern int ScrollWindowEx(
IntPtr hWnd,
int dx,
int dy,
[MarshalAs(UnmanagedType.Struct)] ref Rectangle prcScroll,
[MarshalAs(UnmanagedType.Struct)] ref Rectangle prcClip,
IntPtr hrgnUpdate,
[MarshalAs(UnmanagedType.Struct)] out Rectangle prcUpdate,
[MarshalAs(UnmanagedType.U4)] int flags);
}
Then you may invoke the API as below.
private void button1_Click(object sender, System.EventArgs e)
{
Rectangle rt = new Rectangle();
Rectangle rtout = new Rectangle(0,0,10,10);
Rectangle rtin = new
Rectangle(20,20,richTextBox1.Width,richTextBox1.He ight);
int rr=win32.ScrollWindowEx(richTextBox1.Handle,0,10,r ef rtin,ref
rt,IntPtr.Zero,out rtout,0);
System.Console.WriteLine(rr.ToString());
}
Hope this will help.
Best regards,
Peter Huang
Regards,
Peter Huang
=============
This posting is provided "AS IS" with no warranties, and confers no rights.--------------------
From: "Tony" <[email protected]>
Subject: Calling the ScrollWindowEx API
Date: Fri, 4 Jul 2003 08:45:32 +0800
Lines: 21
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.3790.0
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
Message-ID: <[email protected]>
Newsgroups: microsoft.public.dotnet.languages.csharp
NNTP-Posting-Host: cm203-168-247-148.hkcable.com.hk 203.168.247.148
Path: cpmsftngxa09.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTN GP10.phx.gbl
Xref: cpmsftngxa09.phx.gbl microsoft.public.dotnet.languages.csharp:30519
X-Tomcat-NG: microsoft.public.dotnet.languages.csharp
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.
[DllImport("user32.dll")]
private extern int ScrollWindowEx (IntPtr handle, int dx, int dy, Rectangle
lprcScroll , Rectangle lprcClip, IntPtr hrgnUpdate, out Rectangle
lprcUpdate, int fuScroll);
Rectangle rt;
// This works
ScrollWindowEx(Handle, 0, 30, Rectangle.Empty, Rectangle.Empty, IntPtr.Zero,
out rt, 0);
// This doesn't work
ScrollWindowEx(Handle, 0, 30, new Rectangle(20, 20, ClientSize.Width,
ClientSize.Height), Rectangle.Empty, IntPtr.Zero, out rt, 0);
URL: http://www.pcreview.co.uk/forums/thread-1349023.php
I have the same problem
This works:
ScrollWindowEx(Handle, 0, 30, Rectangle.Empty, Rectangle.Empty, IntPtr.Zero,
Rectangle.Empty, 0)
This doesn't work
ScrollWindowEx(Handle, 0, 30, new Rectangle(20, 20, ClientSize.Width,
ClientSize.Height), Rectangle.Empty, IntPtr.Zero, rectangle.empty, 0)
Many Thanks
Scott