PC Review


Reply
Thread Tools Rate Thread

ListBox with horizontal scroll bar

 
 
Christian Schwarz
Guest
Posts: n/a
 
      12th Jun 2005
Hello,

I understand that the .NET CF controls are wrappers around the native Win32
controls. As the native ListBox under Windows CE seems to support a
horizontal scroll bar it should be possible to extend the .NET ListBox with
an horizontal scroll bar by using Win32 API functions.

Using the following code, I get the handle of my ListBox.

[DllImport("coredll.dll")]
static extern IntPtr GetCapture();

....
myListBox.Capture = true;
IntPtr hWndListBox = GetCapture();
....

The following code enables the horizontal scroll bar by setting the
WS_HSCROLL window style.

[DllImport("coredll.dll")]
static extern uint GetWindowLong(IntPtr hwnd, int index);
[DllImport("coredll.dll")]
static extern void SetWindowLong(IntPtr hwnd, int index, uint value);

....
uint windowLong = GetWindowLong(hWndListBox, -16) | 0x00100000;
SetWindowLong(hWndListBox, -16, windowLong);
....

Now that the horizontal scroll bar is visible one can use SetScrollInfo API
function to set the minimum, maximum and current scroll position. Although
setting the scroll position works, the scrolling of the ListBox content
doesn't work.

What could be the reason? Who is responsible for doing the actual scrolling?
The native Win32 ListBox control? Is there a general problem with my
approach?

Greetings, Christian


 
Reply With Quote
 
 
 
 
=?Utf-8?B?QWxleCBZYWtobmluIFtNVlBd?=
Guest
Posts: n/a
 
      13th Jun 2005
Just send the LB_SETHORIZONTALEXTENT message after you modified the style:

const int LB_SETHORIZONTALEXTENT = 0x194;

SendMessage(hWndListBox, LB_SETHORIZONTALEXTENT, 250, 0);


--
Alex Yakhnin, .NET CF MVP
www.intelliprog.com | www.opennetcf.org


"Christian Schwarz" wrote:

> Hello,
>
> I understand that the .NET CF controls are wrappers around the native Win32
> controls. As the native ListBox under Windows CE seems to support a
> horizontal scroll bar it should be possible to extend the .NET ListBox with
> an horizontal scroll bar by using Win32 API functions.
>
> Using the following code, I get the handle of my ListBox.
>
> [DllImport("coredll.dll")]
> static extern IntPtr GetCapture();
>
> ....
> myListBox.Capture = true;
> IntPtr hWndListBox = GetCapture();
> ....
>
> The following code enables the horizontal scroll bar by setting the
> WS_HSCROLL window style.
>
> [DllImport("coredll.dll")]
> static extern uint GetWindowLong(IntPtr hwnd, int index);
> [DllImport("coredll.dll")]
> static extern void SetWindowLong(IntPtr hwnd, int index, uint value);
>
> ....
> uint windowLong = GetWindowLong(hWndListBox, -16) | 0x00100000;
> SetWindowLong(hWndListBox, -16, windowLong);
> ....
>
> Now that the horizontal scroll bar is visible one can use SetScrollInfo API
> function to set the minimum, maximum and current scroll position. Although
> setting the scroll position works, the scrolling of the ListBox content
> doesn't work.
>
> What could be the reason? Who is responsible for doing the actual scrolling?
> The native Win32 ListBox control? Is there a general problem with my
> approach?
>
> Greetings, Christian
>
>
>

 
Reply With Quote
 
Christian Schwarz
Guest
Posts: n/a
 
      14th Jun 2005
> Just send the LB_SETHORIZONTALEXTENT message after you modified the style:
>
> const int LB_SETHORIZONTALEXTENT = 0x194;
>
> SendMessage(hWndListBox, LB_SETHORIZONTALEXTENT, 250, 0);


Many thanks, that solved my problem!

Greetings, Christian


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
getting a horizontal scroll bar in listbox jmoffat Microsoft Excel Programming 1 3rd Mar 2006 02:24 PM
Listbox horizontal scroll bar Max Microsoft Dot NET 0 3rd Nov 2005 11:08 PM
Listbox horizontal scroll bar Max Microsoft C# .NET 0 3rd Nov 2005 11:08 PM
listbox horizontal scroll? Tina Microsoft ASP .NET 2 2nd Oct 2004 02:52 AM
Horizontal Scroll Bar for listbox Lloyd Sheen Microsoft ASP .NET 2 1st Nov 2003 01:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:03 AM.