在visual basic中,在屏幕右下角定位表单

Utk*_*maz 9 vb.net

当表单加载时,如何在窗口的右下角放置表单?我正在使用Visual Basic 2010 Express.

谢谢

编辑:我做了这个,似乎工作得很好.

Dim x As Integer
Dim y As Integer
x = Screen.PrimaryScreen.WorkingArea.Width - 400
y = Screen.PrimaryScreen.WorkingArea.Height - 270
Me.Location = New Point(x, y)
Run Code Online (Sandbox Code Playgroud)

小智 8

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    Me.Visible = True
    Dim x As Integer
    Dim y As Integer
    x = Screen.PrimaryScreen.WorkingArea.Width
    y = Screen.PrimaryScreen.WorkingArea.Height - Me.Height

    Do Until x = Screen.PrimaryScreen.WorkingArea.Width - Me.Width
        x = x - 1
        Me.Location = New Point(x, y)
    Loop

End Sub
Run Code Online (Sandbox Code Playgroud)


Adr*_*der 6

您需要将Form.StartPosition更改为Manual并更改窗体的Location属性

例如,如何手动设置表单启动位置/位置?

要么

VB.net - 表格起始位置左上角

使用Form.StartPosition属性Form.Location属性

  • Screen.GetWorkingArea返回显示的有用部分的大小和位置.或者是令人难以忍受的细节,显示器的桌面区域,不包括任务栏,停靠窗口和停靠工具栏.您传入一个控件,因为可能有多个监视器,在这种情况下,它使用控件来决定您的监视器.http://msdn.microsoft.com/en-us/library/45zswy9x.aspx (2认同)