TommyEvans
Active member
- Joined
- Feb 19, 2010
- Messages
- 39
- Programming Experience
- Beginner
Alright. I have finally finished my clock widget. Now I face one last challenge. It's probably not even related to the code, but it could so I'm posting here.
How do I make my program run on system startup?
Also, how can I make it load in a certain part of my screen? I want it to load in the top right corner, and not the center. Here's my code:
How do I make my program run on system startup?
Also, how can I make it load in a certain part of my screen? I want it to load in the top right corner, and not the center. Here's my code:
VB.NET:
Imports System.Media
Public Class clock_main
#Region " Global Variables "
Dim Point As New System.Drawing.Point()
Dim X, Y As Integer
#End Region
#Region " GUI "
Private Sub Main_MouseMove(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove, lblTime.MouseMove
If e.Button = MouseButtons.Left Then
Point = Control.MousePosition
Point.X = Point.X - (X)
Point.Y = Point.Y - (Y)
Me.Location = Point
End If
End Sub
Private Sub Main_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown, lblTime.MouseDown
X = Control.MousePosition.X - Me.Location.X
Y = Control.MousePosition.Y - Me.Location.Y
End Sub
#End Region
#Region " Form Load "
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
lblTextOut.Text = "Click 'Text' to change"
lblTextOut.BackColor = Color.Transparent
Me.lblTime.ForeColor = Color.Maroon
Me.lblDate.ForeColor = Color.Maroon
Me.lblTextOut.ForeColor = Color.Maroon
Me.lblColor.ForeColor = Color.White
Me.lblText.ForeColor = Color.White
Me.lblExit.ForeColor = Color.White
Me.TransparencyKey = Me.BackColor
Timer1.Enabled = True
Timer1.Interval = 10
End Sub
#End Region
#Region " Text Clicks"
Private Sub lblChangeColor_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblColor.Click
Me.ColorDialog1.ShowDialog()
Me.lblTime.ForeColor = Me.ColorDialog1.Color
Me.lblDate.ForeColor = Me.ColorDialog1.Color
Me.lblTextOut.ForeColor = Me.ColorDialog1.Color
End Sub
Private Sub lblText_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblText.Click
Dim Text As String
Text = InputBox("Enter The Text", "Enter The Text")
lblTextOut.Text = Text
End Sub
Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lblExit.Click
Application.Exit()
End Sub
#End Region
#Region " Timer "
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
lblTime.Text = TimeOfDay
lblDate.Text = DateString
End Sub
#End Region
End Class