May 10th, 2002, 12:22 PM
#1
Thread Starter
Hyperactive Member
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:
Private Sub Form_Resize()
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?
May 10th, 2002, 12:23 PM
#2
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)
May 10th, 2002, 12:23 PM
#3
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)
May 10th, 2002, 12:24 PM
#4
Thread Starter
Hyperactive Member
cheers!
May 10th, 2002, 12:38 PM
#5
Thread Starter
Hyperactive Member
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)
May 10th, 2002, 12:46 PM
#6
Code:
Private Sub Form_Resize()
On Error Resume Next ' Needed if the form is minimized
If Me.Width < 300 Then
Me.Width = 300
End If
If Me.Height < 300 Then
Me.Height = 300
End If
End Sub
May 10th, 2002, 12:47 PM
#7
Thread Starter
Hyperactive Member
mate thast what im tryin atm but it makes the forum go all funny and flashy when its lower than my size
May 10th, 2002, 12:49 PM
#8
Are you saying that it gets lower than 300?
May 10th, 2002, 12:51 PM
#9
Thread Starter
Hyperactive Member
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
May 10th, 2002, 12:54 PM
#10
Something else must be going on because it works perfectly for me in my project and you should not be able to "still drag the mouse beyond that point".
May 10th, 2002, 01:11 PM
#11
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)
May 10th, 2002, 01:16 PM
#12
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.
May 10th, 2002, 01:26 PM
#13
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)
May 10th, 2002, 01:29 PM
#14
!! 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)
May 10th, 2002, 01:30 PM
#15
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)
May 10th, 2002, 01:36 PM
#16
Hyperactive Member
variation of example posted by MartinLiss
VB Code:
Private Sub Form_Resize()
On Error Resume Next
Me.Height = 3000
Me.Width = 3000
End Sub
May 10th, 2002, 02:03 PM
#17
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.
May 10th, 2002, 02:09 PM
#18
300 is too small to see this in action, so I used 2000 instead.
Still flickers.
VB Code:
Option Explicit
Private Sub Form_Resize()
If Me.Width < 2000 Then Me.Width = 2000
If Me.Height < 2000 Then Me.Height = 2000
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)
May 10th, 2002, 02:10 PM
#19
Originally posted by Jason Badon
variation of example posted by MartinLiss
VB Code:
Private Sub Form_Resize()
On Error Resume Next
Me.Height = 3000
Me.Width = 3000
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)
May 10th, 2002, 02:16 PM
#20
You are right, but that's pretty strange. Do you know why the size matters?
May 10th, 2002, 04:04 PM
#21
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
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)
May 10th, 2002, 07:21 PM
#22
Addicted Member
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
May 10th, 2002, 07:34 PM
#23
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)
May 10th, 2002, 07:37 PM
#24
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)
May 10th, 2002, 10:15 PM
#25
Addicted Member
Who pissed in your Wheaties?
Chill out man. Sorry!
May 10th, 2002, 10:16 PM
#26
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
Forum Rules
Click Here to Expand Forum to Full Width