Hi Andrey,
From your post, my understanding on this issue is that you need some
generic way to detect if vertical scrollbar currently shows on the control,
which can be of any type, for example, TextBox, ListBox, CheckedListBox and
etc. You also mentioned that you need to place another control in the top
right corner of that control.
Do you mean that you'd like to place a control in i.e a textbox or listbox?
Generally speaking, we place a control in another control which could be
taken as a container, such as a Panel or GroupBox.
If you mean placing a control in a textbox or listbox and would like to
detect if vertical scrollbar currently shows, I think the easiest way is to
set the ScrollBars property of the textbox to Vertical or the
ScrollAlwaysVisible property of the listbox to True to make the vertical
scrollbar always visible on the textbox and listbox.
If you mean placing a control in another control which could acts as a
container, we should research on the class ScrollableControl which is the
base class for controls that supports auto-scrolling behavior. The
ScrollableControl has a VerticalScroll property which gets the
characteristics associated with the vertical scrollbar. Since this property
is of ScrollableControl class, using this property is a generic way for us
to determine if the vertical scrollbar currently shows on the control. The
following is a sample.
Panel panel1 = new Panel();
bool verticalScrollbarVisible = panel1.VerticalScroll.Visible;
Hope this helps.
If you have any concerns, please feel free to let me know.
Sincerely,
Linda Liu
Microsoft Online Community Support
==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.