SIGN UP MEMBER LOGIN:    
ARTICLE

Knob Control using Windows Forms and GDI+

Posted by Jigar Desai Articles | GDI+ & Graphics May 13, 2002
Control creation for windows form was never so easy like its now with .Net, although it needs some math skills if you want to create self drawn control.
Reader Level:
Download Files:
 

Control creation for windows form was never so easy like its now with .Net, although it needs some math skills if you want to create self drawn control. I havent seen much of examples to create such controls so I decided to make one. 

You must be familiar with slider control for windows form, my example Knob control is very much similar to that control in respect of functionality but there is major change in GUI. 

  • I have inherited control from UserControl class to make application simpler.
  • Delegates used for event handling of value changed.
  • Read carefully what is done in overriding IsInputKey method because by default using up down keys will change focus from object.
  • I have created variable _IsFocused that will show if object is in focus.
  • For sample I have selected Label control whose color will change when you will change value of three knob controls.

KnobControl.cs is Code for control.

Utility.cs contains important static methods used for Drawing.

Form1.cs is sample that shows use of knob Control. 

However lots of checking will be required to use this control in commercial application but this sample will give you head start if you are going in that direction.

Login to add your contents and source code to this article
share this article :
post comment
 

Great article and the code runs great on the desktop. I'm trying to make a knob control work in a Windows CE, .net CF environment to no avail. Any ideas?

Posted by Stuart Rubin May 13, 2011

Grasias!!!  por este control ActiveX

Posted by Martin Grasso Jun 20, 2010

very useful, thanks

Posted by adolfo Jun 16, 2010
Team Foundation Server Hosting
Become a Sponsor
PREMIUM SPONSORS
  • Finally – a virtual platform that delivers next-generation Windows Server 2008 Hyper-V virtualization technology from a managed hosting partner you can truly depend on. Visit www.maximumasp.com/max for a FREE 30 day trial. Hurry offer ends soon. Climb aboard the MaxV platform and take advantage of High Availability, Intelligent Monitoring, Recurrent Backups, and Scalability – with no hassle or hidden fees. As a managed hosting partner focused solely on Microsoft technologies since 2000, MaximumASP is uniquely qualified to provide the superior support that our business is built on. Unparalleled expertise with Microsoft technologies lead to working directly with Microsoft as first to offer IIS 7 and SQL 2008 betas in a hosted environment; partnering in the Go Live Program for Hyper-V; and product co-launches built on WS 2008 with Hyper-V technology.
    The leading .NET charting control now features PDF, Flash and Silverlight export, visualization of large datasets and more. Deliver true charting functionality to your BI, Scorecard, Presentation or Scientific apps. Download evaluation now.
Nevron Gauge for SharePoint
Become a Sponsor