VScrollBar Style Inconsistencies

E

eBob.com

I have two apps, both developed using the same VBE, and both having a
VScrollBar, but the two VScrollBars have very different styles. (In the
screen shot, which I had hoped to attach but can't, one appears on the left
and the other appears on the right. But, even without the screen shot,
referring to the two cases as the "left case" and the "right case" seems to
make as much sense as any other way of distinguishing the two cases. So
I'll stick with that.) In the one case, on the left, the VScrollBar uses a
baby blue and
white color scheme and rounded corners. To me it has a more modern
appearance than the one on the right, which uses a beige and light beige
color scheme and square corners.

In both cases the VScrollBars are on a usercontrol which inherits from
UserControl. (I don't know why I do that other than an assumption that
UserControl must exist so that user controls can inherit from it.) In both
cases the VScrollBars are instantiated by a "Dim vsb As New VScrollBar" in
the Class. In both cases the constructor of the usercontrol uses the
following code to place and display the VScrollBar ...

vsb.Location = New Point(Me.Width - vsb.Width, 0)
vsb.Height = Me.Height
vsb.Enabled = True
vsb.Show()
Controls.Add(vsb)

In the case on the right, although it is not obvious, the text "label text"
results from a Label which is also part of the usercontrol. But removing it
makes no difference. In the case on the left the usercontrol contains only
the VScrollBar and the form contains only the usercontrol. In the case on
the right the usercontrol contains only the VScrollBar and a Label but the
usercontrol is on a somewhat "busy" form - i.e. it contains a number of
controls.

I've found a lot of previous discussion about differing styles for
VScrollBars in different circumstances. But my VScrollBars occur in the
same circumstances! One of the earlier posts, although it didn't explain my
problem, contained a URL I'd like to look at but the link no longer works.
(It's appended below.)

I'll be grateful for any insight anyone can provide.

Thanks, Bob

=====================================

To apply XP theme to your application, you may just simply bind your
controls to Comctl32.dll version 6.0 (it's so great that no additional code
needed). Here is an article on this topic from MSDN, which described it in
detailed. You may get it from the link below:


Using Windows XP Visual Styles With Controls on Windows Forms
http://msdn.microsoft.com/library/en-us/dv_vstechart/html/vbtchUsingW...
PVisualStylesWithControlsOnWindowsForms.asp


Please Note: it is not all controls support XP visual style. However
ScrollBars supports :)


I hope this information helps you.


Best regards,


Lion Shi [MSFT]
MCSE, MCSD
Microsoft Support Engineer
 
K

Ken Halter

eBob.com said:
I've found a lot of previous discussion about differing styles for
VScrollBars in different circumstances. But my VScrollBars occur in the
same circumstances! One of the earlier posts, although it didn't explain
my
problem, contained a URL I'd like to look at but the link no longer works.
(It's appended below.)

I'll be grateful for any insight anyone can provide.

Thanks, Bob

Yeah, MSDN can't seem to leave well enough alone.... I guess they don't have
the tools it requires to keep their page URLs from constantly changing...
or, could be some hotdog with a "better idea" changing everything... who
knows.

Next time you find a broken link (which will be fairly often), just hit
google. You can find MSDN articles with google faster than using MS's search
(which usually leads you in circles, right back to the broken link)

I googled for the exact phrase "Visual Styles With Controls On Windows
Forms" (basically, the broken URL with spaces added) and came up with
this....

Using Windows XP Visual Styles With Controls on Windows Forms
http://msdn.microsoft.com/en-us/library/aa289524.aspx

Note that article's from 2002, so who knows what good it'll do. You'd think
that, with the huge framework and the time they've had to straighten these
things out, any "XP Styles" issues would be a thing of the past by now.
 

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