Results 1 to 15 of 15

Thread: Maximize form [Resolved]

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Posts
    127

    Question Maximize form [Resolved]

    Is there a way programatically to keep someone from double clicking on a form and it maxamizing full screen? Just changing the property of the MaximizeBox to Fale does not work.

    My problem is that I am working with a borderless form and can't set the BorderStyle = Fixed and not have the title bar at top at the same time.

    Mucho thanks...
    Last edited by teamdad; Jul 25th, 2004 at 04:32 PM.

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    In the Form SizeChanged event , try this :

    ME.Size=Me.Size '

    I can't check if this is correct right now (at work... )

  3. #3
    Lively Member TLord's Avatar
    Join Date
    Jun 2004
    Posts
    95
    Originally posted by Pirate
    In the Form SizeChanged event , try this :

    ME.Size=Me.Size '

    I can't check if this is correct right now (at work... )
    No need for code. Set MaximizeBox property to False in the Windows Forms Designer's properties tab, and the maximize button on the form will be disabled.
    Do you think my life is easy?
    Do you think it's good to win?
    do you think it's nice to kill?
    Do you think learning is a must?
    Do you think computers are nothing?
    Do you think this post is stupid?
    Do ypu think we're really humen?

    DO YOU THINK IT'S GOOD TO THINK AT ALL? ? ? ! ! !

  4. #4
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949

    Re: Maximize form

    Originally posted by teamdad
    Is there a way programatically to keep someone from double clicking on a form and it maxamizing full screen? Just changing the property of the MaximizeBox to Fale does not work.

    My problem is that I am working with a borderless form and can't set the BorderStyle = Fixed and not have the title bar at top at the same time.

    Mucho thanks...
    Hi,

    I'm confused here.

    1. Just double clicking on the form does NOT maximise it -
    unless you have written that into the form's doubleclick
    event.

    2. Setting the maximise box property to false DOES work. It
    makes the button unavailable.

    3. The term "FullScreen" has an allocated meaning. It means the form taking up the entire screen - no minimise, maximise or exit buttons nor form name (in fact the entire form control box) being visible.

    Please clarify.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Pirate
    In the Form SizeChanged event , try this :

    ME.Size=Me.Size '

    I can't check if this is correct right now (at work... )
    Don't bother , this won't work as I thought .

    Best way is to intercept the msg in the WndProc event .

  6. #6
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by TLord
    No need for code. Set MaximizeBox property to False in the Windows Forms Designer's properties tab, and the maximize button on the form will be disabled.
    I know this , but apparently he doesn't want to do this .

  7. #7
    Lively Member TLord's Avatar
    Join Date
    Jun 2004
    Posts
    95
    Sory for late reply,

    Pirate I apologise, I ddin't read his post cearfully
    Do you think my life is easy?
    Do you think it's good to win?
    do you think it's nice to kill?
    Do you think learning is a must?
    Do you think computers are nothing?
    Do you think this post is stupid?
    Do ypu think we're really humen?

    DO YOU THINK IT'S GOOD TO THINK AT ALL? ? ? ! ! !

  8. #8

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Posts
    127
    Here's an example: Open Notepad or Internet Explorer; make sure that it's window size is not maximized and double click on the title bar. Boom!! it openes the full view of the screen. It's not the literal meaning of "full screen" hiding the title bar etc.. now double click on the title bar again and it goes back to the position and size it started out being.

    I don't have a title bar to click on, I have the minimize and maximize set to False, yet whe you double click anywhere on the form it does exactly the same as my example.

    The only thing in my code that may be troubling this is that I use WndProc as a means to move the form around on the screen since I don't have a title bar to do it with. It's probbably related to my double click problem in some way... is there any other thoughts?
    Code:
    Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
            MyBase.WndProc(m)
            If m.Msg = &H84 Then
                If m.Result.ToInt32 = 1 Then m.Result = New IntPtr(2)
            End If
        End Sub

  9. #9
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,949
    Originally posted by teamdad

    I don't have a title bar to click on, I have the minimize and maximize set to False, yet whe you double click anywhere on the form it does exactly the same as my example.

    The only thing in my code that may be troubling this is that I use WndProc as a means to move the form around on the screen since I don't have a title bar to do it with. It's probbably related to my double click problem in some way... is there any other thoughts?
    Code:
    
    
    That does not happen in ordinary VB.NET windows forms. It must be someting to do with WndProc.

    There is no "TitleBar" in VB.NET. The blue bar containing the form name and the buttons for Min; Max & Close is the "ControlBox"

    Sorry. I can't help you with your problem.
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  10. #10

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Posts
    127
    Somethings not right with it at all. Taking out the code to move the form around when clicked on holding the mouse button down and it don't do it at all. I even tried a diffrent set of code dealing with position and reposition of the mouse to move the form that didn't have anything to do with WndProc and it did the same thing.

    I guess I will have to keep searching for a way to move the borderless form another way and somehow get around this issue.

  11. #11

    Thread Starter
    Lively Member
    Join Date
    Dec 2003
    Posts
    127
    Thought I would post an FYI for all those that looked at this and along with me "scratched your heads" I found a code snippet and found a work around to allo moving the borderless form and it don't do the double click expando thing.... YEA!!!

    Code:
    Dim newPoint As New System.Drawing.Point()
        Dim a As Integer
        Dim b As Integer
        Public ScreenWidth As Integer = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width
        Public screenHeight As Integer = System.Windows.Forms.Screen.PrimaryScreen.Bounds.Height
    
        Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseDown
            a = Me.MousePosition.X - Me.Location.X
            b = Me.MousePosition.Y - Me.Location.Y
        End Sub
    
        Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles MyBase.MouseMove
            If e.Button = MouseButtons.Left Then
    
                newPoint = Me.MousePosition
                newPoint.X = newPoint.X - (a)
                newPoint.Y = newPoint.Y - (b)
                Me.Location = newPoint
                'Docks Form top left and right corners
                If Me.Location.X < 8 And Me.Location.Y < 8 Then
                    Me.Location = New System.Drawing.Point(0, 0)
                End If
    
                If Me.Location.X > (ScreenWidth - (Me.Size.Width)) + 8 And Me.Location.Y < 8 Then
                    Me.Location = New Point(ScreenWidth - Me.Size.Width, 0)
                End If
            Else
    
            End If
    
        End Sub

  12. #12
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    with what pirate said, just do this:

    [Highlight=VB]
    me.size = new system.drawing.size(height as int, width as int)
    [Highlight=VB]

    i don't have vs up right now but i think thats the right class/namespace. i don't even know if that'll work

  13. #13
    Frenzied Member
    Join Date
    Nov 2003
    Posts
    1,489
    but wait. you said it's a borderless form, right? how can a user double click a titlebar with no border?

  14. #14
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Originally posted by Andy
    but wait. you said it's a borderless form, right? how can a user double click a titlebar with no border?
    Nice catch.. . this is confusing now...

  15. #15
    Fanatic Member pax's Avatar
    Join Date
    Mar 2001
    Location
    Denmark
    Posts
    840
    Originally posted by teamdad
    I don't have a title bar to click on, I have the minimize and maximize set to False, yet whe you double click anywhere on the form it does exactly the same as my example.
    I wish I could think of something witty to put in my sig...

    ...Currently using VS2013...

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