Results 1 to 14 of 14

Thread: Crazy forms...

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    Palermo, Italy
    Posts
    325

    Crazy forms...

    I have a form with FormBorderStyle=FixedSingle, and Maximized=true.
    First of all, it goes over the taskbar, and I don't like, then when I doubleclick on the title of the window it resizes to design size!!!!
    What to do?

    Thx
    Learn, this is the Keyword...

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    Palermo, Italy
    Posts
    325
    And it moves when maximized!!!
    Learn, this is the Keyword...

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    So what do you want to do exactly ?

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    Palermo, Italy
    Posts
    325
    Not to move, not to resize, maximized.
    Learn, this is the Keyword...

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Simply do this with having your form set to maximized for WindowState . This solves resizing and moving the form problems.
    VB Code:
    1. Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Resize
    2.         Me.WindowState = FormWindowState.Maximized
    3. End Sub

  6. #6

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    Palermo, Italy
    Posts
    325
    No no... I did it. The form moves, and if I doubleclick on the titlebar it resizes to the design size...
    Learn, this is the Keyword...

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    This is what I tried and worked well . I'm sure you missed something . try it out !
    Attached Files Attached Files

  8. #8

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    Palermo, Italy
    Posts
    325
    Yes, in your example it works... it resolves form resize, but not to move... I found two bugs: when you have the maximizebox property to false, the form when maximized will go over the taskbar, and it moves!. 2nd: It's not possible to avoid the resizing of the form to the design size, until you use the code you wrote. Maybe with API, godd old VB6 could catch windows messages... Don't know how to do this in VB.NET.

    Thx

    Xmas.
    Learn, this is the Keyword...

  9. #9
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Is your Windows task bar set to be On Top of other windows ?

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    Palermo, Italy
    Posts
    325
    Yes, it is.
    Learn, this is the Keyword...

  11. #11
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Xmas79
    Not to move, not to resize, maximized.
    Now , this should solve these problems perfectly I guess .
    Attached Files Attached Files

  12. #12
    Lively Member Tygur's Avatar
    Join Date
    Jul 2002
    Posts
    108
    Pirate, I checked out your code. It looks like you're basically trying to make the form ignore all clicks to the title bar or any of its buttons, but it's not quite working, hence the handling if the Closing and Resize events.

    The magical message you're looking to block is actually WM_NCHITTEST. That WndProc override can just look like this:
    VB Code:
    1. Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
    2.         If m.Msg = WM_NCHITTEST Then
    3.             Exit Sub
    4.         End If
    5.         MyBase.WndProc(m)
    6.     End Sub

    And the only constant declaration you need is this:
    VB Code:
    1. Const WM_NCHITTEST = &H84

    You no longer need to handle the Closing or Resize events after that. This takes care of the flickering you get when you double-click on the titlebar and makes it look a whole lot more natural. It also means that you no longer have to use End to close the app (technically, it wasn't absolutely necessary before, but anyway...).

    If you want to know how to let any particular kinds of clicks through, such as maybe minimize, let me know. Or you can figure it out. The information is out there, after all

  13. #13

    Thread Starter
    Hyperactive Member
    Join Date
    Jan 2002
    Location
    Palermo, Italy
    Posts
    325
    Why you all have an answer for every question Wait for me!!! One day...
    Learn, this is the Keyword...

  14. #14
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Yeah Tygur , that was easier . I was a little bit lost in these messages . Thanks for making me look at that .

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width