' Imports System.Drawing ' Imports System.Drawing.Drawing2D Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim size = PictureBox1.Size PictureBox1.BackgroundImageLayout = ImageLayout.None PictureBox1.BackgroundImage = CreateClockFace(Math.Min(size.Width, size.Height) \ 2) End Sub Private Function CreateClockFace(radius As Integer) As Image Dim rect As New Rectangle(0, 0, radius * 2, radius * 2) Dim faceRect = Rectangle.Inflate(rect, -5, -5) Dim bmp As New Bitmap(rect.Width, rect.Height) Using g = Graphics.FromImage(bmp) g.Clear(Color.Transparent) g.PixelOffsetMode = PixelOffsetMode.HighQuality g.CompositingQuality = CompositingQuality.HighQuality Using gb As New LinearGradientBrush(rect, Color.LightGreen, Color.Yellow, LinearGradientMode.ForwardDiagonal) g.FillEllipse(gb, faceRect) End Using Using p As New Pen(Brushes.Blue, 5.0F) g.DrawEllipse(p, faceRect) End Using Dim r = faceRect.Width / 2.0F For h = 1 To 12 Dim x = r * CSng(Math.Cos(Math.PI * (h - 1) / 6.0F)) + r + 2.5F Dim y = r * CSng(Math.Sin(Math.PI * (h - 1) / 6.0F)) + r + 2.5F g.FillEllipse(Brushes.Yellow, x, y, 4.0F, 4.0F) Next End Using Return bmp End Function