rodf
09-17-2000, 02:33 AM
Does anybody knows how to determinate the size of a image before loading it, so you can handle it to adjust it to the window size(what most of the image editors do)? Thanks for helping!!
ripley
ripley
Getting image sizerodf 09-17-2000, 02:33 AM Does anybody knows how to determinate the size of a image before loading it, so you can handle it to adjust it to the window size(what most of the image editors do)? Thanks for helping!! ripley johnjr 09-17-2000, 03:41 AM here is the code you need........the line with c:*.bmp is where you pic is located on your hd. create a form with 2 picturebox controls....the first one being number 1, ontop of each other.also put a vscroll1 and hscroll1 control on the form.then copy and paste the above code. john Private Sub Form_Load() Me.ScaleMode = vbmilliemeter Picture1.ScaleMode = vbmillimeter Picture2.AutoSize = True Picture1.BorderStyle = 0 Picture2.BorderStyle = 0 Picture2.Picture = LoadPicture("c:*.bmp") Picture1.Move 0, 0, ScaleWidth - VScroll1.Width, ScaleHeight - HScroll1.Height Picture2.Move 0, 0 HScroll1.Top = Picture1.Height HScroll1.Left = 0 HScroll1.Width = Picture1.Width VScroll1.Top = 0 VScroll1.Left = Picture1.Width VScroll1.Height = Picture1.Height HScroll1.Max = Picture2.Width - Picture1.Width VScroll1.Max = Picture2.Height - Picture1.Height VScroll1.Visible = (Picture1.Height < Picture2.Height) HScroll1.Visible = (Picture1.Width < Picture2.Width) End Sub Private Sub Form_Resize() ' When the form is resized, change the Picture1 ' dimensions.'' Picture1.Height = Me.Height Picture1.Width = Me.Width ' Reinitialize the picture and scroll bar positions.' Picture1.Move 0, 0, ScaleWidth - VScroll1.Width, ScaleHeight - HScroll1.Height Picture2.Move 0, 0 HScroll1.Top = Picture1.Height HScroll1.Left = 0 HScroll1.Width = Picture1.Width VScroll1.Top = 0 VScroll1.Left = Picture1.Width VScroll1.Height = Picture1.Height HScroll1.Max = Picture2.Width - Picture1.Width VScroll1.Max = Picture2.Height - Picture1.Width ' Check to see if scroll bars are needed.' VScroll1.Visible = (Picture1.Height < Picture2.Height) HScroll1.Visible = (Picture1.Width < Picture2.Width) End Sub Private Sub HScroll1_Change() Picture2.Left = -HScroll1.Value End Sub Private Sub Picture2_DblClick() Unload Form3 frmMAIN.Show End Sub Private Sub Picture2_Resize() Me.HScroll1.LargeChange = Me.Picture2.ScaleWidth 2 Me.VScroll1.LargeChange = Me.Picture2.ScaleHeight 2 End Sub Private Sub VScroll1_Change() Picture2.Top = -VScroll1.Value End Sub rodf 09-17-2000, 06:20 PM Hi,thanks for the code it works great. ripley |
EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum