CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Aug 2000
    Posts
    265

    Scaling picture box

    I want the picture in the cell of the MSFlexgrid to resize to a smaller size than the original picture (picture box). For example, if the picture is 5000x5000 twips.....I would like just a thumbnail to show in the grid at 500x500.

    I cannot seem to find a way to scale/stretch a picture inside the cell of a MSFlexgrid.



  2. #2
    Join Date
    May 2000
    Location
    New York, NY, USA
    Posts
    2,878

    Re: Scaling picture box

    You have a few choices, you can either increase the size of the cell to the size of the icon or use
    an intermediate picture box to draw the icon onto and then into the cell:

    With MSFlexGrid1
    .Col = 1
    .Row = 4
    Picture1.Width = .RowHeight(.Row)
    Picture1.Height = .RowHeight(.Row)
    Picture1.AutoRedraw = True
    Picture1.PaintPicture LoadPicture("MyIcon.ico"), 0, 0, Picture1.ScaleWidth, Picture1.ScaleHeight
    Set .CellPicture = Picture1.Image
    End With

    This paints the icon onto the picture box with the correct dimensions for the cell then loads this image
    into the cellpicture property.

    Iouri Boutchkine
    [email protected]
    Iouri Boutchkine
    [email protected]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured