diff --git a/ShiftOS/ShiftOS.vbproj b/ShiftOS/ShiftOS.vbproj index 5ca19d1..6480482 100644 --- a/ShiftOS/ShiftOS.vbproj +++ b/ShiftOS/ShiftOS.vbproj @@ -151,6 +151,12 @@ Form + + loginform.vb + + + Form + modform.vb @@ -468,6 +474,9 @@ coherencemodeform.vb + + loginform.vb + modform.vb diff --git a/ShiftOS/ShiftOSDesktop.vb b/ShiftOS/ShiftOSDesktop.vb index 933513a..6bb1267 100644 --- a/ShiftOS/ShiftOSDesktop.vb +++ b/ShiftOS/ShiftOSDesktop.vb @@ -18,6 +18,7 @@ Public ShiftOSPath As String = "C:\ShiftOS" Private actualshiftversion As String = "0.0.8" Public ingameversion As String = "0.0.1.0" + Public password As String 'Corruptions Public FileSkimmerCorrupted As Boolean = False @@ -1063,6 +1064,7 @@ SortOutBooleans(WebBrowserCorrupted, 613, False) If boughtdesktopicons = True Then savelines(614) = 11 Else savelines(614) = 10 If boughtadvapplauncher = True Then savelines(615) = 11 Else savelines(615) = 10 + savelines(616) = password IO.File.WriteAllLines(Paths.savedata & "Drivers\HDD.dri", savelines) File_Crypt.EncryptFile(Paths.savedata & "Drivers\HDD.dri", Paths.savedata & "SKernal.sft", sSecretKey) Try @@ -1588,6 +1590,7 @@ Catch boughtadvapplauncher = False End Try + If loadlines(616) = "" Then loginform.throwRegister = True Else password = loadlines(616) Viruses.startactiveviruses() If IO.File.Exists(Paths.loadedskin & "skindata.dat") Then loadcurrentskin() ' FIXME (ShiftOSPath + "Shiftum42\Skins\Current\skindata.dat") If My.Computer.FileSystem.DirectoryExists(Paths.savedata & "Icons") Then setupicons() @@ -1602,7 +1605,6 @@ loadgame() Terminal.runterminalfile(ShiftOSPath + "\Shiftum42\autorun.trm") End If - If Not My.Computer.FileSystem.DirectoryExists(ShiftOSPath + "\SoftwareData\AdvStart\Recent") Then IO.Directory.CreateDirectory(ShiftOSPath + "\SoftwareData\AdvStart\Recent") End If @@ -1615,11 +1617,21 @@ Skins.loadimages() desktopicons.AllowDrop = True desktopicons.AutoArrange = False + For Each Control In MyBase.Controls + Control.visible = False + Next + loginform.ShowDialog() + + For Each Control In MyBase.Controls + Control.visible = True + hideStart() + Next Try Helper.playSound(Paths.sounddir & "startup.wav", AudioPlayMode.WaitToComplete) Catch ex As Exception 'Do nothing -- Haven't found a good startup sound End Try + End Sub Public Sub loadcurrentskin() @@ -1831,6 +1843,9 @@ desktopicons.BackColor = Skins.desktopbackgroundcolour If Skins.desktopbackground Is Nothing Then desktopicons.BackgroundImage = Nothing Else desktopicons.BackgroundImage = Skins.desktopbackground desktopicons.BackgroundImageLayout = Skins.desktopbackgroundlayout + Me.BackColor = Skins.desktopbackgroundcolour + If Skins.desktopbackground Is Nothing Then Me.BackgroundImage = Nothing Else Me.BackgroundImage = Skins.desktopbackground + Me.BackgroundImageLayout = Skins.desktopbackgroundlayout Else Me.BackColor = globaltransparencycolour Me.BackgroundImage = Nothing diff --git a/ShiftOS/loginform.Designer.vb b/ShiftOS/loginform.Designer.vb new file mode 100644 index 0000000..3c9b37d --- /dev/null +++ b/ShiftOS/loginform.Designer.vb @@ -0,0 +1,315 @@ + _ +Partial Class loginform + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.pgcontents = New System.Windows.Forms.Panel() + Me.pnllogin = New System.Windows.Forms.Panel() + Me.lbmsgtext = New System.Windows.Forms.Label() + Me.btnok = New System.Windows.Forms.Button() + Me.pboximage = New System.Windows.Forms.PictureBox() + Me.pgleft = New System.Windows.Forms.Panel() + Me.pgbottomlcorner = New System.Windows.Forms.Panel() + Me.pgright = New System.Windows.Forms.Panel() + Me.pgbottomrcorner = New System.Windows.Forms.Panel() + Me.titlebar = New System.Windows.Forms.Panel() + Me.pnlicon = New System.Windows.Forms.PictureBox() + Me.lbtitletext = New System.Windows.Forms.Label() + Me.pgtoplcorner = New System.Windows.Forms.Panel() + Me.pgtoprcorner = New System.Windows.Forms.Panel() + Me.pgbottom = New System.Windows.Forms.Panel() + Me.Label1 = New System.Windows.Forms.Label() + Me.Label2 = New System.Windows.Forms.Label() + Me.Label3 = New System.Windows.Forms.Label() + Me.txtusername = New System.Windows.Forms.TextBox() + Me.txtpassword = New System.Windows.Forms.TextBox() + Me.txtconfirm = New System.Windows.Forms.TextBox() + Me.pgcontents.SuspendLayout() + Me.pnllogin.SuspendLayout() + CType(Me.pboximage, System.ComponentModel.ISupportInitialize).BeginInit() + Me.pgleft.SuspendLayout() + Me.pgright.SuspendLayout() + Me.titlebar.SuspendLayout() + CType(Me.pnlicon, System.ComponentModel.ISupportInitialize).BeginInit() + Me.SuspendLayout() + ' + 'pgcontents + ' + Me.pgcontents.BackColor = System.Drawing.Color.White + Me.pgcontents.Controls.Add(Me.pnllogin) + Me.pgcontents.Controls.Add(Me.btnok) + Me.pgcontents.Controls.Add(Me.pboximage) + Me.pgcontents.Dock = System.Windows.Forms.DockStyle.Fill + Me.pgcontents.Location = New System.Drawing.Point(2, 30) + Me.pgcontents.Name = "pgcontents" + Me.pgcontents.Size = New System.Drawing.Size(367, 185) + Me.pgcontents.TabIndex = 20 + ' + 'pnllogin + ' + Me.pnllogin.Controls.Add(Me.txtconfirm) + Me.pnllogin.Controls.Add(Me.txtpassword) + Me.pnllogin.Controls.Add(Me.txtusername) + Me.pnllogin.Controls.Add(Me.Label3) + Me.pnllogin.Controls.Add(Me.Label2) + Me.pnllogin.Controls.Add(Me.Label1) + Me.pnllogin.Controls.Add(Me.lbmsgtext) + Me.pnllogin.Location = New System.Drawing.Point(115, 7) + Me.pnllogin.Name = "pnllogin" + Me.pnllogin.Size = New System.Drawing.Size(246, 136) + Me.pnllogin.TabIndex = 8 + ' + 'lbmsgtext + ' + Me.lbmsgtext.Location = New System.Drawing.Point(4, 18) + Me.lbmsgtext.Name = "lbmsgtext" + Me.lbmsgtext.Size = New System.Drawing.Size(238, 38) + Me.lbmsgtext.TabIndex = 0 + Me.lbmsgtext.Text = "Please log into ShiftOS to continue." + ' + 'btnok + ' + Me.btnok.Anchor = CType(((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Left) _ + Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles) + Me.btnok.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.btnok.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.btnok.ForeColor = System.Drawing.Color.Black + Me.btnok.Location = New System.Drawing.Point(134, 149) + Me.btnok.Name = "btnok" + Me.btnok.Size = New System.Drawing.Size(105, 30) + Me.btnok.TabIndex = 7 + Me.btnok.TabStop = False + Me.btnok.Text = "Log In" + Me.btnok.UseVisualStyleBackColor = True + ' + 'pboximage + ' + Me.pboximage.Image = Global.ShiftOS.My.Resources.Resources.Symbolinfo + Me.pboximage.Location = New System.Drawing.Point(12, 7) + Me.pboximage.Name = "pboximage" + Me.pboximage.Size = New System.Drawing.Size(80, 70) + Me.pboximage.TabIndex = 0 + Me.pboximage.TabStop = False + ' + 'pgleft + ' + Me.pgleft.BackColor = System.Drawing.Color.Gray + Me.pgleft.Controls.Add(Me.pgbottomlcorner) + Me.pgleft.Dock = System.Windows.Forms.DockStyle.Left + Me.pgleft.Location = New System.Drawing.Point(0, 30) + Me.pgleft.Name = "pgleft" + Me.pgleft.Size = New System.Drawing.Size(2, 187) + Me.pgleft.TabIndex = 21 + ' + 'pgbottomlcorner + ' + Me.pgbottomlcorner.BackColor = System.Drawing.Color.Red + Me.pgbottomlcorner.Dock = System.Windows.Forms.DockStyle.Bottom + Me.pgbottomlcorner.Location = New System.Drawing.Point(0, 185) + Me.pgbottomlcorner.Name = "pgbottomlcorner" + Me.pgbottomlcorner.Size = New System.Drawing.Size(2, 2) + Me.pgbottomlcorner.TabIndex = 14 + ' + 'pgright + ' + Me.pgright.BackColor = System.Drawing.Color.Gray + Me.pgright.Controls.Add(Me.pgbottomrcorner) + Me.pgright.Dock = System.Windows.Forms.DockStyle.Right + Me.pgright.Location = New System.Drawing.Point(369, 30) + Me.pgright.Name = "pgright" + Me.pgright.Size = New System.Drawing.Size(2, 187) + Me.pgright.TabIndex = 22 + ' + 'pgbottomrcorner + ' + Me.pgbottomrcorner.BackColor = System.Drawing.Color.Red + Me.pgbottomrcorner.Dock = System.Windows.Forms.DockStyle.Bottom + Me.pgbottomrcorner.Location = New System.Drawing.Point(0, 185) + Me.pgbottomrcorner.Name = "pgbottomrcorner" + Me.pgbottomrcorner.Size = New System.Drawing.Size(2, 2) + Me.pgbottomrcorner.TabIndex = 15 + ' + 'titlebar + ' + Me.titlebar.BackColor = System.Drawing.Color.Gray + Me.titlebar.Controls.Add(Me.pnlicon) + Me.titlebar.Controls.Add(Me.lbtitletext) + Me.titlebar.Controls.Add(Me.pgtoplcorner) + Me.titlebar.Controls.Add(Me.pgtoprcorner) + Me.titlebar.Dock = System.Windows.Forms.DockStyle.Top + Me.titlebar.ForeColor = System.Drawing.Color.White + Me.titlebar.Location = New System.Drawing.Point(0, 0) + Me.titlebar.Name = "titlebar" + Me.titlebar.Size = New System.Drawing.Size(371, 30) + Me.titlebar.TabIndex = 19 + ' + 'pnlicon + ' + Me.pnlicon.BackColor = System.Drawing.Color.Transparent + Me.pnlicon.Image = Global.ShiftOS.My.Resources.Resources.iconInfoBox + Me.pnlicon.Location = New System.Drawing.Point(8, 8) + Me.pnlicon.Name = "pnlicon" + Me.pnlicon.Size = New System.Drawing.Size(16, 16) + Me.pnlicon.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage + Me.pnlicon.TabIndex = 24 + Me.pnlicon.TabStop = False + Me.pnlicon.Visible = False + ' + 'lbtitletext + ' + Me.lbtitletext.AutoSize = True + Me.lbtitletext.BackColor = System.Drawing.Color.Transparent + Me.lbtitletext.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) + Me.lbtitletext.Location = New System.Drawing.Point(26, 7) + Me.lbtitletext.Name = "lbtitletext" + Me.lbtitletext.Size = New System.Drawing.Size(132, 18) + Me.lbtitletext.TabIndex = 19 + Me.lbtitletext.Text = "Log into ShiftOS" + ' + 'pgtoplcorner + ' + Me.pgtoplcorner.BackColor = System.Drawing.Color.Red + Me.pgtoplcorner.Dock = System.Windows.Forms.DockStyle.Left + Me.pgtoplcorner.Location = New System.Drawing.Point(0, 0) + Me.pgtoplcorner.Name = "pgtoplcorner" + Me.pgtoplcorner.Size = New System.Drawing.Size(2, 30) + Me.pgtoplcorner.TabIndex = 17 + ' + 'pgtoprcorner + ' + Me.pgtoprcorner.BackColor = System.Drawing.Color.Red + Me.pgtoprcorner.Dock = System.Windows.Forms.DockStyle.Right + Me.pgtoprcorner.Location = New System.Drawing.Point(369, 0) + Me.pgtoprcorner.Name = "pgtoprcorner" + Me.pgtoprcorner.Size = New System.Drawing.Size(2, 30) + Me.pgtoprcorner.TabIndex = 16 + ' + 'pgbottom + ' + Me.pgbottom.BackColor = System.Drawing.Color.Gray + Me.pgbottom.Dock = System.Windows.Forms.DockStyle.Bottom + Me.pgbottom.Location = New System.Drawing.Point(2, 215) + Me.pgbottom.Name = "pgbottom" + Me.pgbottom.Size = New System.Drawing.Size(367, 2) + Me.pgbottom.TabIndex = 23 + ' + 'Label1 + ' + Me.Label1.AutoSize = True + Me.Label1.Location = New System.Drawing.Point(7, 56) + Me.Label1.Name = "Label1" + Me.Label1.Size = New System.Drawing.Size(58, 13) + Me.Label1.TabIndex = 1 + Me.Label1.Text = "Username:" + ' + 'Label2 + ' + Me.Label2.AutoSize = True + Me.Label2.Location = New System.Drawing.Point(7, 78) + Me.Label2.Name = "Label2" + Me.Label2.Size = New System.Drawing.Size(56, 13) + Me.Label2.TabIndex = 2 + Me.Label2.Text = "Password:" + ' + 'Label3 + ' + Me.Label3.AutoSize = True + Me.Label3.Location = New System.Drawing.Point(7, 100) + Me.Label3.Name = "Label3" + Me.Label3.Size = New System.Drawing.Size(45, 13) + Me.Label3.TabIndex = 3 + Me.Label3.Text = "Confirm:" + ' + 'txtusername + ' + Me.txtusername.Location = New System.Drawing.Point(71, 53) + Me.txtusername.Name = "txtusername" + Me.txtusername.Size = New System.Drawing.Size(158, 20) + Me.txtusername.TabIndex = 4 + ' + 'txtpassword + ' + Me.txtpassword.Location = New System.Drawing.Point(71, 78) + Me.txtpassword.Name = "txtpassword" + Me.txtpassword.Size = New System.Drawing.Size(158, 20) + Me.txtpassword.TabIndex = 5 + Me.txtpassword.UseSystemPasswordChar = True + ' + 'txtconfirm + ' + Me.txtconfirm.Location = New System.Drawing.Point(71, 100) + Me.txtconfirm.Name = "txtconfirm" + Me.txtconfirm.Size = New System.Drawing.Size(158, 20) + Me.txtconfirm.TabIndex = 6 + Me.txtconfirm.UseSystemPasswordChar = True + ' + 'loginform + ' + Me.AcceptButton = Me.btnok + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(371, 217) + Me.Controls.Add(Me.pgcontents) + Me.Controls.Add(Me.pgbottom) + Me.Controls.Add(Me.pgleft) + Me.Controls.Add(Me.pgright) + Me.Controls.Add(Me.titlebar) + Me.DoubleBuffered = True + Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None + Me.KeyPreview = True + Me.Name = "loginform" + Me.Text = "infobox" + Me.TopMost = True + Me.pgcontents.ResumeLayout(False) + Me.pnllogin.ResumeLayout(False) + Me.pnllogin.PerformLayout() + CType(Me.pboximage, System.ComponentModel.ISupportInitialize).EndInit() + Me.pgleft.ResumeLayout(False) + Me.pgright.ResumeLayout(False) + Me.titlebar.ResumeLayout(False) + Me.titlebar.PerformLayout() + CType(Me.pnlicon, System.ComponentModel.ISupportInitialize).EndInit() + Me.ResumeLayout(False) + + End Sub + Friend WithEvents pgcontents As System.Windows.Forms.Panel + Friend WithEvents pgleft As System.Windows.Forms.Panel + Friend WithEvents pgbottomlcorner As System.Windows.Forms.Panel + Friend WithEvents pgright As System.Windows.Forms.Panel + Friend WithEvents pgbottomrcorner As System.Windows.Forms.Panel + Friend WithEvents titlebar As System.Windows.Forms.Panel + Friend WithEvents lbtitletext As System.Windows.Forms.Label + Friend WithEvents pgtoplcorner As System.Windows.Forms.Panel + Friend WithEvents pgtoprcorner As System.Windows.Forms.Panel + Friend WithEvents pgbottom As System.Windows.Forms.Panel + Friend WithEvents btnok As System.Windows.Forms.Button + Friend WithEvents pboximage As System.Windows.Forms.PictureBox + Friend WithEvents pnlicon As System.Windows.Forms.PictureBox + Friend WithEvents pnllogin As System.Windows.Forms.Panel + Friend WithEvents lbmsgtext As System.Windows.Forms.Label + Friend WithEvents txtpassword As System.Windows.Forms.TextBox + Friend WithEvents txtusername As System.Windows.Forms.TextBox + Friend WithEvents Label3 As System.Windows.Forms.Label + Friend WithEvents Label2 As System.Windows.Forms.Label + Friend WithEvents Label1 As System.Windows.Forms.Label + Friend WithEvents txtconfirm As System.Windows.Forms.TextBox +End Class diff --git a/ShiftOS/loginform.resx b/ShiftOS/loginform.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS/loginform.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS/loginform.vb b/ShiftOS/loginform.vb new file mode 100644 index 0000000..6385e8c --- /dev/null +++ b/ShiftOS/loginform.vb @@ -0,0 +1,345 @@ +Imports ShiftOS.Helper +Imports ShiftOS.Paths +Public Class loginform + Public rolldownsize As Integer + Public oldbordersize As Integer + Public oldtitlebarheight As Integer + Public justopened As Boolean = False + Public needtorollback As Boolean = False + Public minimumsizewidth As Integer = 0 + Public minimumsizeheight As Integer = 0 + + Public throwRegister As Boolean = False + + +#Region "Template Code" + + Private Sub Template_Load(sender As Object, e As EventArgs) Handles MyBase.Load + justopened = True + + Me.Left = (Screen.PrimaryScreen.Bounds.Width - Me.Width) / 2 + Me.Top = (Screen.PrimaryScreen.Bounds.Height - Me.Height) / 2 + If throwRegister = True Then + lbmsgtext.Text = "Create a user account for ShiftOS. You will then use this to log in in the future." + btnok.Text = "Register" + txtconfirm.Show() + Else + Label3.Hide() + lbmsgtext.Text = "Please log into your ShiftOS account." + btnok.Text = "Log In" + txtconfirm.Hide() + End If + + setupall() + + + + ShiftOSDesktop.pnlpanelbuttoninfobox.SendToBack() 'CHANGE NAME + ShiftOSDesktop.setuppanelbuttons() + ShiftOSDesktop.setpanelbuttonappearnce(ShiftOSDesktop.pnlpanelbuttoninfobox, ShiftOSDesktop.tbinfoboxicon, ShiftOSDesktop.tbinfoboxtext, True) 'modify to proper name + ShiftOSDesktop.programsopen = ShiftOSDesktop.programsopen + 1 + Try + playSound(sounddir & "infobox.wav", AudioPlayMode.Background) + Catch + + End Try + End Sub + + Public Sub setupall() + setuptitlebar() + setupborders() + setskin() + End Sub + + Private Sub ShiftOSDesktop_keydown(sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown + 'Make terminal appear + If e.KeyCode = Keys.T AndAlso e.Control Then + Terminal.Show() + Terminal.Visible = True + Terminal.BringToFront() + End If + + 'Movable Windows + If ShiftOSDesktop.boughtmovablewindows = True Then + If e.KeyCode = Keys.A AndAlso e.Control Then + e.Handled = True + Me.Location = New Point(Me.Location.X - ShiftOSDesktop.movablewindownumber, Me.Location.Y) + End If + If e.KeyCode = Keys.D AndAlso e.Control Then + e.Handled = True + Me.Location = New Point(Me.Location.X + ShiftOSDesktop.movablewindownumber, Me.Location.Y) + End If + If e.KeyCode = Keys.W AndAlso e.Control Then + e.Handled = True + Me.Location = New Point(Me.Location.X, Me.Location.Y - ShiftOSDesktop.movablewindownumber) + End If + If e.KeyCode = Keys.S AndAlso e.Control Then + e.Handled = True + Me.Location = New Point(Me.Location.X, Me.Location.Y + ShiftOSDesktop.movablewindownumber) + End If + ShiftOSDesktop.log = ShiftOSDesktop.log & My.Computer.Clock.LocalTime & " User moved " & Me.Name & " to " & Me.Location.ToString & " with " & e.KeyCode.ToString & Environment.NewLine + End If + End Sub + + Private Sub titlebar_MouseDown(sender As Object, e As MouseEventArgs) Handles titlebar.MouseDown, lbtitletext.MouseDown, pnlicon.MouseDown, pgtoplcorner.MouseDown, pgtoprcorner.MouseDown + ' Handle Draggable Windows + If ShiftOSDesktop.boughtdraggablewindows = True Then + If e.Button = MouseButtons.Left Then + titlebar.Capture = False + lbtitletext.Capture = False + pnlicon.Capture = False + pgtoplcorner.Capture = False + pgtoprcorner.Capture = False + Const WM_NCLBUTTONDOWN As Integer = &HA1S + Const HTCAPTION As Integer = 2 + Dim msg As Message = _ + Message.Create(Me.Handle, WM_NCLBUTTONDOWN, _ + New IntPtr(HTCAPTION), IntPtr.Zero) + Me.DefWndProc(msg) + End If + ShiftOSDesktop.log = ShiftOSDesktop.log & My.Computer.Clock.LocalTime & " User dragged " & Me.Name & " to " & Me.Location.ToString & Environment.NewLine + End If + End Sub + + Public Sub setupborders() + If ShiftOSDesktop.boughtwindowborders = False Then + pgleft.Hide() + pgbottom.Hide() + pgright.Hide() + Me.Size = New Size(Me.Width - pgleft.Width - pgright.Width, Me.Height - pgbottom.Height) + End If + End Sub + + + + + + + + + + Public Sub setuptitlebar() + + setupborders() + + If Me.Height = Me.titlebar.Height Then pgleft.Show() : pgbottom.Show() : pgright.Show() : Me.Height = rolldownsize : needtorollback = True + pgleft.Width = Skins.borderwidth + pgright.Width = Skins.borderwidth + pgbottom.Height = Skins.borderwidth + titlebar.Height = Skins.titlebarheight + + If justopened = True Then + Me.Size = New Size(371, 225) 'put the default size of your window here + Me.Size = New Size(Me.Width, Me.Height + Skins.titlebarheight - 30) + Me.Size = New Size(Me.Width + Skins.borderwidth + Skins.borderwidth, Me.Height + Skins.borderwidth) + oldbordersize = Skins.borderwidth + oldtitlebarheight = Skins.titlebarheight + justopened = False + Else + If Me.Visible = True Then + 'Me.Hide() + Me.Size = New Size(Me.Width - (2 * oldbordersize) + (2 * Skins.borderwidth), (Me.Height - oldtitlebarheight - oldbordersize) + Skins.titlebarheight + Skins.borderwidth) + 'Me.Size = New Size(Me.Width - oldbordersize - oldbordersize, Me.Height - oldbordersize) 'Just put a little algebra in the first size setting and comment out the mess + oldbordersize = Skins.borderwidth + oldtitlebarheight = Skins.titlebarheight + 'Me.Size = New Size(Me.Width, Me.Height + Skins.titlebarheight - 30) + 'Me.Size = New Size(Me.Width + Skins. borderwidth + Skins. borderwidth, Me.Height + Skins. borderwidth) + 'rolldownsize = Me.Height + If needtorollback = True Then Me.Height = titlebar.Height : pgleft.Hide() : pgbottom.Hide() : pgright.Hide() + 'Me.Show() + End If + End If + + If Skins.enablecorners = True Then + pgtoplcorner.Show() + pgtoprcorner.Show() + pgtoprcorner.Width = Skins.titlebarcornerwidth + pgtoplcorner.Width = Skins.titlebarcornerwidth + Else + pgtoplcorner.Hide() + pgtoprcorner.Hide() + End If + + If ShiftOSDesktop.boughttitlebar = False Then + titlebar.Hide() + Me.Size = New Size(Me.Width, Me.Size.Height - titlebar.Height) + End If + + If ShiftOSDesktop.boughttitletext = False Then + lbtitletext.Hide() + Else + lbtitletext.Font = New Font(Skins.titletextfontfamily, Skins.titletextfontsize, Skins.titletextfontstyle, GraphicsUnit.Point) + lbtitletext.Show() + End If + + + + + If ShiftOSDesktop.boughtwindowborders = True Then + Select Case Skins.titletextpos + Case "Left" + lbtitletext.Location = New Point(Skins.titletextfromside, Skins.titletextfromtop) + Case "Centre" + lbtitletext.Location = New Point((titlebar.Width / 2) - lbtitletext.Width / 2, Skins.titletextfromtop) + End Select + lbtitletext.ForeColor = Skins.titletextcolour + Else + Select Case Skins.titletextpos + Case "Left" + lbtitletext.Location = New Point(Skins.titletextfromside + pgtoplcorner.Width, Skins.titletextfromtop) + Case "Centre" + lbtitletext.Location = New Point((titlebar.Width / 2) - lbtitletext.Width / 2, Skins.titletextfromtop) + End Select + lbtitletext.ForeColor = Skins.titletextcolour + End If + + 'Change when Icon skinning complete + If ShiftOSDesktop.boughtinfoboxicon = True Then ' Change to program's icon + pnlicon.Visible = True + pnlicon.Location = New Point(ShiftOSDesktop.titlebariconside, ShiftOSDesktop.titlebaricontop) + pnlicon.Size = New Size(ShiftOSDesktop.titlebariconsize, ShiftOSDesktop.titlebariconsize) + pnlicon.Image = ShiftOSDesktop.infoboxicontitlebar 'Replace with the correct icon for the program. + End If + + End Sub + + Public Sub rollupanddown() + If Me.Height = Me.titlebar.Height Then + pgleft.Show() + pgbottom.Show() + pgright.Show() + Me.Height = rolldownsize + Me.MinimumSize = New Size(minimumsizewidth, minimumsizeheight) + Else + Me.MinimumSize = New Size(0, 0) + pgleft.Hide() + pgbottom.Hide() + pgright.Hide() + rolldownsize = Me.Height + Me.Height = Me.titlebar.Height + End If + End Sub + + Public Sub resettitlebar() + If ShiftOSDesktop.boughtwindowborders = True Then + Select Case Skins.titletextpos + Case "Left" + lbtitletext.Location = New Point(Skins.titletextfromside, Skins.titletextfromtop) + Case "Centre" + lbtitletext.Location = New Point((titlebar.Width / 2) - lbtitletext.Width / 2, Skins.titletextfromtop) + End Select + lbtitletext.ForeColor = Skins.titletextcolour + Else + Select Case Skins.titletextpos + Case "Left" + lbtitletext.Location = New Point(Skins.titletextfromside + pgtoplcorner.Width, Skins.titletextfromtop) + Case "Centre" + lbtitletext.Location = New Point((titlebar.Width / 2) - lbtitletext.Width / 2, Skins.titletextfromtop) + End Select + lbtitletext.ForeColor = Skins.titletextcolour + End If + End Sub + + Private Sub RightCursorOn_MouseDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles pgright.MouseEnter + If ShiftOSDesktop.boughtresizablewindows = True Then + Cursor = Cursors.SizeWE + End If + End Sub + + Private Sub bottomCursorOn_MouseDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles pgbottom.MouseEnter + If ShiftOSDesktop.boughtresizablewindows = True Then + Cursor = Cursors.SizeNS + End If + End Sub + + Private Sub CornerCursorOn_MouseDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles pgbottomrcorner.MouseEnter + If ShiftOSDesktop.boughtresizablewindows = True Then + Cursor = Cursors.SizeNWSE + End If + End Sub + + Private Sub SizeCursoroff_MouseDown(ByVal sender As Object, ByVal e As System.EventArgs) Handles pgright.MouseLeave, pgbottom.MouseLeave, pgbottomrcorner.MouseLeave + If ShiftOSDesktop.boughtresizablewindows = True Then + Cursor = Cursors.Default + End If + End Sub + + Public Sub setskin() + 'disposals + titlebar.BackgroundImage = Nothing + pgtoplcorner.BackgroundImage = Nothing + pgtoprcorner.BackgroundImage = Nothing + 'apply new skin + If Skins.titlebar Is Nothing Then titlebar.BackColor = Skins.titlebarcolour Else titlebar.BackgroundImage = Skins.titlebar + titlebar.BackgroundImageLayout = Skins.titlebarlayout + If Skins.leftcorner Is Nothing Then pgtoplcorner.BackColor = Skins.leftcornercolour Else pgtoplcorner.BackgroundImage = Skins.leftcorner + pgtoplcorner.BackgroundImageLayout = Skins.leftcornerlayout + If Skins.rightcorner Is Nothing Then pgtoprcorner.BackColor = Skins.rightcornercolour Else pgtoprcorner.BackgroundImage = Skins.rightcorner + pgtoprcorner.BackgroundImageLayout = Skins.rightcornerlayout + If Skins.borderleft Is Nothing Then pgleft.BackColor = Skins.borderleftcolour Else pgleft.BackgroundImage = Skins.borderleft + pgleft.BackgroundImageLayout = Skins.borderleftlayout + If Skins.borderright Is Nothing Then pgright.BackColor = Skins.borderrightcolour Else pgright.BackgroundImage = Skins.borderright + pgleft.BackgroundImageLayout = Skins.borderrightlayout + If Skins.borderbottom Is Nothing Then pgbottom.BackColor = Skins.borderbottomcolour Else pgbottom.BackgroundImage = Skins.borderbottom + pgbottom.BackgroundImageLayout = Skins.borderbottomlayout + If enablebordercorners = True Then + If Skins.bottomleftcorner Is Nothing Then pgbottomlcorner.BackColor = Skins.bottomleftcornercolour Else pgbottomlcorner.BackgroundImage = Skins.bottomleftcorner + pgbottomlcorner.BackgroundImageLayout = Skins.bottomleftcornerlayout + If Skins.bottomrightcorner Is Nothing Then pgbottomrcorner.BackColor = Skins.bottomrightcornercolour Else pgbottomrcorner.BackgroundImage = Skins.bottomrightcorner + pgbottomrcorner.BackgroundImageLayout = Skins.bottomrightcornerlayout + Else + pgbottomlcorner.BackColor = Skins.borderrightcolour + pgbottomrcorner.BackColor = Skins.borderrightcolour + pgbottomlcorner.BackgroundImage = Nothing + pgbottomrcorner.BackgroundImage = Nothing + End If + + 'set bottom border corner size + pgbottomlcorner.Size = New Size(Skins.borderwidth, Skins.borderwidth) + pgbottomrcorner.Size = New Size(Skins.borderwidth, Skins.borderwidth) + pgbottomlcorner.Location = New Point(0, Me.Height - Skins.borderwidth) + pgbottomrcorner.Location = New Point(Me.Width, Me.Height - Skins.borderwidth) + + Me.TransparencyKey = ShiftOSDesktop.globaltransparencycolour + End Sub + + Private Sub Clock_FormClosing(sender As Object, e As FormClosingEventArgs) Handles Me.FormClosing + ShiftOSDesktop.programsopen = ShiftOSDesktop.programsopen - 1 + Me.Hide() + ShiftOSDesktop.setuppanelbuttons() + End Sub + + 'end of general setup +#End Region + + + + Private Sub btnok_Click(sender As Object, e As EventArgs) Handles btnok.Click + If throwRegister = False Then + If txtusername.Text = ShiftOSDesktop.username And txtpassword.Text = ShiftOSDesktop.password Then ' The bulk of this code is handled by ShiftOSDesktop.vb. + Me.Close() + Else + lbtitletext.Text = "Invalid Username or Password" + End If + Else + If Not txtusername.Text = "" Then + If txtpassword.Text = txtconfirm.Text Then + ShiftOSDesktop.username = txtusername.Text + ShiftOSDesktop.password = txtpassword.Text + ShiftOSDesktop.savegame() + Me.Close() + Else + lbtitletext.Text = "Passwords do not match." + End If + Else + lbtitletext.Text = "Username cannot be empty!" + End If + End If + End Sub + + + + + + +End Class \ No newline at end of file