View Full Version : TrackBot - A Custom UI slider for characters
LoneRobot 10-27-2008, 12:41 AM Hi all,
Another custom dotnet UI control for people to try is available on my site - This is a slider control with button functionality built in and mouse wheel value adjustment. More details here - www.lonerobot.com/trackbot.html (http://www.lonerobot.com/trackbot.html)
http://www.lonerobot.com/images/trackbotUI.jpg
|
|
mcernusca
10-27-2008, 03:17 AM
That is very cool! You've been on a roll lately, lots of good stuff.
I've been wanting to implement a custom control. I'm still trying to wrap my head around what would be involved. Any tips or resources on building custom controllers? If you don't mind me asking.
LoneRobot
10-27-2008, 08:19 AM
Hi Mihai,
I'm still trying to figure it out myself, but i'm happy to share some methods. Im trying to document as much as i can on my site but ill go through some again here. perhaps i will write a tutorial showing how to set one up from scratch in the future.
There are several 'levels' to user controls.
The simplest way to make a custom user control is to make a derived control. This means you use an existing control that has most of the functionality that you want, and extend it but adding new properties or methods, or by overriding and existing one. This is done via inheritance, An example of this is the picturebox control I featured in this article. (http://www.lonerobot.com/hitchhiker.html)This is a basic example that inherited a picturebox and painted a transparent checkerboard background.
The next level is to make a composite control. That is what HitchHiker and Trackbot are, as they use existing components and package them together so that they function as a single control. The key to a control like this is using and raising events. Often, this will be raising existing events that the embedded controls have, but sometimes this mean writing your own event handler. This is what i would do always, and it allows you to pass custom arguments to be handled by the user. You can see this in my joystick control article. (http://www.lonerobot.com/joystick.html)
There is a great post by Kenzor on CGTalk which really helped me by explaining this called 'mouse input window' if you did a search. PEN has also developed a cool joystick control entirely in MXS/dotnet without the need for a class library, so you dont have to go the visual studio route if you wish.
The last level is scripting a control from scratch, which you perform all the drawing, event handling etc.
Lastly, www.codeproject.com (http://www.codeproject.com) is a fantastic resource for user control articles in a variety of languages. I have learned almost everything from there by downloading source code and picking through it!
mcernusca
10-27-2008, 04:05 PM
Great info Pete, I really appreciate it. I think I'll start small and work my way up the ladder before I dive in the really custom stuff. Been wanting to add the ability to select multiple items at once in a treeview and codeproject seems to have a few options i could take apart and see what makes them tick. Good stuff. Thanks again. :applause:
LoneRobot
10-27-2008, 04:29 PM
Hi Mihai,
You're welcome. I'm sure i've seen a few controls knocking around that do exactly that. Let me know how you get on.
Very nice Pete and thanks for posting. I need to learn how to start developing my own.
IkerCLoN
10-28-2008, 08:57 AM
Thanks for sharing, Pete!
LoneRobot
10-28-2008, 09:27 AM
Iker, Paul, you are very welcome. I've just been seeing if I can convert the embedded slider source code into VB and recompile. This would mean that the colorslider dll is not needed which I always think is a bit cleaner. That said, you only need to load the one assembly (TrackBot) and the slider is referenced from it so only needs to be in the same folder as this one.
Fabiomussarela
10-28-2008, 11:05 AM
wow, awesome :) congratulations :)
CGTalk Moderation
10-28-2008, 11:05 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.