Open the Picture off-screen and then scale it so that the largest
dimension is a maximum of 100 pixels then draw it to the imagewell.

Function ScalePicture(myfile As FolderItem)
  Dim p1,p2 As Picture
  Dim w,h,x,y,wn,hn As Integer
  Dim r As double
  
  p1 = myfile.OpenAsPicture
  
  w = p1.Width
  h = p1.Height
  
  If w > h Then
    r = (w / 100)
    wn = 100
    hn = (h / r)
    x = 0
    y = (99 - hn) / 2
  ElseIf h > w Then
    r = (h / 100)
    wn = (w / r)
    hn = 100
    x = (99 - wn) / 2
    y = 0
  Else // w and h must be equal
    wn = 100
    hn = 100
    x = 0
    y = 0
  End If
  
  p2 = New Picture(100,100,32)
  
  p2.Graphics.DrawPicture p1,x,y,wn,hn,0,0,w,h
  
  ImageWell1.Image = p2

End Function


> How does one set an OpenDialog so that the picture being 
> opened is only to a set size?  I can only have pictures that 
> are 100x100 in size, any bigger then is will not fit all into 
> the ImageWell.
> 
> Thanks
> 
> Jonathon 
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to