How to make a borderless winforms application?

2019-08-12 07:13发布

I'm trying to create a borderless win forms app.

Here's the steps on how I managed to make something really simple that does what I want:

  • First, I set the form border style to none.
  • Then added an image that will serve as the exit button for the application.

Here is the image of what I've done so far: enter image description here

When I run the application, I wonder why I can't move the window or the app around the screen.

Any ideas on how I can get through with this problem?

2条回答
做自己的国王
2楼-- · 2019-08-12 07:14

The example code and project are written in VB.Net but this solved this problem for me after doing a bit of reading on comparing keywords between the two languages I had the code written for C#.

Moving and Resizing Borderless WinForms

It also solves the resizing issue as well if you're interested.

EDIT

Also, here is the website I used to read about converting VB to C#.

Comparing VB and C#

查看更多
在下西门庆
3楼-- · 2019-08-12 07:27

You can not move the application because in Windows the title bar and borders are the default method to move and resize a stand winform. To replicate this functionality without borders; you have to provide an area on the form that captures the mouse pointer and moves the form according to the new location of the mouse. You can do this by handling the drag events for the form and resetting the forms top and left property.

查看更多
登录 后发表回答