Results 1 to 26 of 26

Thread: tough one

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506

    Talking tough one

    ok, someone give me a hand ere pls becos im well stuck...
    im trying to detect whether my form is maxmized, if anyone knows an easier way tell me quick! otherwise read on..
    VB Code:
    1. Private Sub Form_Resize()
    2.  
    3. End Sub
    im using that method along with Screen.Height and Me.Height (or ScaleHeight) and was using an if to check if they matched, sounds simple at first yea but in practise it doesnt work as expected
    Me.Height (when form is maximized) equals the Screen.Height but thats with the taskbar subtracted, so i could just use a (Sceen.Height - [Taskbar Height]) but you can easily change the height of the taskbar, so people that had it higher would get a bug on my form where it cant be resized (the size of form is being saved to registry)
    anyone know how to get around this or another method to detect if the form is maximized?

  2. #2
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    If Me.WindowState = vbMaximized then

    I'll double check that 'WindowState' is accurate, but I know it's close.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  3. #3
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    It is.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    cheers!

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    arg i got another problem how do i stop a form from being resized beyond a certain point without the if command just doing a Me.Height = 300 etc?
    (resize msn conversations they just lock when they get too small)

  6. #6

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    mate thast what im tryin atm but it makes the forum go all funny and flashy when its lower than my size

  8. #8

  9. #9

    Thread Starter
    Hyperactive Member
    Join Date
    Apr 2002
    Location
    UK
    Posts
    506
    it doesnt get lower than 300 (im actually using 4335) but when you reach the 4335 you can still drag the mouse beyond that point and it makes the form flash

  10. #10

  11. #11
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    Form flashing happens in all VB apps.

    You would have to subclass the message queue and cancel a form resize to have it not flash.

    It's not that big of a deal usually.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  12. #12
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    When I drag the outline of my form to make it smaller, it doesn't flash. It does however take a moment for the form's controls to be resized and so there is a visible delay in the controls becoming smaller.

  13. #13
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    Martin, see attached.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  14. #14
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    !! I attached a file

    Oh well, here it is AGAIN
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  15. #15
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    Looks like the boards are havin some issues.

    You can download the file here:

    http://dragonboard.com/fadeform.zip
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  16. #16
    Hyperactive Member Jason Badon's Avatar
    Join Date
    Feb 2001
    Location
    Colorado
    Posts
    329
    variation of example posted by MartinLiss


    VB Code:
    1. Private Sub Form_Resize()
    2.     On Error Resume Next
    3.     Me.Height = 3000
    4.     Me.Width = 3000
    5. End Sub

  17. #17
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    Lord_Rat: I see what you mean, but if you create a new project with nothing but

    If Me.Height < 300 Then Me.Height = 300
    If Me.Width < 300 Then Me.Width = 300

    in the form resize there is no flicker and the mouse can not be moved inside the borders in drag mode.

  18. #18
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    300 is too small to see this in action, so I used 2000 instead.

    Still flickers.

    VB Code:
    1. Option Explicit
    2.  
    3. Private Sub Form_Resize()
    4.     If Me.Width < 2000 Then Me.Width = 2000
    5.     If Me.Height < 2000 Then Me.Height = 2000
    6. End Sub
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  19. #19
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    Originally posted by Jason Badon
    variation of example posted by MartinLiss


    VB Code:
    1. Private Sub Form_Resize()
    2.     On Error Resume Next
    3.     Me.Height = 3000
    4.     Me.Width = 3000
    5. End Sub
    That doesn't let you resize larger either. If you were to use that code, you should just set the border style to fixed single.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  20. #20

  21. #21
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    Most likely 2 factors:

    1) Optical illusion (smaller screen is less easy to see)

    2) Faster repaint.

    In light of doing it 'right', see the (hopefully) attached.
    Attached Files Attached Files
    Last edited by Lord_Rat; May 11th, 2002 at 03:11 AM.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  22. #22
    Addicted Member OsirisX's Avatar
    Join Date
    May 2002
    Location
    Montgomery, AL
    Posts
    132

    Hope this helps

    You can--and actually I feel this is the best way--restrict resizing to your specified width and height.
    here's how to stop flickering:
    http://www.vb-world.net/controls/tip516.html
    here's a good example of how to restrict height and width:
    http://www.vb-helper.com/HowTo/sizeform.zip

    --Enjoy
    Osiris

  23. #23
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497


    I see you didn't look at the project I attached.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  24. #24
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    Also, your first link does NOT stop flickering during resizing. It stops it if you are updating elements ON the form
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

  25. #25
    Addicted Member OsirisX's Avatar
    Join Date
    May 2002
    Location
    Montgomery, AL
    Posts
    132
    Who pissed in your Wheaties?
    Chill out man. Sorry!

  26. #26
    C# Aficionado Lord_Rat's Avatar
    Join Date
    Sep 2001
    Location
    Cave
    Posts
    2,497
    I didn't mean it that way.

    I meant to state that the info you gave was already covered, that's all.
    Need to re-register ASP.NET?
    C:\WINNT\Microsoft.NET\Framework\v#VERSIONNUMBER#\aspnet_regiis -i

    (Edit #VERSIONNUMBER# as needed - do a DIR if you don't know)

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