diff options
| author | TheUltimateHacker <[email protected]> | 2015-05-27 20:39:48 -0400 |
|---|---|---|
| committer | TheUltimateHacker <[email protected]> | 2015-05-27 20:39:48 -0400 |
| commit | 6c5f8c6381166edf0824aed78a1c3f05b0c562d1 (patch) | |
| tree | 360c016b59560bd9da72144fdd605897a8f11374 /shiftos_next/BWM User Controls/Titlebar.vb | |
| parent | af7679661260c7c9b02e8e746a10f2db42afe70b (diff) | |
| download | shiftos-next-6c5f8c6381166edf0824aed78a1c3f05b0c562d1.tar.gz shiftos-next-6c5f8c6381166edf0824aed78a1c3f05b0c562d1.tar.bz2 shiftos-next-6c5f8c6381166edf0824aed78a1c3f05b0c562d1.zip | |
Draggable Windows in the BWM
We're one step closer to the full Basic Window Manager implementation.
I've created a UserControl called "TitleBar" for the BWM. This
UserControl contains the window handling code for draggable windows, as
well as a design-time settable AppName property that allows you to
change the application display name (what text is shown on the
titlebar).
Shiftorium upgrades to unlock Draggable Windows will be added soon, but
I have to clean the beast.
Diffstat (limited to 'shiftos_next/BWM User Controls/Titlebar.vb')
| -rw-r--r-- | shiftos_next/BWM User Controls/Titlebar.vb | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/shiftos_next/BWM User Controls/Titlebar.vb b/shiftos_next/BWM User Controls/Titlebar.vb new file mode 100644 index 0000000..7e380d5 --- /dev/null +++ b/shiftos_next/BWM User Controls/Titlebar.vb @@ -0,0 +1,44 @@ +Public Class Titlebar + + 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_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 - Me.Width) / 2 + ParentForm.Top = (Screen.PrimaryScreen.Bounds.Height - Me.Height) / 2 + ParentForm.TopMost = True + Else + Me.Hide() + ParentForm.WindowState = FormWindowState.Maximized + ParentForm.TopMost = False + End If + End Sub + +End Class |
