Window Application
Lily Baik
Public Class Form1
Private Structure Layoutsettings
Dim PictureFileName As String
Dim TextHeight As String
Dim TextWidth As String
Dim TextTop As String
Dim TextLeft As String
Dim TextMoveAmount As String
Dim TextText As String
Dim TextFont As String
Dim TextColor
Dim TextBorder As String
Dim FormLeft As String
Dim FormTop As String
Dim FormWidth As String
Dim FormHeight As String
Dim FormMoveAmount As String
Dim FormColor
Dim FormBorder As String
Dim OpacityLevel As String
Dim TransparencyColor
Dim PicturePathFile As String
Dim MyCurrentSettingFile As String
End Structure
Private mylayout As New Layoutsettings
Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select Case e.KeyCode
Case Keys.Down
If e.Control = True Then
Label1.Top = (Label1.Top + 10)
Else : Me.Opacity = Me.Opacity - 0.1
End If
Case Keys.Up
If e.Control = True Then
Label1.Top = Label1.Top - 10
Else
Me.Opacity = Me.Opacity + 0.1
End If
Case Keys.Left
If e.Control = True Then
Label1.Left = Label1.Left - 10
End If
Case Keys.Right
If e.Control = True Then
Label1.Left = Label1.Left + 10
End If
End Select
End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Label1.BorderStyle = BorderStyle.None
Me.BackColor = Color.White
Me.KeyPreview = True
End Sub
Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click
FontDialog1.ShowDialog()
Label1.Font = FontDialog1.Font
End Sub
Private Sub FontColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontColorToolStripMenuItem.Click
ColorDialog1.ShowDialog()
Label1.ForeColor = ColorDialog1.Color
End Sub
Private Sub SolidToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SolidToolStripMenuItem.Click
Label1.BorderStyle = BorderStyle.FixedSingle
End Sub
Private Sub NoneToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NoneToolStripMenuItem.Click
Label1.BorderStyle = BorderStyle.None
End Sub
Private Sub SolidToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SolidToolStripMenuItem1.Click
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.Sizable
End Sub
Private Sub NoneToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NoneToolStripMenuItem1.Click
Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None
End Sub
Private Sub TransparencyColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TransparencyColorToolStripMenuItem.Click
ColorDialog1.ShowDialog()
Me.TransparencyKey = ColorDialog1.Color
End Sub
Private Sub OpenFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles OpenFileDialog1.FileOk
End Sub
Private Sub LoadpictureToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LoadpictureToolStripMenuItem.Click
OpenFileDialog1.ShowDialog()
mylayout.PictureFileName = OpenFileDialog1.FileName
Me.BackgroundImage = System.Drawing.Image.FromFile(mylayout.PictureFileName)
End Sub
Private Sub NewToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles NewToolStripMenuItem1.Click
Dim oForm As New Form1
oForm.Show()
End Sub
'Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
' mylayout.TextLeft = Label1.Left
' mylayout.TextTop = Label1.Top
' mylayout.TextWidth = Label1.Width
' mylayout.TextHeight = Label1.Height
' SaveFileDialog1.ShowDialog()
' mylayout.MyCurrentSettingFile = SaveFileDialog1.FileName
'End Sub.
Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
SaveFileDialog1.ShowDialog()
mylayout.MyCurrentSettingFile = SaveFileDialog1.FileName()
mylayout.TextLeft = Label1.Left
mylayout.TextTop = Label1.Top
mylayout.TextWidth = Label1.Width
mylayout.TextHeight = Label1.Height
mylayout.TextMoveAmount = ""
mylayout.TextText = Label1.Text
mylayout.TextFont = Label1.Font.Name
mylayout.TextColor = Label1.ForeColor
mylayout.TextBorder = Label1.BorderStyle
mylayout.FormLeft = Me.Left
mylayout.FormTop = Me.Top
mylayout.FormWidth = Me.Width
mylayout.FormHeight = Me.Height
mylayout.FormMoveAmount = ""
mylayout.FormColor = Me.BackColor
mylayout.FormBorder = Me.FormBorderStyle
mylayout.OpacityLevel = Me.Opacity
mylayout.TransparencyColor = Me.TransparencyKey
mylayout.PicturePathFile=Me.BackgroundImage.
If mylayout.MyCurrentSettingFile <> "" Then
IO.File.WriteAllText(mylayout.MyCurrentSettingFile, Label1.Text & mylayout.TextWidth & mylayout.TextTop & mylayout.TextLeft & mylayout.TextHeight & mylayout.PictureFileName)
End If
End Sub
Private Sub MoveAmountToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MoveAmountToolStripMenuItem.Click
End Sub
End Class
No comments:
Post a Comment