How to have scrollbars in a user control

Tech-Archive recommends: Fix windows errors by optimizing your registry



Hi,


I would like to have my user control to support scrollbars. So that when the
user control is embeded in a pane/view, and the view size is reduced to less
than the size of the usercontrol, the user control must show scroll bars.

Currently I tried by setting the AutoScroll property to true. Also, I
handled the 'Form1_SizeChanged' event for the form. Here I invoke a 'Resize'
routine defined by the UserControl - 'ResizeControl' :-

public void ResizeControl(int width, int height)

{


this.Left = 10;

this.Top = 10;


this.Height = (height - 20) ;

this.Width = (width - 20) ;




}

But I am finding that the scrolbars are not appearing correctly. Only one
scrollbar appears at a time?

Please suggest possible solutions!

Thanks & Regards,

Rajendra




.



Relevant Pages

  • richtextbox, scrollbars not always enableing
    ... I have a richtextbox as part of a user control. ... vertical splitter bar next to it, which allows for changing its size. ... RTB is multiline, enabled, readonly, no wordwrap, docked to bottom. ... Scrollbars are set to forcedboth. ...
    (microsoft.public.dotnet.framework.windowsforms.controls)
  • Scrollbars on User Controls
    ... I have a user control where I override the paint event and draw the ... When I sraw outside of the visible area, ... I can enable and show the scrollbars, ...
    (microsoft.public.dotnet.general)
  • newbie form question
    ... This user control has a panel with controls in it (a couple of textboxes ... If I resize the panel itself, the scrollbars automatically ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Width of AutoScrollBar
    ... I have build a user control which takes advantages of the AutoScroll ... feature, but i need to find the width of the scrollbars when they are added ...
    (microsoft.public.dotnet.languages.csharp)