카테고리 없음

이미지의 크기 변경하는 로직 잘 됨

FIL. 2006. 10. 24. 06:24
728x90
    Dim p1 As StdPicture
    Dim oldwide As Long, oldhigh As Long
    Dim newwide As Long, newhigh As Long
    Me.ScaleMode = vbPixels
    
   Picture1.BorderStyle = vbBSNone
    Picture1.ScaleMode = vbPixels
    Picture1.AutoRedraw = True
   
   ' load a jpeg
    Set p1 = LoadPicture(App.Path & "\test.jpg")
   
   ' get the width and height of the jpeg in pixels
    oldwide = Me.ScaleX(p1.Width, vbHimetric, vbPixels)
    oldhigh = Me.ScaleY(p1.Height, vbHimetric, vbPixels)
       
   ' make picture box width and height one tenth original
    newwide = oldwide / 10: newhigh = oldhigh / 10
    Picture1.Move 0, 0, newwide, newhigh
   
   ' paint the jpeg into it at the new reduced size
    Picture1.PaintPicture p1, 0, 0, newwide, newhigh
    Picture1.Picture = Picture1.Image
    SavePicture Picture1.Picture, App.Path & "\testpicsmall.bmp"