Tip Custom Scroll Bar

Geysser

Member
Joined
Apr 6, 2010
Messages
17
Programming Experience
5-10
I'm developing a media player in VB.NET and, being somewhat dissapointed by the standard controls of Toolbox, I've decided to create my own. All of them will be included in a Control Pack, and so far I've created only a scroll bar.
Some points of interest, concerning this scrollbar, which I call MediaBoxScrollBar (my media player is called MediaBox):

1)The design of the scroll bar is influenced by the scrollbars found in the Blender 2.5 software. I like the rounded style and the gradient effects.
2)Since it's my first time in control creation in a serious manner, I expect the control to be a bit buggy. I've tested it and it works as expected, but I don't know what might come up.
3)Commenting the code was never my strong point. So, I apologize to anyone who gets confused.
4)Feel free to test it, used it, change it or throw it away! Just give me a notice!
5)Enjoy...and give a bit of feedback! :D
 

Attachments

  • MediaBoxPack.zip
    13.9 KB · Views: 314
Last edited by a moderator:
this is amazing! It looks SO much better than the standard scrollbars. I've been looking for something like this for a while now.. thanks for sharing.

I have recreated the two files in your project (MediaBoxScrollBar.vb and modGlobalGUI.vb) but I get several errors when I build...

VB.NET:
Error	2	Name 'tmrScroll' is not declared
(several times all referring to 'Protected Overrides Sub OnMouseDown' function)

and ONE error of
VB.NET:
Error	7	Handles clause requires a WithEvents variable defined in the containing type or one of its base types.
(this one refers to the last function Private Sub tmrScroll_Tick())

Really hoping to use this in my application if that's ok? It's a free plugin for itunes I'm working on....

Thanks again
 
Thank you very much for the feedback! Of course you may use the control any way you like!That's why I share it! But first let's look at the two errors
I have included a timer control in the scroll bar to handle the scrolling when you keep the mouse down on the arrows. To me it works fine. If there isn't a timer in the project, add one and name it "tmrScroll"
The second error might be associated to the first one.
Anyway, I hope I gave you some usefull hints. And thanks again!

Oh, and here is a Pack with the scroll bar and one more control I added recently: a time display (realy simple!)
 

Attachments

  • Custom Controls.zip
    33.1 KB · Views: 226
Last edited by a moderator:
Geysser, please delete the bin and obj folders from the project(s) before zipping and posting. Uploading compiled files isn't allowed here.

This is the 2nd time in this thread one of us has done that for you.
 
Thanks.. I've added the timer, but still get the warning that it's not declared.

here's the screen... I also have another timer.. but that shouldn't make a difference I think?

Screenshot2010-05-05at215738.png


I'm also keen to see how this would control a flowlayout box.... but will worry about that once I see it on the screen!!
 
Hmmm...You said you've re-created my files. Could you send me the code you've writen? Maybe there's something there
 
I got it working! I dragged in your files to my project instead of creating them... seems to have done the trick perfectly. I am now looking at your much nicer scrollbar!

Now... how do I link this to a flowlayout? (replacing its own scrollbar).... I'm happy to post a new topic on this if it's a more generic one?
 
I would say try to manipulate FlowLayoutPanel1.VerticalScroll.Value property with my scrollbar , but right now I don't have the time for a detailed solution.For a FlowLayout there is also an event called Layout which might come in handy! Tell me if I've put you to the right direction!
 
ah yes - that makes sense!!
I tried doing that with no luck... so I added a msgbox to see what value was coming out.... turns out nothing. Have I missed something? I have the scrollbar on my screen and it is all compiling ok....

VB.NET:
Private Sub playlistScroll_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles playlistScroll.Scroll
        MsgBox(playlistScroll.VerticalScroll.Value)
        playlistFlow.VerticalScroll.Value = playlistScroll.VerticalScroll.Value
    End Sub

ps) This truly is an amazing toolbar. the customisation is epic! I have changed it to look like my app now... I am would like to change the dot (slider ball) colour though but can't see that option?
 
I've searched quickly through the internet and it seems that this is not the best approach.Sorry for putting you on the wrong path!What I would do now, is to put my float layout panel in a simple panel and manipulate the top property of the Flow. I will try to give you some code tomorrow.

PS: To customize the bullet - that's how I call it! - is my next goal. For now, it simply takes the BackColor property and it is always gradient. I was trying too much to figure out the mathematics of its position, that I didn't pay attention to its appearance! :D

Update: I've just put some properties to customize the bullet.Take a look!
 

Attachments

  • Custom Controls.zip
    33.8 KB · Views: 122
Last edited:
nice! Ive just put the new files in my project and can see the gradient of the bullet can be changed... I was searching for an item named "Bullet" !

I've been going through the code trying to see if it was possible to reduce the thickness of the background... but maintain the size of the bullet. I'm creating a touchscreen application so the scroll bars need to be massive!

I have my flowlayoutpanel already inside another panel and the scroll bar is inside that panel too. The flowlayoutpanel is the one I want to scroll... so if you imagine the "layers"

VB.NET:
panel
- label
- mediaboxscroll
- flow layout panel
     - control1
     - control2 etc

Thanks so much for the help - it's much appreciated!!
 
By "thickness of the background" do you mean the area behind the bullet? I've changed that and named it "track". I could simply put a property, say TrackThickness and change the code of painting it, but I don't have the time right now. Hey, why don't you try to do it?
Let me see what your plugin looks like once it's done!
 
yes it's the track I am meaning... I'll take a look and see what I can find!

I'm going to be testing the app on another PC today so will post the beta code on my website later hopefully!! (if there aren't too many bugs and I can get your scroll bars working)

I'll pop a link to your site (or here if you'd rather) for the controls! :)
 
I tried to change you code and to get it linked to my panel but it didn't want to play. My application is nearly ready for testing.. Just needs the toolbars. I don't suppose you've bad chance to look at how I might do this? Many thanks...
 
Back
Top