2017-01-01 3 views
-2

私は非常に小さなUIを持つこのアプリケーションに取り組んでいます。 315 x 340. そして最小化すると、タスクバーの右下にBalloonTipが表示されます。アプリケーションを右下から開始するにはどうすればよいですか?

タスクバーのnotifyIconをクリックすると、右下にアプリケーションが開きます画面の解像度に関わらず、画面に表示されます。 これはプロジェクトの設定に基づいており、コードに関連していないと仮定します。

画面の右下にアプリケーションを開始するにはどうすればよいですか?かどうか、WindowsフォームやWPFによって

答えて

3

ManualにフォームのStartPositionを設定します。その後、Screenオブジェクトを使用して作業領域(タスクバー、アプリバーなどによる解像度とは異なります)を取得し、それに応じて位置を設定します。たとえば、

protected override void OnLoad(EventArgs e) 
{ 
    int x; 
    int y; 
    Screen screen; 

    base.OnLoad(e); 

    screen = Screen.PrimaryScreen; 
    x = screen.WorkingArea.Right - this.Width; 
    y = screen.WorkingArea.Height - this.Height; 

    this.Location = new Point(x, y); 
} 
1

:WPFで

WinForms: Setting the Screen Location of a Window

public Form1() 
{ 
    InitializeComponent(); 
    StartPosition = FormStartPosition.Manual; 
    Rectangle area = Screens.Primary.WorkingArea; 
    Location = new Point(area.Width-315, area.Height-340); 
} 

これは非常に似ています。

public Window1() 
{ 
    InitializeComponent(); 
    WindowStartupLocation = WindowStartupLocation.Manual; 
    Rectangle area = Screens.Primary.WorkingArea; 
    Left = area.Width-315; 
    Top = area.Height-340; 
} 
関連する問題