@@ -94,6 +94,7 @@ Public Class Form1
9494 Public UnSaveData As Integer '不保存设置
9595 Public UnReadData As Integer '不读取设置
9696 Public ShowModeTips As Integer '不显示横幅
97+ Public NeedStillTopMost As Integer '是否强制顶置
9798
9899 '在Alt+Tab中隐藏
99100 Const WS_EX_COMPOSITED = &H2000000 '0x02000000
@@ -132,7 +133,9 @@ Public Class Form1
132133 End If
133134 If Me .TopMost = True Then
134135 If Me .Visible = True Then
135- SetWindowPos( Me .Handle, HWND_TOPMOST, 0 , 0 , 0 , 0 , TOPMOST_FLAGS)
136+ If NeedStillTopMost = 1 Then
137+ SetWindowPos( Me .Handle, HWND_TOPMOST, 0 , 0 , 0 , 0 , TOPMOST_FLAGS)
138+ End If
136139 End If
137140 End If
138141 End Sub
@@ -371,6 +374,7 @@ Public Class Form1
371374 Form2.TrackBar1.Value = CustOpacity
372375 End Sub
373376 Private Sub Form1_Load( ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase .Load
377+ NeedStillTopMost = 1
374378 TimeF = "HH:mm:ss"
375379 '(在Alt+Tab隐藏窗体:启动时设置为Me.FormBorderStyle = Windows.Forms.FormBorderStyle.None,但切换其他模式再切换回来又会显示)
376380 Me .FormBorderStyle = Windows.Forms.FormBorderStyle.None
@@ -1446,7 +1450,9 @@ Public Class Form1
14461450 'If MessageBox.Show("确定要关闭时钟吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) = MsgBoxResult.Yes Then
14471451 'End
14481452 'End If
1453+ NeedStillTopMost = 0
14491454 Form2.ShowDialog()
1455+ NeedStillTopMost = 1
14501456 End Sub
14511457
14521458 Private Sub Me_FormClosing( ByVal sender As Object , ByVal e As FormClosingEventArgs) Handles Me .FormClosing
0 commit comments