Web Forms: How to minimize form with border style none

  • koraysamsun / 100 / Wed, 27 May 2009 12:17:00 GMT / Comments (7)
  • I want to build a form which don't have a title bar, but move it, resize it, minimize, normalize and maximize it. I make forms border style none, applied my codes to move and resize it. But saw that can not make it minimize by setting WindowState.Minimized, it just sets size like 120, 30 and location is near to bottom left of screen. How can i minimize a form with a border style none ?

    Also i want my form to be controlled from task bar but formborderstyle.none does not permit this. Is there a way to use this form from taskbar just like a form with borderstyle Sizable?

    Thanks a lot ?

  • Keywords:

    minimize, form, border, style, none, web, forms

  • http://dotnet.itags.org/web-forms/130947/«« Last Thread - Next Thread »»
    1. I didn't have any problem minimizing my borderless form:

      Code Snippet

      Public Class Form1

      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

      Me.WindowState = FormWindowState.Minimized

      End Sub

      End Class

      johnwein | Fri, 28 Sep 2007 09:43:00 GMT |

    2. I'm sorry for missing information. As FormBorderStyle.None can not manage from taskbar, i set ShowInTaskBar property to false, after that can not minimize form

      koraysamsun | Fri, 28 Sep 2007 09:44:00 GMT |

    3. Check this thread.

      nobugz | Fri, 28 Sep 2007 09:45:00 GMT |

    4. Hans:

      What an I missing here? With the code above, If I click the button with ShowInTaskbar = True, the form mimimizes to the Taskbar. If I click on the form in the taskbar, it restores. If I click the button with ShowInTaskbar = False, the form minimizes to the lower left corner of the screen. If I double click on it, it restores. If I add your code, I can toggle the form from the Taskbar. Is that what he wants?

      There is no context menu in any case.

      johnwein | Fri, 28 Sep 2007 09:46:00 GMT |

    5. I'm not sure what the OP wants. Just giving options. If you want a system menu, turn on the WS_SYSMENU style flag:

      parm.Style = parm.Style Or &HA0000 ' Turn on the WS_MINIMIZEBOX and WS_SYSMENU style flags

      nobugz | Fri, 28 Sep 2007 09:47:00 GMT |

    6. Thank for reply, it seems what i need, but know nothing about vb. May you send c# version of below code?

      Protected Overrides ReadOnly Property CreateParams() As CreateParams
      Get
      Dim parm As CreateParams = MyBase.CreateParams
      parm.Style = parm.Style Or &H20000 ' Turn on the WS_MINIMIZEBOX style flag
      Return parm
      End Get
      End Property

      koraysamsun | Fri, 28 Sep 2007 09:48:00 GMT |

    7. I posted the C# version to the linked thread.

      nobugz | Fri, 28 Sep 2007 09:49:00 GMT |