Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27569

Form does not center screen

$
0
0
I am building this form dynamically, and even though I put in -

Code:

Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
It still fails to center on start up. I have no idea why it would do that. It is just a simple about
form. All of the code for it is below. (I have commented out the image insertion lines, so
if you run the from, it will not crash due to you not having the image.)


Code:

Imports System.Windows.Forms

Public Class FrmAbout

    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents Label3 As System.Windows.Forms.Label
    Friend WithEvents LinkLabel1 As System.Windows.Forms.LinkLabel
    Friend WithEvents lblLastBuildDate As System.Windows.Forms.Label
    Friend WithEvents lblVersion30 As System.Windows.Forms.Label
    Friend WithEvents lblSkywola As System.Windows.Forms.Label
    Friend WithEvents lblwwwTachufindcom As System.Windows.Forms.Label
    Friend WithEvents lblTachufind As System.Windows.Forms.Label
    Friend WithEvents lblCopyright As System.Windows.Forms.Label



    Private Sub FrmAbout_Load(sender As Object, e As System.EventArgs) Handles Me.Load

        lblLastBuildDate = New Label
        With lblLastBuildDate
            .AutoSize = True
            .BackColor = System.Drawing.Color.Transparent
            .Font = New System.Drawing.Font("Times New Roman", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            .ForeColor = System.Drawing.Color.Peru
            .Location = New System.Drawing.Point(138, 114)
            .Size = New System.Drawing.Size(102, 22)
            .TabIndex = 1
            .Text = "Build Date:"
        End With

        lblVersion30 = New Label
        With lblVersion30
            .AutoSize = True
            .BackColor = System.Drawing.Color.Transparent
            .Font = New System.Drawing.Font("Times New Roman", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            .ForeColor = System.Drawing.Color.Peru
            .Location = New System.Drawing.Point(138, 90)
            .Size = New System.Drawing.Size(144, 22)
            .TabIndex = 2
            .Text = "Free Version 3.0"
        End With

        lblSkywola = New Label
        With lblSkywola
            .AutoSize = True
            .BackColor = System.Drawing.Color.Transparent
            .Font = New System.Drawing.Font("Times New Roman", 14.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            .ForeColor = System.Drawing.Color.Peru
            .Location = New System.Drawing.Point(138, 66)
            .Size = New System.Drawing.Size(195, 22)
            .TabIndex = 3
            .Text = "skywola@hotmail.com"
        End With

        lblwwwTachufindcom = New Label
        With lblwwwTachufindcom
            .AutoSize = True
            .BackColor = System.Drawing.Color.Transparent
            .Font = New System.Drawing.Font("Times New Roman", 20.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            .ForeColor = System.Drawing.Color.Peru
            .Location = New System.Drawing.Point(138, 40)
            .Size = New System.Drawing.Size(244, 31)
            .TabIndex = 4
            .Text = "www.tachufind.com"
        End With

        lblTachufind = New Label
        With lblTachufind
            .AutoSize = True
            .BackColor = System.Drawing.Color.Transparent
            .Font = New System.Drawing.Font("Times New Roman", 48.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            .ForeColor = System.Drawing.Color.Peru
            ' .Location = New System.Drawing.Point(8, 1)  ' Rainbow Highlighter
            .Location = New System.Drawing.Point(120, 1)
            .Size = New System.Drawing.Size(320, 73)
            .TabIndex = 5
            .Text = "Tachufind"
        End With

        lblCopyright = New Label
        With lblCopyright
            .AutoSize = True
            .BackColor = System.Drawing.Color.Transparent
            .Font = New System.Drawing.Font("Times New Roman", 15.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
            .ForeColor = System.Drawing.Color.Peru
            .Location = New System.Drawing.Point(86, 204)
            .Name = "lblCopyright"
            .Size = New System.Drawing.Size(469, 24)
            .TabIndex = 6
            .Text = "© Copyright 2012, 2013 By Tachufind Color Master"
        End With


        Dim MeWidth As Integer = 420 ' 640
        Dim MeHeight As Integer = 240
        With Me
            '.BackgroundImage = My.Resources.Resources.About
            '.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
            .ClientSize = New System.Drawing.Size(MeWidth, MeHeight)
            .MaximumSize = New System.Drawing.Size(MeWidth, MeHeight)
            .MinimumSize = New System.Drawing.Size(MeWidth, MeHeight)
            .Controls.Add(Me.lblCopyright)
            .Controls.Add(Me.lblTachufind)
            .Controls.Add(Me.lblwwwTachufindcom)
            .Controls.Add(Me.lblSkywola)
            .Controls.Add(Me.lblVersion30)
            .Controls.Add(Me.lblLastBuildDate)
            .Font = New System.Drawing.Font("Times New Roman", 15.75!)
            .FormBorderStyle = System.Windows.Forms.FormBorderStyle.None
            .Margin = New System.Windows.Forms.Padding(6, 5, 6, 5)
            .Name = "FrmAbout"
            .StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
            .TopMost = True
        End With


    End Sub

    Private Sub LinkLabel1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles LinkLabel1.Click
        Try
            Dim wb As New WebBrowser
            Dim URL As String = "http://www.tachufind.com"  ' Get Value based on Key
            wb.Navigate(URL)
            Process.Start(URL)
        Catch ex As Exception
            MsgBox("Unable to proceed to this web address, you may not have a default web browser designated.", vbOKOnly)
        End Try

    End Sub


    Private Sub FrmAbout_KeyDown(sender As Object, e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        Me.Visible = False
    End Sub

    Private Sub FrmAbout_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
        Me.Visible = False
    End Sub

    Private Sub lblTachufind_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles lblTachufind.MouseDown
        Me.Visible = False
    End Sub

    Private Sub lblLastBuildDate_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles lblLastBuildDate.MouseDown
        Me.Visible = False
    End Sub

    Private Sub lblSkywola_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles lblSkywola.MouseDown
        Me.Visible = False
    End Sub

    Private Sub lblVersion30_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles lblVersion30.MouseDown
        Me.Visible = False
    End Sub

    Private Sub lblwwwTachufindcom_MouseDown(sender As Object, e As System.Windows.Forms.MouseEventArgs) Handles lblwwwTachufindcom.MouseDown
        Me.Visible = False
    End Sub

    Private Sub lblCopyright_Click(sender As Object, e As System.EventArgs) Handles lblCopyright.Click
        Me.Visible = False
    End Sub
End Class

'Private Sub LinkEmailTo_Click(ByVal sender As Object, ByVal e As System.EventArgs)
'    Process.Start("mailto:skywola@hotmail.com")
'End Sub


Viewing all articles
Browse latest Browse all 27569

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>