AutoScrollBar width...

  • Thread starter Thread starter Thorbjørn Jørgensen
  • Start date Start date
T

Thorbjørn Jørgensen

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
 
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.
 
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
 
Back
Top