如何设置在右上方的winform起始位置? [英] How to set winform start position at top right?

查看:233
本文介绍了如何设置在右上方的winform起始位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何设置的winform 起始位置在右上角?我的意思是,当用户点击(开始),我的WinForm应用程序在WinForm将出现在屏幕的右上角?

How to set winform start position at top right? I mean when user click (start) my winform application the winform will appear at the top right of the screen?

推荐答案

使用Load事件改变位置,最早的,你就会知道用户preferences和自动缩放后,窗口的实际尺寸应用:

Use the Load event to change the position, the earliest you'll know the actual size of the window after user preferences and automatic scaling are applied:

Public Class Form1
    Protected Overrides Sub OnLoad(ByVal e As System.EventArgs)
        Dim scr = Screen.FromPoint(Me.Location)
        Me.Location = New Point(scr.WorkingArea.Right - Me.Width, scr.WorkingArea.Top)
        MyBase.OnLoad(e)
    End Sub
End Class

这篇关于如何设置在右上方的winform起始位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆