2

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?

Hans Passant
  • 922,412
  • 146
  • 1,693
  • 2,536
Raven
  • 2,187
  • 7
  • 35
  • 61
  • possible duplicate of [How to make a Window that does not have a Title bar move](http://stackoverflow.com/questions/1316744/how-to-make-a-window-that-does-not-have-a-title-bar-move) – stuartd Oct 31 '11 at 14:31
  • See also http://stackoverflow.com/questions/4577141/move-window-without-border – stuartd Oct 31 '11 at 14:31

2 Answers2

3

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#

Brandon Buck
  • 7,177
  • 2
  • 30
  • 51
  • Thanks yo! This is quite a lot of effort just to make a borderless app with winforms (c++). I just used WPF to create what I want easily..but I will still look into the nice articles you shared above. – Raven Nov 02 '11 at 06:39
  • @Raven Wow, I totally misread your languages, I thought you were working in C#. It's a bit of work yea, but it pays off in the end :P If WPF is easier and does the job then that works as well. I just know nothing about WPF. – Brandon Buck Nov 02 '11 at 13:07
0

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.

Romaine Carter
  • 637
  • 11
  • 23
  • Thanks, Yeah I guess I can't and implementing one would take time for win forms. I needed the app finished fast by any means, so I just designed it in WPF. There, it's much easier to implement the trick by using the onMousedown event -> then dragMove – Raven Nov 02 '11 at 06:37