Re: Scrolling Control Container
Tech-Archive recommends: Fix windows errors by optimizing your registry
Yes I tried the HScroll and VScroll properties of the panel and they
appeared to have no effect at all. As soon as controls were added that went
outside the visible boundaries the scroll bars returned. The only effective
way I found to get rid of them for good so I could do the scrolling myself,
was the override of the WndProc.
"Sericinus hunter" <serhunt@xxxxxxxxx> wrote in message
news:dwaEf.7106$tb3.4533@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Have you tried Panel.VScroll property?
>
> Another approach would be to place one panel (child) inside another,
> then
> set child panel (big) size and (negative) location.
>
> Jon M. Gohr wrote:
>> Sorry for answering my own question but I figured someone else might find
>> the information useful.
>>
>> I ended up using a panel control with AutoScroll set to true and then
>> overriding the WndProc for the control so that I could handle the
>> WM_NCCALCSIZE message and hide the scrollbars.
>>
>> private const int WM_NCCALCSIZE = 0x0083;
>> private const int SB_BOTH = 3;
>>
>> [DllImport("user32.dll")]
>> private static extern int ShowScrollBar(IntPtr hWnd, int wBar, int
>> bShow);
>>
>> protected override void WndProc(ref Message m)
>> {
>> switch(m.Msg)
>> {
>> case WM_NCCALCSIZE:
>> ShowScrollBar(m.HWnd, SB_BOTH, 0 /*false*/);
>> break;
>> }
>> base.WndProc(ref m);
>> }
>>
>> Seems to work for my needs.
>>
>> "Jon M. Gohr" <jongohr@xxxxxxxxxxxxxxxx> wrote in message
>> news:eqcSJK0JGHA.1452@xxxxxxxxxxxxxxxxxxxxxxx
>>> Hey everyone,
>>>
>>> Background:
>>>
>>> We have a UI concept for an application that we're working on and I need
>>> to create a scrolling control container that I can control
>>> programmatically. For an idea of what I'm going for, please take a look
>>> at the attached bmp file.
>>>
>>> The numbered items are supposed to be single select so I've over-ridden
>>> the radio button class for that control, which is working fine. Now I
>>> need a scrolling container that can hold up to about 100 of them and
>>> that I can scroll with the arrow buttons on the right hand side.
>>>
>>> Question:
>>>
>>> Does anyone have any advice on where to start with the scrolling
>>> container? Any recommended base class that I should start with? Sample
>>> code?!?! ;-)
>>>
>>> Thanks for any help or advice you can provide, I appreciate it!
>>>
>>> Jon
>>>
>>>
>>
.