if you set the form's size using form.width or .height, it will not set it's clientsize to that size. I'm wondering how I can set the clientsize of a form, which is, the size of the form ignoring the title bar size and other stuff
Printable View
if you set the form's size using form.width or .height, it will not set it's clientsize to that size. I'm wondering how I can set the clientsize of a form, which is, the size of the form ignoring the title bar size and other stuff
Try this :
VB Code:
Me.Location = New Point((Me.ClientSize.Width / 2) - (Me.Size.Width / 2), (Me.ClientSize.Height / 2) - (Me.Size.Height / 2))
location?! no no
the form's size
If I say frm.Size = new size (100,100), I think the form will be 100x100 pixels. But what I want is to have the form's client size to be 100x100 (which is the form's size excluding the title bar's size)
unfortunatly you cant assign a value to form.clientsize
Is this what you want ?
VB Code:
Me.ClientSize = New System.Drawing.Size(Me.ClientSize.Width, Me.ClientSize.Height) 'or Me.ClientSize = New System.Drawing.Size(100, 100)
YOU CAN DO THAT>?!!! WAA:eek:Quote:
Originally posted by Pirate
Is this what you want ?
VB Code:
Me.ClientSize = New System.Drawing.Size(Me.ClientSize.Width, Me.ClientSize.Height) 'or Me.ClientSize = New System.Drawing.Size(100, 100)
why did I think ClientSize is readonly? hmm!!!! I gotto get home and try it then:D you better be right or I'll kill you (if you ARE right, then I should kill myself ;) )
I'm afraid you'll get it right and you still insist to kill Pirate:rolleyes: ...................:confused:
anways , you could tried something like this :
VB Code:
Dim siz As New Size(100, 100) Me.ClientSize = siz
aaah :( this isnt working
I set the form's size like this:
me.clientsize = someBitmap.size
I check the clientSize of the form with the immediate window, and it matches the bitmap's size. But it doesnt look like it really does match it. The height seems ok, but the width is a bit larger for some reason. Here, see it for yourself:
http://vbforums.com/attachment.php?postid=1520482
I don't get it , but it works good here . Maybe you implementing it different way . I don't know. :confused: see the image below :
hmm tnx you forced me to make another form and try it in there....
the problem I think was that I was doing that code in the New constructor... when I put it in LOAD it works fine :)
edit: ok actually it was something else, now this stupid autoscroll feature of the form is driving me crazy