![]() Net Framework, the default coordinate system places the origin at the upper left corner with x values increasing as you move to the right, and y values increasing as you move down. Select all Open in new window The Paint() event supplies a Graphics surface via “e.Graphics” that allows us to draw on the UserControl. Public Class AnalogClock Private Sub AnalogClock_Paint(ByVal sender As System.Object, ByVal e As ) Handles MyBase.Paint End Sub End Class ![]() Scroll down to the “Paint” entry and double click it. With the UserControl selected, go to the Properties Pane and click on the “Lightning Bolt” icon to get a list of events. Most of our work will be done in the Paint() event so let’s start there. Click on Project -> Add User Control, change the name in the box to “AnalogClock” and press Enter to create it. Let’s begin by building a “bare bones” analog clock as described above: “a circle with several lines in it.” Start by adding a new UserControl to your Project. ![]() The “Bare Bones” Analog Clock: A Circle with Several Lines This article will demonstrate just how easy it is to make an analog clock in VB.Net using the latter rotation method. It is, after all, essentially just a circle with several lines in it! Two common approaches for rendering an analog clock typically involve either manually calculating points with trigonometric functions, or rotating the entire drawing the surface to draw lines at specific angles. Creating an analog clock UserControl seems fairly straight forward. ![]()
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |