ARTICLE

Custom Dial Control

Posted by Brad Patterson Articles | Visual Basic 2010 March 17, 2005
This article shows how to create and use custom dial control.
Download Files:
 
Reader Level:

My control is derived from Control and at this time does not allow the user access to the various properties in the control. Next term we will be taking this control and added Visual Studio support for properties, and will implement Gets and Sets for various parts of the control.

To use this control you must left mouse click on the control to cause the dial to increase and right mouse click to cause it to decrease. The value of the control is displayed in the center and I had problems getting the value to stay displayed while the dial is being adjusted. If anyone viewing the code and or have any ideas in how to stop this I would be greatly interested. I will also in my free time try and implement my next feature so that when the user clicks on the control the dial will move towards the point of clicking.

Here is an excerpt from the control that I made:

Private radius = New Point(CInt(radiusWidth), CInt(radiusHeight))
'radiusEnd = new Point( (int)(radiusWidth - lineLength),
CInt(radiusHeight)+1)
dotDiam = thisAreaW * 0.06f
rotation.Scale(1, 1)
rotation.Rotate(count)
' The Blue Base
graphIt.DrawEllipse(penBaseDial, 5, 5, newWidth, newHeight)
' The Black Dial
graphIt.FillEllipse(brushDial, 8, 8, newWidth-5, newHeight-5)
ShowCount()
graphIt.TranslateTransform(
CSng(radiusWidth)+2, CSng(radiusHeight)+3)
graphIt.RotateTransform(count)
graphIt.FillEllipse(brushDotDial, -(radiusWidth-22), -10, dotDiam, dotDiam)

Here is a view of the dial and it always starts at position zero. At the extreme left position.

share this article :
post comment
 
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.
    ceTE software specializes in components for dynamic PDF generation and manipulation. The DynamicPDF™ product line allows you to dynamically generate PDF documents, merge PDF documents and new content to existing PDF documents from within your applications.
6 Months Free & No Setup Fees ASP.NET Hosting!
Become a Sponsor