Scroll buttons in my owner draw ListBox don't work

J

Jim H

I have a ListBox hold a list of my custom controls (it's UserControl based
control with a couple radio buttons and a checkbox). Everything works and
displays the way I expected it to. I can move through the list by dragging
the scroll bar and it works fine, but if I try to use the up/down scroll bar
buttons or page by clicking above or below the scroll thumb button the list
does not scroll.

Here's my OnDrawItem for the ListBox:

private void OnDrawItem(object sender,
System.Windows.Forms.DrawItemEventArgs e)
{
//m_PidList is a System.Windows.Forms.ListBox
e.DrawBackground();
((GaugeStyleSelect)m_PidList.Items[e.Index]).Bounds = e.Bounds;
//e.DrawFocusRectangle();
}

I don't normally do front end side code and was very pleased at how easy C#
made it, or so I thought.

Any ideas on what I'm missing?

Thanks,
jim
 
S

Steven Cheng[MSFT]

Hi Jim,

Thank you for posting here. Regarding on the issue, I am
finding proper resource to assist you and we will update as soon as posible.

Regards,

Steven Cheng
Microsoft Online Support

Get Secure! www.microsoft.com/security(This posting is provided "AS IS",
with no warranties, and confers no rights.)
 
K

Kevin Yu [MSFT]

Hi Jim,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that when you click on the up/down button of
the owner draw ListBox's scroll bar, the content didn't get scrolled. If
there is any misunderstanding, please feel free to let me know.

To troubleshoot on this issue, I think it's better to see more code on this
form. Could you please create a small repro package and send it to me by
email? Remove 'online' from the no spam alias is my real email address.
Thanks for your cooperation.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
K

Kevin Yu [MSFT]

Hi Jim,

Thanks for the repro package, I have review the code and still researching
on it. Please also check the following link which provides us with a sample
for owner draw listboxes.

http://www.codeproject.com/cs/combobox/glistbox.asp

HTH. I will continue researching on this and will update you as soon as I
get any information.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
J

Jim H

I created my own List like in the sample link you sent me instead of
handling the OnDrawItem event in the form. I got the exact same results.
It still won't scroll using the up/down buttons.

Jim
 
J

Jim H

I also posted this as a separate post in this group incase someone else may
know the answer.

The DrawItem triggered when I drag the scroll button but NOT when I click
the up/down
arrows on the scroll bar of the ListBox. How do I handle the user clicking
the up/down arrows?

Thanks for your help,
Jim
 
K

Kevin Yu [MSFT]

Hi Jim,

If you hold the mouse button down, the scroll also works fine. With Spy++,
it seems that the first VSCROLL message has been lost. I will try find some
expert on this to take a look. I will update you soon.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
J

Jim H

Yeah, if you hold the scroll button down the list scrolls fine as well. If
you just click it, the last item in the list pops up to the front then it
doesn't respond to clicks at all. The DrawItem event does not get kicked
off for those clicks either.

Thank you.
 
K

Kevin Yu [MSFT]

Hi Jim,

I have reviewed this issue and are currently researching on it. We will
update you ASAP. Thanks for your patience!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
K

Kevin Yu [MSFT]

Hi Jim,

I did more research on this issue. I can reproduce this on my computer.
However, some other computers in our team cannot reproduce this. It seems
to be machine specific.

Looking at the nature of this issue, it would require intensive
troubleshooting which would be done quickly and effectively with direct
assistance from a Microsoft Support Professional through Microsoft Product
Support Services. You can contact Microsoft Product Support directly to
discuss additional support options you may have available, by contacting us
at 1-(800)936-5800 or by choosing one of the options listed at
http://support.microsoft.com/default.aspx?scid=sz;en-us;top. If this is not
an urgent issue and your would like us to create an incident for you and
have Microsoft Customer Service Representative contact you directly, please
send email to (remove "online." from this no Spam email address):
mailto:[email protected] with the following information,

* Include "Followup: <Tomcat IssueID>" in the email Subject.
*Location of the post
*Subject Line
* First Name, Last Name
*MSDN Subscriber ID
*Company name (if any)
*Phone number
*e-mail address

Thanks!

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
J

Jim H

Thanks I placed a support call Bina is looking into it now. Thanks for all
your help. And thanks for your help on my many other questions :)

Jim
 
K

Kevin Yu [MSFT]

You're welcome, Jim.

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top