Re: Scrolling Control Container

Tech-Archive recommends: Speed Up your PC by fixing your registry



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
>
> 


.


Quantcast