|
-
Aug 21st, 2000, 04:39 PM
#1
Thread Starter
Fanatic Member
Funny name huh?
Anyway, I know there is a method of resizing a control (such as a text box) to the client size of a form. I need to resize the form so it's client size is the size of a control.
-
Aug 21st, 2000, 04:42 PM
#2
Monday Morning Lunatic
Code:
Me.Width = Control.Width
Me.Height = Control.Height
Is that what you were looking for?
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 21st, 2000, 04:43 PM
#3
you mean like this?
Code:
Private Sub Form_Resize()
On Error Resume Next
Text1.Left = 0
Text1.Top = 0
Text1.Width = Me.Width
Text1.Height = Me.Height
End Sub
-
Aug 21st, 2000, 05:10 PM
#4
Thread Starter
Fanatic Member
neither of those would work. the first would make the outside of the form the same size as the form. need to set just the client area.
the second resizes the control. I need to resize the form.
-
Aug 21st, 2000, 05:24 PM
#5
_______
<?>
If you have listbox and you wanted the form to be the size of the listbox then the first method would do that.
ie.
Form1.Widht = List1.Width
Form1.Height = List1.Height
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 21st, 2000, 05:27 PM
#6
so you need to do this???
Code:
Private Sub Form_Load()
Me.Width = Control.Width
Me.Height = Control.Height
End Sub
??
-
Aug 21st, 2000, 05:38 PM
#7
Thread Starter
Fanatic Member
this is what happens when i use that code. screenshot at http://agent_153.tripod.com/problem.gif
i need the form to fit around the control, without resizing the control, but resizing the form
-
Aug 21st, 2000, 05:56 PM
#8
Code:
Private Sub Form_Load()
Me.Width = Control.Width + 5
Me.Height = Control.Height + 5
End Sub
you may have to change the numbers a little.
-
Aug 21st, 2000, 06:29 PM
#9
_______
<?>
this should work...alows you to move the textbox to a
positon where the form can size itself around it and
then put your form back to it's original state.
'This will resize it to the size of the textbox
'and wrap around it...then you can double click
'the textbox to reset your form to it's origial stature
Code:
Option Explicit
Public tl As Integer, tt As Integer
Public fh As Integer, fw As Integer
'
'command button call cmdShrink
Private Sub cmdShrink_Click()
tt = Text1.Top
tl = Text1.Left
fh = Form1.Height
fw = Form1.Width
Form1.Height = Text1.Height + 380
Form1.Width = Text1.Width + 80
Text1.Top = 0
Text1.Left = 0
End Sub
Private Sub Text1_DblClick()
Text1.Left = tl
Text1.Top = tt
Form1.Height = fh
Form1.Width = fw
End Sub
"A myth is not the succession of individual images,
but an integerated meaningful entity,
reflecting a distinct aspect of the real world."
___ Adolf Jensen
-
Aug 21st, 2000, 06:53 PM
#10
Thread Starter
Fanatic Member
that's the problem. i need to figure out how much to offset the size of the form by. I don't want to hardwire the numbers like above, incase the user has weird windows desktop settings.
I think i can fgure the size of the border by comparing scalewdthi to width (same with height)
I'll post back if it doesn't work
-
Aug 21st, 2000, 06:56 PM
#11
Monday Morning Lunatic
Look under: HKEY_CURRENT_USER\Control Panel\Desktop\WindowMetrics for the sizes
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Aug 21st, 2000, 07:01 PM
#12
Thread Starter
Fanatic Member
OK, i figured it out:
Code:
Private Sub Form_Load()
Dim bw&
Dim bh&
With Text1
bw = Width - ScaleWidth
bh = Height - ScaleHeight
Me.Width = .Width + bw
Me.Height = .Height + bh
.Top = 0
.Left = 0
End With
End Sub
-----
scaleheight/scalewidth return the client size (changing them sets the user scalemode) while width/height return the outer rectangle of the form.
[Edited by agent on 08-21-2000 at 08:03 PM]
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
|