How to have scrollbars in a user control

R

Raj

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
 
D

Dmytro Lapshyn [MVP]

Hi,

To force the scroll bars to appear, you might try to adjust the value of the
AutoScrollMinSize property rather than changing the size of the control
itself.
 

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