473,396 Members | 1,843 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,396 software developers and data experts.

AutoScrollBar width...

Hi
I know that I have posted this question before, but sine no one did reply I
might not have explanind my self well enough, so I will try once more...
I have created a UserControl which inherits from Forms.UserControl. On the
usercontrol I am painting some lines and stringsswith GDI. I need to place a
string at the right edge, this is done by calculating the placement of the
string box from the width of the usercontrol. But since I in some cases need
to scroll to show all of the usercontorl I have set AutoSroll=trus, and set
the AutoScrollSize. But since I calculate the placement of the string from
the width of usercontrol I need to know the width of the scrollbar when it
is present. Hos do i find the properties of the AutoScroll bar, or solve
this problem in some other way?

Regards
Thorbjørn
Nov 16 '05 #1
3 8690
Thorbjørn,

Sorry I didn't respond the other day, I wasn't sure of the answer and
assumed someone more knowledgeable than me would respond!

Anyway, I have just done a little research and it looks like what you need
to do is check the difference between the Bounds property and the
DisplayRectangle property.

Bounds shows the overall position & size of the control relative to the form.
DisplayRectangle shows the position & size of the content area of the
control (which I am pretty sure excludes the scrollbars) relative to the top
left of the Bounds rectangle.

Good luck,
Chris.

"Thorbjørn Jørgensen" wrote:
Hi
I know that I have posted this question before, but sine no one did reply I
might not have explanind my self well enough, so I will try once more...
I have created a UserControl which inherits from Forms.UserControl. On the
usercontrol I am painting some lines and stringsswith GDI. I need to place a
string at the right edge, this is done by calculating the placement of the
string box from the width of the usercontrol. But since I in some cases need
to scroll to show all of the usercontorl I have set AutoSroll=trus, and set
the AutoScrollSize. But since I calculate the placement of the string from
the width of usercontrol I need to know the width of the scrollbar when it
is present. Hos do i find the properties of the AutoScroll bar, or solve
this problem in some other way?

Regards
Thorbjørn

Nov 16 '05 #2
Hi Chris
Sorry I didn't respond the other day, I wasn't sure of the answer and
assumed someone more knowledgeable than me would respond!
You are not obligated to answer my questions. The only reason that I
reposted, was that I thought that I had explained my self badly...
Anyway, I have just done a little research and it looks like what you need
to do is check the difference between the Bounds property and the
DisplayRectangle property.

Bounds shows the overall position & size of the control relative to the
form.
DisplayRectangle shows the position & size of the content area of the
control (which I am pretty sure excludes the scrollbars) relative to the
top
left of the Bounds rectangle.


Great... It works... That did the job, thank you very much...

Regards
Thorbjørn
Nov 16 '05 #3
In addition to the solution Chris gave you, you can discover the width or
height of scrollbars in the SystemInformation class.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm

The GDI+ FAQ RSS feed: http://www.bobpowell.net/faqfeed.xml
Windows Forms Tips and Tricks RSS: http://www.bobpowell.net/tipstricks.xml
Bob's Blog: http://bobpowelldotnet.blogspot.com/atom.xml


"Thorbjørn Jørgensen" <th*****************************@person.dk> wrote in
message news:41***********************@news.sunsite.dk...
Hi
I know that I have posted this question before, but sine no one did reply I might not have explanind my self well enough, so I will try once more...
I have created a UserControl which inherits from Forms.UserControl. On the
usercontrol I am painting some lines and stringsswith GDI. I need to place a string at the right edge, this is done by calculating the placement of the
string box from the width of the usercontrol. But since I in some cases need to scroll to show all of the usercontorl I have set AutoSroll=trus, and set the AutoScrollSize. But since I calculate the placement of the string from
the width of usercontrol I need to know the width of the scrollbar when it
is present. Hos do i find the properties of the AutoScroll bar, or solve
this problem in some other way?

Regards
Thorbjørn

Nov 16 '05 #4

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

Similar topics

2
by: Alex Shi | last post by:
In php, is there a way obtain the width of a charactor of a certain font? Alex -- ================================================== Cell Phone Batteries at 30-50%+ off retail prices!...
7
by: Graham J | last post by:
Apologies for the partial post that mysteriously escaped as I was composing. I shall try again. For many years I have been happily and successfully coding tables such that the WIDTH specified...
25
by: Sune A | last post by:
Hi All! I'm having problems with www.suneworld.com The thing is that I'd like to lock the width of the page, so that it won't adjust dynamically. Any CSS people out there that can help me? ...
16
by: karlman | last post by:
I am trying to create a web page that shows a calendar schedules. I am attempting to use table cells with fixed widths and different colors to display this. It seems that IE6 doesn't always...
0
by: javaguy | last post by:
I have a table I hide show/hide through a pair of divs. The show/hide part works fine in both Mozilla and MSIE. When switching between the hide and show versions the Mozilla browser keeps them in...
5
by: Jean Pion | last post by:
Dear readers, Can anyone explain how to set column width of a table in ccs. I use the following style in an external stylesheet: table.tbl { table-layout:fixed; border-top: 5px solid #333;...
2
by: Stewart | last post by:
Originally posted in comp.lang.javascript: Newsgroups: comp.lang.javascript From: "Stewart" Date: 23 Aug 2005 02:50:04 -0700 Local: Tues, Aug 23 2005 10:50 am Subject: FireFox, RemoveChild,...
0
by: Thorbjørn Jørgensen | last post by:
Hi 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 at run time? How do I do this? Regards...
4
by: lilOlMe | last post by:
Hi there! I'm developing a "scrollable table". At first I started using CSS. It worked pretty well until I found a bug that happens when placing this table into a tabbing control... So I...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.