Skip to content

Commit a003aa5

Browse files
committed
修复调整大小时自动调整位置不正确问题,增加全屏功能 - 20241123
1 parent df112a7 commit a003aa5

File tree

6 files changed

+164
-80
lines changed

6 files changed

+164
-80
lines changed

Src/TimeControl.suo

3 KB
Binary file not shown.

Src/TimeControl/Form1.Designer.vb

Lines changed: 23 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Src/TimeControl/Form1.resx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@
118118
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119119
</resheader>
120120
<metadata name="ContextMenuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
121-
<value>201, 17</value>
121+
<value>196, 18</value>
122122
</metadata>
123123
<metadata name="Timer1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
124124
<value>17, 17</value>

Src/TimeControl/Form1.vb

Lines changed: 137 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1032,6 +1032,48 @@ Public Class Form1
10321032
tr = "HH:mm:ss"
10331033
End If
10341034
Form2.TextBox2.Text = tr
1035+
'////////////////////////////////////////////////////////////////////////////////////
1036+
'//
1037+
'// 时钟自定义大小设置注册表读取
1038+
'//
1039+
'////////////////////////////////////////////////////////////////////////////////////
1040+
Dim tformw As Integer
1041+
Dim tformh As Integer
1042+
If (Not mykey Is Nothing) Then
1043+
tformw = mykey.GetValue("CustomWidth", -1)
1044+
If tformw <= 0 Then
1045+
If Me.MySize = 1 Then
1046+
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "CustomWidth", Me.Width, RegistryValueKind.DWord, "HKCU")
1047+
End If
1048+
tformw = Me.Width
1049+
End If
1050+
Else
1051+
If Me.MySize = 1 Then
1052+
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "CustomWidth", Me.Width, RegistryValueKind.DWord, "HKCU")
1053+
End If
1054+
tformw = Me.Width
1055+
End If
1056+
If (Not mykey Is Nothing) Then
1057+
tformh = mykey.GetValue("CustomHeight", -1)
1058+
If tformh <= 0 Then
1059+
If Me.MySize = 1 Then
1060+
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "CustomHeight", Me.Height, RegistryValueKind.DWord, "HKCU")
1061+
End If
1062+
tformh = Me.Height
1063+
End If
1064+
Else
1065+
If Me.MySize = 1 Then
1066+
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "CustomHeight", Me.Height, RegistryValueKind.DWord, "HKCU")
1067+
End If
1068+
tformh = Me.Height
1069+
End If
1070+
Form2.TextBox3.Text = tformw
1071+
Form2.TextBox4.Text = tformh
1072+
If Me.MySize = 1 Then
1073+
Me.Height = tformh
1074+
Me.Width = tformw
1075+
End If
1076+
10351077
'////////////////////////////////////////////////////////////////////////////////////
10361078
'//
10371079
'// 时钟位置注册表读取
@@ -1089,48 +1131,6 @@ Public Class Form1
10891131
Call Form2.Button4_Click(sender, e)
10901132
End If
10911133

1092-
'////////////////////////////////////////////////////////////////////////////////////
1093-
'//
1094-
'// 时钟自定义大小设置注册表读取
1095-
'//
1096-
'////////////////////////////////////////////////////////////////////////////////////
1097-
Dim tformw As Integer
1098-
Dim tformh As Integer
1099-
If (Not mykey Is Nothing) Then
1100-
tformw = mykey.GetValue("CustomWidth", -1)
1101-
If tformw <= 0 Then
1102-
If Me.MySize = 1 Then
1103-
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "CustomWidth", Me.Width, RegistryValueKind.DWord, "HKCU")
1104-
End If
1105-
tformw = Me.Width
1106-
End If
1107-
Else
1108-
If Me.MySize = 1 Then
1109-
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "CustomWidth", Me.Width, RegistryValueKind.DWord, "HKCU")
1110-
End If
1111-
tformw = Me.Width
1112-
End If
1113-
If (Not mykey Is Nothing) Then
1114-
tformh = mykey.GetValue("CustomHeight", -1)
1115-
If tformh <= 0 Then
1116-
If Me.MySize = 1 Then
1117-
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "CustomHeight", Me.Height, RegistryValueKind.DWord, "HKCU")
1118-
End If
1119-
tformh = Me.Height
1120-
End If
1121-
Else
1122-
If Me.MySize = 1 Then
1123-
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "CustomHeight", Me.Height, RegistryValueKind.DWord, "HKCU")
1124-
End If
1125-
tformh = Me.Height
1126-
End If
1127-
Form2.TextBox3.Text = tformw
1128-
Form2.TextBox4.Text = tformh
1129-
If Me.MySize = 1 Then
1130-
Me.Height = tformh
1131-
Me.Width = tformw
1132-
End If
1133-
11341134
'////////////////////////////////////////////////////////////////////////////////////
11351135
'//
11361136
'// 时钟主题注册表读取
@@ -1250,30 +1250,34 @@ Public Class Form1
12501250
Const SC_MOVE = &HF010&
12511251
Const HTCAPTION = 2
12521252
Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
1253-
If UseMoveV = 1 Then
1254-
ReleaseCapture()
1255-
SendMessage(Me.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0)
1256-
MovedV = 1
1257-
If SaveLoc = 1 Then
1258-
If UnSaveData = 0 Then
1259-
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormX", Me.Location.X, RegistryValueKind.DWord, "HKCU")
1260-
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormY", Me.Location.Y, RegistryValueKind.DWord, "HKCU")
1261-
End If
1253+
If Me.WindowState = FormWindowState.Normal Then
1254+
If UseMoveV = 1 Then
1255+
ReleaseCapture()
1256+
SendMessage(Me.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0)
1257+
MovedV = 1
1258+
If SaveLoc = 1 Then
1259+
If UnSaveData = 0 Then
1260+
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormX", Me.Location.X, RegistryValueKind.DWord, "HKCU")
1261+
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormY", Me.Location.Y, RegistryValueKind.DWord, "HKCU")
1262+
End If
12621263

1264+
End If
12631265
End If
12641266
End If
12651267
End Sub
12661268
Private Sub Label1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Label1.MouseDown
1267-
If UseMoveV = 1 Then
1268-
ReleaseCapture()
1269-
SendMessage(Me.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0)
1270-
MovedV = 1
1271-
If SaveLoc = 1 Then
1272-
If UnSaveData = 0 Then
1273-
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormX", Me.Location.X, RegistryValueKind.DWord, "HKCU")
1274-
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormY", Me.Location.Y, RegistryValueKind.DWord, "HKCU")
1275-
End If
1269+
If Me.WindowState = FormWindowState.Normal Then
1270+
If UseMoveV = 1 Then
1271+
ReleaseCapture()
1272+
SendMessage(Me.Handle, WM_SYSCOMMAND, SC_MOVE + HTCAPTION, 0)
1273+
MovedV = 1
1274+
If SaveLoc = 1 Then
1275+
If UnSaveData = 0 Then
1276+
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormX", Me.Location.X, RegistryValueKind.DWord, "HKCU")
1277+
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormY", Me.Location.Y, RegistryValueKind.DWord, "HKCU")
1278+
End If
12761279

1280+
End If
12771281
End If
12781282
End If
12791283
End Sub
@@ -1484,4 +1488,77 @@ Public Class Form1
14841488
Timer2.Enabled = False
14851489
NotifyIcon1.Visible = False
14861490
End Sub
1491+
1492+
Private Sub FullM_Click(sender As System.Object, e As System.EventArgs) Handles FullM.Click
1493+
If Me.WindowState = FormWindowState.Normal Then
1494+
Me.WindowState = FormWindowState.Maximized
1495+
'If TimeTheme = 0 Or TimeTheme = 1 Or TimeTheme = 3 Then
1496+
If TimeTheme = 2 Then
1497+
If Form2.TextBox5.Text = "" Then
1498+
Me.BackgroundImage = Nothing
1499+
End If
1500+
Else
1501+
Me.BackgroundImage = Nothing
1502+
End If
1503+
'End If
1504+
Opacity = 1
1505+
Me.FullM.Text = "退出全屏"
1506+
Else
1507+
Me.WindowState = FormWindowState.Normal
1508+
If TimeTheme = 0 Then
1509+
If crmd = 0 Then
1510+
If Me.Width >= 250 Then
1511+
Me.BackgroundImage = My.Resources.bkgdark400
1512+
ElseIf Me.Width <= 70 Then
1513+
Me.BackgroundImage = My.Resources.bkgdark50
1514+
Else
1515+
Me.BackgroundImage = My.Resources.bkgdark
1516+
End If
1517+
'Me.TransparencyKey = Color.FromArgb(1, 1, 1)
1518+
Opacity = 0.99
1519+
Else
1520+
If Me.Width >= 250 Then
1521+
Me.BackgroundImage = My.Resources.bkg400
1522+
ElseIf Me.Width <= 70 Then
1523+
Me.BackgroundImage = My.Resources.bkg50
1524+
Else
1525+
Me.BackgroundImage = My.Resources.bkg
1526+
End If
1527+
'Me.TransparencyKey = Color.FromArgb(184, 184, 184)
1528+
Opacity = 0.99
1529+
End If
1530+
ElseIf TimeTheme = 1 Then
1531+
Me.BackgroundImage = Nothing
1532+
'Me.TransparencyKey = Color.FromArgb(255, 0, 255)
1533+
Opacity = 0.7
1534+
ElseIf TimeTheme = 2 Then
1535+
If Form2.TextBox5.Text = "" Then
1536+
If crmd = 0 Then
1537+
If Me.Width >= 250 Then
1538+
Me.BackgroundImage = My.Resources.bkgdark400
1539+
ElseIf Me.Width <= 70 Then
1540+
Me.BackgroundImage = My.Resources.bkgdark50
1541+
Else
1542+
Me.BackgroundImage = My.Resources.bkgdark
1543+
End If
1544+
Else
1545+
If Me.Width >= 250 Then
1546+
Me.BackgroundImage = My.Resources.bkg400
1547+
ElseIf Me.Width <= 70 Then
1548+
Me.BackgroundImage = My.Resources.bkg50
1549+
Else
1550+
Me.BackgroundImage = My.Resources.bkg
1551+
End If
1552+
End If
1553+
End If
1554+
Opacity = CustOpacity * 0.01
1555+
ElseIf TimeTheme = 3 Then
1556+
'Me.TransparencyKey = Color.FromArgb(255, 0, 255)
1557+
Opacity = CustOpacity * 0.01
1558+
Else
1559+
Opacity = CustOpacity * 0.01
1560+
End If
1561+
Me.FullM.Text = "全屏"
1562+
End If
1563+
End Sub
14871564
End Class

Src/TimeControl/Form2.vb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -978,7 +978,6 @@ errcode:
978978
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormX", Form1.Location.X, RegistryValueKind.DWord, "HKCU")
979979
RegKeyModule.AddReg("Software\CJH\TimeControl\Settings", "TimeFormY", Form1.Location.Y, RegistryValueKind.DWord, "HKCU")
980980
End If
981-
982981
End If
983982
End If
984983
c = 0
@@ -1347,7 +1346,7 @@ errcode:
13471346
MsgBox("设置自定义大小失败。" & vbCrLf & "大小不能为空。", MsgBoxStyle.Critical, "错误")
13481347
Else
13491348
Dim c As Integer
1350-
c = TextBox3.Text - Form1.Width
1349+
c = Form1.Width - TextBox3.Text
13511350

13521351
Form1.Width = TextBox3.Text
13531352
Form1.Height = TextBox4.Text

Src/TimeControl/My Project/AssemblyInfo.vb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
3131
' 方法是按如下所示使用“*”:
3232
' <Assembly: AssemblyVersion("1.0.*")>
3333

34-
<Assembly: AssemblyVersion("1.1.20.24103")>
35-
<Assembly: AssemblyFileVersion("1.1.20.24103")>
34+
<Assembly: AssemblyVersion("1.1.21.24111")>
35+
<Assembly: AssemblyFileVersion("1.1.21.24111")>

0 commit comments

Comments
 (0)