|
-
Jun 2nd, 2001, 06:58 PM
#1
Thread Starter
New Member
How do I resize a form to match a bitmap?
I have an MDIChild form that opens from the MDIParents menu and displays a graphic(bmp,gif,jpg). My problem is that the MDIChild form needs to be match the size of the graphic, either by resizing the form or by resizing the graphic. Any help will be greatly appreciated.
TIA
J
-
Jun 2nd, 2001, 08:20 PM
#2
Good Ol' Platypus
Load the pic in an invisible pic box. Take the width & height from there. Put the pic on the form, and REMOVE the picturebox from the form. Then, me.height = the_height * screen.twipsperpixely , me.width = the_width * screen.twipsperpixelx. This will do the first one of your options.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
Jun 2nd, 2001, 09:53 PM
#3
Thread Starter
New Member
Thanks Sastraxi, I'm a little confused just how to REMOVE a pic box and which form all this should be taking place on. The files are opened with a common dialog control.
-----------------MDI--------------------
Option Explicit
Public pic As StdPicture
Private Sub mnuFileOpen_Click()
Dim myFlags As FileOpenConstants
myFlags = cdlOFNExplorer + cdlOFNFileMustExist
With cdl1
.Filter = "Graphics Files|*.jpg;*.gif;*.bmp|All Filles|*.*"
.Flags = myFlags
.CancelError = True
.InitDir = "c:\windows"
.DialogTitle = "Choose Picture"
.ShowOpen
Form1.Cls
Set pic = LoadPicture(.FileName)
Form1.Picture1.Picture = pic
End With
End Sub
-------------------------child------------------
Option Explicit
Public nuWidth As Integer
Public nuHigh As Integer
Private Sub Form_Load()
nuWidth = Picture1.ScaleWidth
nuHigh = Picture1.ScaleHeight
End Sub
-
Jun 3rd, 2001, 11:17 AM
#4
VB Code:
Private Sub Form_Resize()
Me.PaintPicture Picture1.Picture, 0, 0, ScaleWidth, ScaleHeight
End Sub
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
|