summaryrefslogtreecommitdiff
path: root/shiftos_next/BWM User Controls/Titlebar.vb
blob: 549b129bbca7919486b3c718de77c1f8d5657f3a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Public Class Titlebar

    Friend WithEvents tmrcheckskin As New Timer

    Public Property AppName As String
        Set(value As String)
            lbtitle.Text = value
        End Set
        Get
            Return lbtitle.Text
        End Get
    End Property

    Friend WithEvents prnt As Form = ParentForm

    Private Sub Titlebar_Load(sender As Object, e As EventArgs) Handles Me.Load
        Me.Dock = DockStyle.Top
        Me.SendToBack()
        tmrcheckskin.Interval = 200
        tmrcheckskin.Start()
    End Sub

    Private Sub titlebar_MouseDown(sender As Object, e As MouseEventArgs) Handles Me.MouseDown, lbtitle.MouseDown
        ' Handle Draggable Windows
        If boughtdraggablewindows = True Then
            If e.Button = MouseButtons.Left Then
                Me.Capture = False
                lbtitle.Capture = False
                Const WM_NCLBUTTONDOWN As Integer = &HA1S
                Const HTCAPTION As Integer = 2
                Dim msg As Message = _
                    Message.Create(ParentForm.Handle, WM_NCLBUTTONDOWN, _
                        New IntPtr(HTCAPTION), IntPtr.Zero)
                Me.DefWndProc(msg)
            End If
        End If
    End Sub

    Public Sub DetermineMyVisibility()
        If boughtbasicwm = True Then
            Me.Show()
            ParentForm.WindowState = FormWindowState.Normal
            ParentForm.Left = (Screen.PrimaryScreen.Bounds.Width - ParentForm.Width) / 2
            ParentForm.Top = (Screen.PrimaryScreen.Bounds.Height - ParentForm.Height) / 2
            ParentForm.TopMost = True
        Else
            Me.Hide()
            ParentForm.WindowState = FormWindowState.Maximized
            ParentForm.TopMost = False
        End If
    End Sub

    Public Sub shiftorium_special()
        If boughtbasicwm = True Then
            lbtitle.TextAlign = ContentAlignment.MiddleLeft
            lbtitle.BackColor = Color.Gray
            ParentForm.TopMost = True
            ParentForm.WindowState = FormWindowState.Normal
        Else
            lbtitle.TextAlign = ContentAlignment.MiddleCenter
            lbtitle.BackColor = Color.Black
            ParentForm.WindowState = FormWindowState.Maximized
        End If
    End Sub

    Private Sub tmrcheckskin_Tick(sender As Object, e As EventArgs) Handles tmrcheckskin.Tick
        lbtitle.BackColor = titlebarcolor
        lbtitle.ForeColor = titlebartextcolor
    End Sub
End Class