happy new year to you all,
i have a program that views pictures. The pictures could have different sizes. Some are bigger than the screen size, some are smaller than that. I want to display the entire content of the picture in image control or picture control like windows pic and fax viewer does:
i tried this but it failed to work:
NB: picture is added to image1 from database application. How does these thing work please?Code:Option Explicit Private Sub Form_Load() Dim scrw As Double Dim scrh As Double Dim imgw As Double Dim imgh As Double scrw = Screen.Width / Screen.TwipsPerPixelX scrh = Screen.Height / Screen.TwipsPerPixelY imgw = Image1.Width / 15 imgh = Image1.Height / 15 MsgBox Image1.Width If imgw > scrw Then Image1.Width = Screen.Width Me.Move 0, 0 Else Me.Width = Image1.Width End If If imgh > scrh Then Image1.Height = Screen.Height Me.Move 0, 0 Else Me.Height = Image1.Height End If Me.Width = Image1.Width Me.Height = Image1.Height Me.Top = 0 Me.Left = 0 End Sub Private Sub Image1_Click() Unload Me End Sub




Reply With Quote