473,625 Members | 2,658 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Handling Listbox DrawItem event, now Horizontal scrollbar is broken ???

I am handling the Listbox DrawItem event to enable the listbox strings to be
displayed in different colours for easy reading.

Have set ScrollAlwaysVis ible and HorizontalScrol lbar to true.

I Anchor the listbox T, L, R, B on the parent form

The string items held within the listbox are quite big, much longer than
could be displayed within the Listbox display area.

When I expand the parent form then more of the string is displayed.

Problem is the Horizontal scroolbar may as well not be there as it constantly
implies there is nothing outside the display area, to display.

Do I need to handle this somehow within the DrawItem event ????

--
Message posted via http://www.dotnetmonster.com
May 16 '06 #1
2 8885
Paul,

I don't know if it helps, but set the DrawMode to OwnerDrawVariab le and
handle the MeasureItem event.

In this case the list box will have all information on the size of the items
and probably will update the scrollbar accordingly.

BTW I didn't quite understand what is the problem with the scrollbar.
--
HTH
Stoitcho Goutsev (100)

"Paul_Madde n via DotNetMonster.c om" <u21795@uwe> wrote in message
news:60556bebe8 bab@uwe...
I am handling the Listbox DrawItem event to enable the listbox strings to
be
displayed in different colours for easy reading.

Have set ScrollAlwaysVis ible and HorizontalScrol lbar to true.

I Anchor the listbox T, L, R, B on the parent form

The string items held within the listbox are quite big, much longer than
could be displayed within the Listbox display area.

When I expand the parent form then more of the string is displayed.

Problem is the Horizontal scroolbar may as well not be there as it
constantly
implies there is nothing outside the display area, to display.

Do I need to handle this somehow within the DrawItem event ????

--
Message posted via http://www.dotnetmonster.com

May 16 '06 #2
Hoi Stoitcho.

Have actually tried the approach you suggested but no joy. The problem is the
following. If my Items (strings) are much too long to be displayed within the
Listbox display window, the scrollbar area is present on the bottom of the
display area, but there is NO scrollbar proper within the scrollbar area,
implying all data for the Items is visible already in the Listbox display
area. When I set the DrawMode to Normal, the slidebar works as expected. As I
say I did try the DrawMode OwnerDrawVariab le technique and handle the
MeasureItem event correctly, but still no proper scrollbar support. The
Vertical scrollbar works perfectly fine.

Many thanks for your help and if you can think of anything else (maybe this
is a bug !!) I would appreciate it.

Paul.
Stoitcho Goutsev (100) wrote:
Paul,

I don't know if it helps, but set the DrawMode to OwnerDrawVariab le and
handle the MeasureItem event.

In this case the list box will have all information on the size of the items
and probably will update the scrollbar accordingly.

BTW I didn't quite understand what is the problem with the scrollbar.
I am handling the Listbox DrawItem event to enable the listbox strings to
be

[quoted text clipped - 14 lines]

Do I need to handle this somehow within the DrawItem event ????


--
Message posted via http://www.dotnetmonster.com
May 17 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1706
by: markusszil | last post by:
Hello all I have a fairly simple listbox into which I add, insert, and remove strings It has the following property settings HorizontalScrollbar - true HorizontalExtent - ScrollAlwaysVisible - Fals The problem I am having is that the horizontal scrollbar range doesn't work right. If I add a string, the first time the sting width exceeds the control width the bar appears, but it's off by a few pixels so the last character is...
0
1658
by: Lundy | last post by:
greetings, The listbox control on my aspx page has a vertical scrollbar. But some of the text extends beyond the right limit of the listbox. I don't see a horizontal scrollbar, and I don't see any scrollbar properties in the property sheet in vs2003. Would this be a styles item? If so, how to invoke. If not, is it possible to invoke a horizontal scrollbar? how to do that?
1
2693
by: e | last post by:
I have an ownerdrawn listbox that paints items in various colors dependant upon whether or not it has focus, selected, etc. The code that physically paints the items is in the drawItem event, and it works... the items change colors accordingly and the end result is what I expected to get. But it feels sluggish, like it's painting redundant info or too many times, or something. So I carefully debugged the drawitem event and discovered...
7
9364
by: Pachydermitis | last post by:
Hi all you Experts, I need to scroll a listbox horizontally. For the life of me I cannot get it to move. I can successfully scroll it vertically. I have the handle for the listbox and the scroll bar. I have even tried sending it vbKeyRight to no avail, but it doesn't register the key strokes. I am using lDirection = WM_HSCROLL
0
3937
by: Mr. Beck | last post by:
I have a simple application that has a listbox for displaying text in it. The functionality of it is to color particular parts of the text that is displayed from a file. I have used similar coding from http://www.dotnet247.com/247reference/msgs/12/60727.aspx as a reference for coloring the text. The problem I am having is that when the text of the listbox is longer than the size of the listbox, the horizontal scrollbar will not show up....
0
1697
by: Paul_Madden via DotNetMonster.com | last post by:
I am handling the Listbox DrawItem event to enable the listbox strings to be displayed in different colours for easy reading. Have set ScrollAlwaysVisible and HorizontalScrollbar to true. I Anchor the listbox T, L, R, B on the parent form The string items held within the listbox are quite big, much longer than could be displayed within the Listbox display area.
1
1651
by: Mae Lim | last post by:
Hi all, I have a question, how can I add an horizontal scrollbar to a listbox control? I have tried "overflow:scroll;" using <divbut the scrollbar will be display outside of the listbox. I want the scollbar within the ListBoxControl, how can that be done? Please help, thanks in advance.
0
3710
by: Mark Smith | last post by:
hi i use an ownerdraw method for coloring some items in the list different then the others. code: private void ListBoxDrawItem(object sender, DrawItemEventArgs e) { ListBox lst = (ListBox)sender;
0
1563
by: rn5a | last post by:
How do I make a ListBox display the horizontal scrollbar if the text of any of the items in the ListBox exceeds the width of the ListBox? Unlike the vertical scrollbar which gets displayed automatically if the number of items in the ListBox exceed the height of the ListBox, the horizontal scrollbar doesn't get displayed automatically when the text of any of the items in the ListBox exceeds the width of the ListBox!
0
8251
marktang
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...
0
8182
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8688
Oralloy
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...
1
8352
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7178
agi2029
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...
1
6115
isladogs
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...
0
4085
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...
0
4188
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2614
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 using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.