|
-
Jun 7th, 2006, 07:04 AM
#1
Thread Starter
Hyperactive Member
how to fix the form size to screen
I've created a form with sstab control on my pc(1280X768 screen resolution)
And i am trying to run the form on other pc(with 1280 X1024 screen resolution).The Form is fully designed with different controls(SStab..combo etc...)
I have the problem that the form is not displaying completely,
i can view only one part of the form.
Is it a problem with the screen resolution??
I used the following different types of code for resize.
but it is not working
??Any suggestionos please
VB Code:
Private Sub Form_Load()
Me.Height = Screen.Height
Me.Width = Screen.Width
End Sub
Private Sub Form_Load()
fme.Move Screen.Width - me.Width, Screen.Height - Me.Height
end sub
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) / 2, _
(Screen.Height - Me.Height) / 2
end sub
Thanks
-
Jun 7th, 2006, 07:10 AM
#2
PowerPoster
Re: how to fix the form size to screen
I actually posted something like this recently where I used me.width=screen.width (BTW, you forgot me.top = 0 and me.left=0 to make sure the form is at the top left) but there's a better way :-)
click on the form and in properties scroll down to "windowstate"...set this to maximised (and you could also set borderstyle to none if you want it looking totally full-screen :-))
-
Jun 7th, 2006, 08:03 AM
#3
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
ok i will try with this modification
thanks
-
Jun 7th, 2006, 08:10 AM
#4
Re: how to fix the form size to screen
I think this can be achieved if you set WindowState = 2-Maximized in design mode to your form.
No need to set height and width in form load event.
-
Jun 7th, 2006, 08:12 AM
#5
Re: how to fix the form size to screen
I would use the .Move property instead of the individual properties (.Left, .Top, etc.) so that the form re-size event only fires once.
Regards,
Mark
Please remember to rate posts! Rate any post you find helpful. Use the link to the left - "Rate this Post". Please use [highlight='vb'] your code goes in here [/highlight] tags when posting code. When a question you asked has been resolved, please go to the top of the original post and click "Thread Tools" then select "Mark Thread Resolved."
-
Jun 7th, 2006, 08:25 AM
#6
Re: how to fix the form size to screen
-
Jun 7th, 2006, 08:28 AM
#7
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
No it is not working
Me.Height = Screen.Height
Me.Top = 0
Me.Left = 0
Me.Width = Screen.Width
-
Jun 7th, 2006, 08:30 AM
#8
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
me.Move Screen.Width - me.Width, Screen.Height - Me.Height
it is also no working
i changed the design time properties to window state 2
but no use
-
Jun 7th, 2006, 08:36 AM
#9
Re: how to fix the form size to screen
do you have any other code in form resize?
-
Jun 7th, 2006, 08:41 AM
#10
PowerPoster
Re: how to fix the form size to screen
 Originally Posted by cssriraman
I think this can be achieved if you set WindowState = 2-Maximized in design mode to your form.
No need to set height and width in form load event.
Read my reply...'s what I said :-P
-
Jun 7th, 2006, 08:46 AM
#11
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
click on the form and in properties scroll down to "windowstate"...set this to maximised (and you could also set borderstyle to none if you want it looking totally full-screen :-)) ..This one??
Yes i used this one also smux
no there is no other code to change the form design,cssriraman
border style=none
window state maximized
VB Code:
Me.Move (Screen.Width - Me.Width) / 2, _
(Screen.Height - Me.Height) / 2
Or
i am trying with
No it is not working
VB Code:
Me.Height = Screen.Height
Me.Top = 0
Me.Left = 0
Me.Width = Screen.Width
-
Jun 7th, 2006, 08:51 AM
#12
PowerPoster
Re: how to fix the form size to screen
there's not much I can say except at the END of the form_load put "msgbox form1.windowstate" (replace form1 with the form's name) and see if that returns "maximised"...if not, try putting "form1.windowstate = maximised" IN the actual Form_Load (again, replace name)
-
Jun 7th, 2006, 08:56 AM
#13
Re: how to fix the form size to screen
is your problem that it's not displaying maximized or that it's cutting the controls off?
if the latter then you have to position your controls in the Form_Resize event of the form - it won't do it automatically for you.
-
Jun 7th, 2006, 09:04 AM
#14
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
Even i put my windowstate maximize state it is not full maximizing in other pc
my sstab fully not visible
-
Jun 7th, 2006, 09:05 AM
#15
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
other thing is i am trying to print windowstate
like msgbox form1.windowstate in form load then
it is giving value 0 not 2
-
Jun 7th, 2006, 09:07 AM
#16
PowerPoster
Re: how to fix the form size to screen
Then it's telling you that it isn't doing it. Make the FIRST line in form_load "form1.windowstate = 2"
Sometimes you have to poke VB with a sharp stick to make it do things, it doesn't like your choices in properties and decides to use its own...you have to manually set them in the code :-)
-
Jun 7th, 2006, 09:08 AM
#17
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
Already i did it
but no use
it is showing as 0
form1.WindowState = 2
-
Jun 7th, 2006, 09:12 AM
#18
PowerPoster
Re: how to fix the form size to screen
me.windowstate = 2 also works and would work in any form_load for any form...try commenting out everything else in the form.
And when you say "isn't working" what exactly is the problem?
-
Jun 7th, 2006, 09:15 AM
#19
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
yes i just tried taking a new project and only with one form,without any code
and in form load just one message.
Form design properties windowstate =2
Sub Form_Load()
MsgBox Form1.WindowState
End Sub
it returns 0
i don't know why?
-
Jun 7th, 2006, 09:19 AM
#20
PowerPoster
Re: how to fix the form size to screen
as I said above, put "form1.windowstate = 2" INTO form_load on the new project...it's exactly what I did and it works fine
-
Jun 7th, 2006, 09:20 AM
#21
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
Private Sub Command1_Click()
MsgBox Form1.WindowState
End Sub
Private Sub Form_Load()
MsgBox Form1.WindowState
End Sub
in form load it is showing 0
and in command1_click it is showing 2
i don't know what it is?
-
Jun 7th, 2006, 09:20 AM
#22
Re: how to fix the form size to screen
it returns 0 because the form is not maximized.
If you set the WindowState in the property window then the form will be set to that state once Form_Load() has finished.
-
Jun 7th, 2006, 09:22 AM
#23
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
but in design time i change the property to 2
.If i want put it in form load what should i do?
-
Jun 7th, 2006, 09:25 AM
#24
PowerPoster
Re: how to fix the form size to screen
http://www.vbforums.com/showpost.php...9&postcount=20
I just told you EXACTLY what to do to put it into form_load...not put msgbox line but put the line I said in post 20
-
Jun 7th, 2006, 09:25 AM
#25
Re: how to fix the form size to screen
when initially loaded all forms have their windowstate set to 0 - regardless of what you did at design time.
why is that problem? - when the form is shown it will be maximized.
-
Jun 8th, 2006, 02:47 AM
#26
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
Still my form is not completely maximized in my frd system.
-
Jun 8th, 2006, 04:17 AM
#27
Re: how to fix the form size to screen
Start a new project with no code in the form, set Windowstate to maximised in the "Properties" window.
Run it in the IDE. If it's NOT maximised, you may have to re-install VB.
If it IS maximised, create the exe and see what it does on BOTH PCs.
If it works on yours but not on the other..........
-
Jun 8th, 2006, 05:01 AM
#28
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
That is the problem,
In my system it is working,i.e. maximized., but not in other system
-
Jun 8th, 2006, 05:19 AM
#29
Re: how to fix the form size to screen
Then the problem is with your 2nd PC, not your program.
Last edited by schoolbusdriver; Jun 10th, 2006 at 02:11 AM.
Reason: Clarification...
-
Jun 8th, 2006, 06:18 AM
#30
Junior Member
Re: how to fix the form size to screen
And try deleting that sstab control !!!!
-
Jun 12th, 2006, 05:07 AM
#31
Thread Starter
Hyperactive Member
Re: how to fix the form size to screen
yes the problem with second pc, not with my pc
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
|