|
-
Mar 13th, 2008, 03:55 AM
#1
Thread Starter
Addicted Member
[RESOLVED] [2008] ListBox DrawItem Horizontal scrollbar
Hi,
As the title suggests, I'm using VB.NET 2008, and I've got a problem with a disappearing horizontal scrollbar on a ListBox where I'm using the DrawItem event. DrawItem is set to OwnerDrawFixed.
I think I know WHY I'm not seeing the scrollbar, but I can't figure out how to fix it. I may have to use a DataGridView, but I'd prefer to understand the solution to the ListBox problem.
What I think is happening is this line is filling my rectangle with my brush to the boundary of the rectangle:
Code:
e.Graphics.FillRectangle(myBrush, e.Bounds)
The line is filling the rectangle with my data:
Code:
e.Graphics.DrawString(Me.lstReportContent.Items(e.Index), e.Font, myBrush, New RectangleF(e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height))
I've seen that I can reduce e.Bounds.Width, and each line is cut short. Naturally, I'd have thought that if I increase e.Bounds.Width, the item line would be longer than the visible rectangle width.
-
Mar 13th, 2008, 07:20 AM
#2
Re: [2008] ListBox DrawItem Horizontal scrollbar
You need to set the HorizontalExtent property of the control to trigger the drawing of the scroll bar, which I discovered from the second result returned by a Google search for listbox ownerdraw scrollbar.
-
Mar 13th, 2008, 09:03 AM
#3
Thread Starter
Addicted Member
Re: [2008] ListBox DrawItem Horizontal scrollbar
Thanks.
Was listbox ownerdraw scrollbar the first thing you searched for?
-
Mar 13th, 2008, 05:44 PM
#4
Re: [2008] ListBox DrawItem Horizontal scrollbar
 Originally Posted by penguin5000
Thanks.
Was listbox ownerdraw scrollbar the first thing you searched for?
As a matter of fact it was. It seemed the logical choice as you were looking for information about a scrollbar in a listbox that was owner-drawn.
-
Mar 14th, 2008, 03:58 AM
#5
Thread Starter
Addicted Member
Re: [RESOLVED] [2008] ListBox DrawItem Horizontal scrollbar
I guess its all about what you search for.
The search technique that I failed with was pretty much as per my title, i.e. different combinations of ListBox DrawItem Horizontal scrollbar. There were lots of occurrences of the problem, but no real solution.
Anyway, problem solved. Thanks again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|