Dirbdami su "Windows 8" programos atnaujinimu, aš nusprendžiau sujungti šį šabloną, skirtą naudotojams, kurie naudoja tuos, kurie vis dar gali naudoti "VB.Net 2010". Kaip asmuo, kuris vis dar mokosi naudoti "Visual Studio Tools" kartu su " "Windows 8 Developer Build", vis dar kuriu programas, kuriose naudojamas "VB.Net 2008/2010", ir maniau, kad tai gali būti naudinga, jei kas nors norėtų šiek tiek pakomentuoti savo programas.
Galite atsisiųsti šabloną, kuris jau buvo iš anksto padarytas puslapio apačioje.
Paleiskite naują "Blank Project" programą VB.net (aš naudoju šį šabloną "VB.Net Express 2010")
Įtraukite 2 formas į projektą. Pažymėkite juos kaip įstrigti ir pagrindinis ir nustatykite tiek "FormBorderStyle None", tiek "WindowState Maximized". (Aš nustatiau abu, kad nerodau užduočių juostoje ir jokio teksto, bet tai man tik pirmenybė).
Rinkinys įstrigti backscore iki 43, 186, 255, pagrindinis balta spalva. Nustatykite visų spalvų šrifto spalvas visiems baltuosiuose.
Įklotinėje formoje pridėkite šiuos valdiklius:
Skydas pavadintas pnllogo. pnllogo backcolor iki 43, 186, 255. Į pnllogo pridėkite šiuos valdiklius:
- Picturebox pavadintas piclogo, 200 x 200 dydžio
- etiketė pavadinta lbllogo, Šriftų stilius Segeo UI Light, Light, 48
- etiketė pavadinta lbcompany, Šrifto stilius Segeo UI Light, Light, 28
Laikmatis pavadintas tmrdisplay Intervalas nustatytas iki 5000
Pagrindinėje formoje pridėkite šią kontrolę:
Skydas pavadintas pnlappbar. pnlappbar backcolor į juodą. Į pnlappbar pridėkite šiuos valdiklius:
- Mygtukas pavadintas btpakeisti, Tekstas rodomas Taikyti: šrifto stilius Segeo UI šviesa, šviesa, 12: mygtuko dydis 120 × 45
- Mygtukas pavadintas btnclose, Tekstas rodomas yra Uždaryti: šrifto stilius Segeo UI šviesa, šviestuvas, 12: mygtuko dydis 120 × 45
- Mygtukas pavadintas btnyes, Tekstas rodomas taip: šrifto stilius Segeo UI šviesa, apšvietimas, 12: mygtuko dydis 120 × 45
- Mygtukas pavadintas btnno, Tekstas rodomas ne: Šrifto stilius Segeo UI šviesa, šviesa, 12: mygtuko dydis 120 × 45
- Etiketė pavadinta lblinfo, Šrifto stilius Segeo UI Light, Light, 12
- Etiketė pavadinta lblinfo2, Šrifto stilius Segeo UI Light, Light, 12
Pridėkite tokį kodą:
Private Sub splash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ‘Set Splash Screen size and begin the Timer Me.WindowState = FormWindowState.Maximized pnllogo.Left = (Me.Width – pnllogo.Width) / 2 pnllogo.Top = (Me.Height – pnllogo.Height) / 2 tmrdisplay.Enabled = True End Sub Private Sub tmrdisplay_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrdisplay.Tick ‘Removes the Splash Screen and displays the Main Application Me.Visible = False main.Visible = True End Sub
Įtraukite šį kodą į pagrindinį:
#Region “Set Form” Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load setcontrols() End Sub
Public Sub setcontrols() ‘Sets the location for all of the controls on the form. pnlappbar.Width = Me.Width pnlappbar.Left = Me.Left pnlappbar.Height = 100 pnlappbar.Top = Me.Height – pnlappbar.Height btnclose.Left = (pnlappbar.Width – btnclose.Width) – 10 btnapply.Left = (btnclose.Left – btnclose.Width) – 10 btnyes.Left = btnapply.Left btnyes.Top = btnapply.Top btnyes.Visible = False btnno.Left = btnclose.Left btnno.Top = btnclose.Top btnno.Visible = False lblinfo.Left = Me.Left + 200 lblinfo.Visible = False lblinfo.Visible = False lblinfo2.Left = Me.Left + 200 lblinfo2.Visible = False Me.TopMost = True End Sub
Private Sub main_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing ‘Make sure application exits. Application.Exit() End Sub #End Region ‘Set Form
#Region “Apply Button” Private Sub btnapply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnapply.Click ‘Sets the messages across the appbar and displays the correct buttons. lblinfo.Visible = False btnapply.Visible = False btnyes.Visible = True btnno.Visible = True btnclose.Visible = False lblinfo2.Visible = True lblinfo2.Text = “Changes you made may require a System Restart. Would you like to Restart Now?” End Sub
Private Sub btnapply_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnapply.MouseEnter ‘Sets the messages across the appbar and displays the correct buttons. btnapply.BackColor = Color.Gray lblinfo.Text = “Apply changes you have made to Windows 8” lblinfo.Visible = True End Sub
Private Sub btnapply_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnapply.MouseLeave btnapply.BackColor = Color.Black lblinfo.Visible = False End Sub #End Region ‘Apply Button
#Region “Close Button” Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclose.Click ‘Exit Application Application.Exit() End Sub
Private Sub btnclose_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnclose.MouseEnter ‘Sets the messages across the appbar and displays the correct buttons. btnclose.BackColor = Color.Gray lblinfo.Text = “Close the application without making changes?” lblinfo.Visible = True End Sub
Private Sub btnclose_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnclose.MouseLeave btnclose.BackColor = Color.Black lblinfo.Visible = False End Sub #End Region ‘Close Button
#Region “No Button” Private Sub btnno_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnno.Click ‘Apply your settings ‘We are going to do something here ‘------------------- ‘Sets the messages across the appbar and displays the correct buttons. lblinfo.Visible = False btnapply.Visible = True btnyes.Visible = False btnno.Visible = False btnclose.Visible = True lblinfo2.Visible = False End Sub
Private Sub btnno_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnno.MouseEnter btnno.BackColor = Color.Gray End Sub
Private Sub btnno_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnno.MouseLeave btnno.BackColor = Color.Black End Sub #End Region ‘No Button
#Region “Yes Button” Private Sub btnyes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnyes.Click ‘Apply your settings ‘We are going to do something here ‘------------------- ‘This code will Restart Windows System.Diagnostics.Process.Start(“shutdown”, “-r -t 05”) Application.Exit() End Sub
Private Sub btnyes_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnyes.MouseEnter btnyes.BackColor = Color.Gray End Sub
Private Sub btnyes_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnyes.MouseLeave btnyes.BackColor = Color.Black End Sub #End Region ‘Yes Button
Leiskite man žinoti, jei jums reikia pagalbos.
Džiaugsmas! 🙂