Private Sub TinhchukyNew(ByVal hwnd As LongPtr)
Dim t&, L&, w&, h&, w2&, h2&, sw&, sh&, SR As RECT, r As RECT, r2 As RECT, T2&, l2&, b1&, r1&, p As aaa, sp As aaa, sx As aaa, hw As LongPtr
SR = ChukyStatt
GetWindowRect hwnd, r
hw = hAWHWnd
GetWindowRect hw, r2
With r
w = .Right - .Left: h = .Bottom - .Top: sp.x = SR.Right - w - 30: sp.y = SR.Bottom - h - 30: sx.x = SR.Left: sx.y = SR.Top
nam hw, sp
nam hw, sx
With r2
w2 = .Right - .Left: h2 = .Bottom - .Top
With p: .x = r2.Left: .y = r2.Top: nam hw, p: L = .x: t = .y: End With
With p: .x = r2.Right: .y = r2.Bottom: nam hw, p: r1 = .x: b1 = .y: End With
Select Case msbLocation
Case ngay: thang p: nam hw, p
L = p.x - w / 2: t = p.y - h / 2 - 30: GoSub p: l2 = L: T2 = t + 30
Case chuky1: L = (w2 - w) / 2: t = (h2 - h) / 2 - 30: GoSub p: l2 = L: T2 = t + 30
Case chuky5: L = (w2 - w) / 2: GoSub p: l2 = L: T2 = t + 30
Case chuky7: L = (w2 - w) / 2: t = b1 - h - 20: GoSub p: l2 = L: T2 = t - 30
Case chuky10: t = b1 - h - 50: GoSub p: l2 = L + 20: T2 = t
Case chuky15: t = t + 20: GoSub p: l2 = L + 20: T2 = t
Case chuky20: L = w2 - w: t = b1 - h - 50: GoSub p: l2 = L - 30: T2 = t
Case chuky31: L = w2 - w: t = t + 20: GoSub p: l2 = L - 30: T2 = t
End Select
End With
With p: .x = L: .y = t: NgaydenTronNgay hw, p: L = .x: t = .y: End With
With p: .x = l2: .y = T2: NgaydenTronNgay hw, p: l2 = .x: T2 = .y: End With
apiTransparent hwnd, 0
moveWindow hwnd, L, t, w, h, True: DoEvents
.Left = L: .Top = t: .Right = L + w: .Bottom = t + h
End With
newRECT = r
With newRECT2: .Left = l2: .Top = T2: .Right = l2 + w: .Bottom = T2 + h: End With
SetTimer_VBObjectBox 2, hwnd
Exit Sub
p:
L = IIf(L < sx.x, sx.x, IIf(L > sp.x, sp.x, L))
t = IIf(t < sx.y, sx.y, IIf(t > sp.y, sp.y, t))
Return
End Sub