473,413 Members | 1,737 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,413 software developers and data experts.

Vertical scrolling for windowsforms in c#

hi all,

i need to create vertical scrollbar dynamically for the controls
that are created dynamically in the form. (i'm not adding any controls
to the panel). when the form exceeds(coz of dynamic controls creation)
the default system coordinates, vertical scroll bar should be
dynamically produced in the form.

in this case i could produce the vscrollbar dynamically. but when
i'm scrolling the form,the controls which are down couldn't be
scrolled up.

i'm doing it in this way,
if(height >= 600)
{
vsb=new VScrollBar();
vsb.Dock=DockStyle.Right;
vsb.Maximum = 600;
vsb.LargeChange = 250;
vsb.ValueChanged +=new EventHandler(vsb_ValueChanged);
Controls.Add(vsb);
}
....
....
....

private void vsb_ValueChanged(object sender, EventArgs e)
{
this.Top = -vsb.Value;
}
any suggestion in this regard would be greatly appreciated.

Thanks and Regards
chris
Nov 16 '05 #1
2 8468
Hi Chris,
Couldn't you just set your forms AutoScroll property to true?

This way, scrollbars will automatically appear when needed, and disappear
when they are not.

Hope this helps.

All the best.
Phil.

"chris" wrote:
hi all,

i need to create vertical scrollbar dynamically for the controls
that are created dynamically in the form. (i'm not adding any controls
to the panel). when the form exceeds(coz of dynamic controls creation)
the default system coordinates, vertical scroll bar should be
dynamically produced in the form.

in this case i could produce the vscrollbar dynamically. but when
i'm scrolling the form,the controls which are down couldn't be
scrolled up.

i'm doing it in this way,
if(height >= 600)
{
vsb=new VScrollBar();
vsb.Dock=DockStyle.Right;
vsb.Maximum = 600;
vsb.LargeChange = 250;
vsb.ValueChanged +=new EventHandler(vsb_ValueChanged);
Controls.Add(vsb);
}
....
....
....

private void vsb_ValueChanged(object sender, EventArgs e)
{
this.Top = -vsb.Value;
}
any suggestion in this regard would be greatly appreciated.

Thanks and Regards
chris

Nov 16 '05 #2
hi all,
i got the answer from william.
it can be solved if we make autoscroll property of the form be true.

thanks and regards
chris

ch*******@gmail.com (chris) wrote in message news:<70**************************@posting.google. com>...
hi all,

i need to create vertical scrollbar dynamically for the controls
that are created dynamically in the form. (i'm not adding any controls
to the panel). when the form exceeds(coz of dynamic controls creation)
the default system coordinates, vertical scroll bar should be
dynamically produced in the form.

in this case i could produce the vscrollbar dynamically. but when
i'm scrolling the form,the controls which are down couldn't be
scrolled up.

i'm doing it in this way,
if(height >= 600)
{
vsb=new VScrollBar();
vsb.Dock=DockStyle.Right;
vsb.Maximum = 600;
vsb.LargeChange = 250;
vsb.ValueChanged +=new EventHandler(vsb_ValueChanged);
Controls.Add(vsb);
}
...
...
...

private void vsb_ValueChanged(object sender, EventArgs e)
{
this.Top = -vsb.Value;
}
any suggestion in this regard would be greatly appreciated.

Thanks and Regards
chris

Nov 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Don Schneider | last post by:
I tried to setup a frameset which consists of 4 different subframes. Each of these subframes should fetch a different web page from the internet and display it completely (!). BUT: the vertical...
5
by: Z | last post by:
Hi, I have problem with auto-scrolling frames in IE (6.0 on Xp, but same happens with IE 5.5 on Win2k): If I set scrolling="auto" to frame, IE reserves space where vertical scrollbar normally...
7
by: bienwell | last post by:
Hi, I'm using the CheckBoxList control in ASP.NET for Web development. This checkboxlist is bound by the database. If we have more items for this checkbox list, it takes space on the page. I...
1
by: Oberfuhrer | last post by:
Hello all VB.net friends ! i have done most of my programming in assembly, at least so far. Recently i decided to learn a high level language for windows programming. I didnt take long to...
2
by: P2P | last post by:
Hi I am wondering if someone know of a free cross-browsers vertical scrolling script that - is cross cross-browsers - will call the scrolling content from an external html page or from a...
3
by: lolo | last post by:
hello. happy new year. I'm trying to build a website for my wife and she is adament on having a horizontal thumbnail scrolling div. great. I have a good vertical scrolling thing, but can't...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.