Amr
Amr

Reputation: 9

How to create small window in the corner of the screen

I am trying to create a bot using c#, in Visual Studio. What i am struggling to do is that i am trying to create a small box in the corner of the screen while the bot is running, a like the one in the picture:box

Also, i would like it to be permanently in the corner of screen, so it cant be a window. What i mean by this is that if i was to click away from the box and away from the screen then the box should still be visible.

Upvotes: 0

Views: 432

Answers (3)

Rad
Rad

Reputation: 1

I simply set the Maximum Size to 1,1. On my screen a 5mm square window showed up.

Upvotes: -1

D J
D J

Reputation: 937

If you want the window to be placed in the lower right corner of the screen, this code will help:

    protected override void OnLoad(EventArgs e)
    {
        this.TopMost = true;
        var screen = Screen.FromPoint(this.Location);
        this.Location = new Point(screen.WorkingArea.Right - this.Width, screen.WorkingArea.Top);
        base.OnLoad(e);
    }

Upvotes: 3

Joel Coehoorn
Joel Coehoorn

Reputation: 415790

You want the TopMost property on a regular Form.

Upvotes: 1

Related Questions