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

Last edited by a moderator:

mfacer

Member
Joined
May 5, 2010
Messages
7
Programming Experience
Beginner
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...

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

and ONE error of
Code:
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
 

Geysser

Member
Joined
Apr 6, 2010
Messages
17
Programming Experience
5-10
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

Last edited by a moderator:

JuggaloBrotha

VB.NET Forum Moderator
Staff member
Joined
Jun 3, 2004
Messages
4,524
Location
Lansing, MI; USA
Programming Experience
10+
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.
 

Geysser

Member
Joined
Apr 6, 2010
Messages
17
Programming Experience
5-10
My bad!I must have missed this rule.Sorry!
 

mfacer

Member
Joined
May 5, 2010
Messages
7
Programming Experience
Beginner
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?



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!!
 

Geysser

Member
Joined
Apr 6, 2010
Messages
17
Programming Experience
5-10
Hmmm...You said you've re-created my files. Could you send me the code you've writen? Maybe there's something there
 

mfacer

Member
Joined
May 5, 2010
Messages
7
Programming Experience
Beginner
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?
 

Geysser

Member
Joined
Apr 6, 2010
Messages
17
Programming Experience
5-10
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!
 

mfacer

Member
Joined
May 5, 2010
Messages
7
Programming Experience
Beginner
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....

Code:
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?
 

Geysser

Member
Joined
Apr 6, 2010
Messages
17
Programming Experience
5-10
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

Last edited:

mfacer

Member
Joined
May 5, 2010
Messages
7
Programming Experience
Beginner
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"

Code:
panel
- label
- mediaboxscroll
- flow layout panel
     - control1
     - control2 etc
Thanks so much for the help - it's much appreciated!!
 

Geysser

Member
Joined
Apr 6, 2010
Messages
17
Programming Experience
5-10
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!
 

mfacer

Member
Joined
May 5, 2010
Messages
7
Programming Experience
Beginner
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! :)
 

mfacer

Member
Joined
May 5, 2010
Messages
7
Programming Experience
Beginner
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...
 

Geysser

Member
Joined
Apr 6, 2010
Messages
17
Programming Experience
5-10
Well, I've decided to make a few more changes.
The controls I've created - including the scroll bar - are now in a big pack called "GControlsPack". The ScrollBar is now called "GScrollBar". Just ignore the Analog clock - it's not finished yet!

Here it is, along with a test application that - hopefully! - does something like what you want. Change anything you find...and be careful when resizing the bar! There are a few bugs there!
 

Attachments

dherr

New member
Joined
Dec 17, 2011
Messages
1
Programming Experience
10+
Custom Scrollbar

Hi,
I tried your custom scrollbar and it's looking good and you have many possibilities to set the properties.
But the question is:
How can I replace a scrollbar of a control which is shown automatically when the control inicates it?
For example: a flowlayoutpanel, or a datagridview or something similar...

regards
Dietrich
 

Geysser

Member
Joined
Apr 6, 2010
Messages
17
Programming Experience
5-10
That's not easy! From the little I know, you have to subclass the control.It's way easier - and safer! - to built a substitute from scratch - say, your own container.
 

lori96touch

New member
Joined
Jul 21, 2012
Messages
1
Programming Experience
1-3
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
Thanks for this great customization. I'd like to ask you if it's possible to link this scrollbar with a listbox? I mean use this scrollbar instead of the listbox' default. I've already deleted the default listbox' scrollbar but how to replace it with yours? Thanks
 

jackdawkc

New member
Joined
May 31, 2011
Messages
2
Programming Experience
3-5
Is there any reason the control when vertical is upside down, and is there any way to change this?
 
Top Bottom