Re: How to copy a stretched image to clipboard?

Giganews Newsgroups
Subject: Re: How to copy a stretched image to clipboard?
Posted by:  Larry Serflaten (serflat…@usinternet.com)
Date: Sat, 2 May 2009

"dos-man 64" <ChairSh…@mail.com> wrote
> The icon is first loaded into a picture control. This allows you to
> view the actual size of the icon.  Then the icon is copied into an
> image control, which allows for a ZOOM feature by setting
> IMAGE1.STRETCH  =  true.
>
> There doesn't seem to be any way to copy the stretched image short of
> alt+prntscr.
>
> Image controls do not have an HDC, so I'm at a loss...  Anyone have
> any ideas on how this can be done?

The Image control does not stretch the picture.  The original image is unchanged.
What you see is only a change in how the image is displayed.

To retain the icon's transparency, do it the other way around.  Load the icon
into the Image control (Stretch set to False) and then paint in onto the
Picture control at its increased size.  You can use PaintPicture to paint the
icon.  What you can't do is add an icon to the Clipboard.  As you saw, it
only accepts bitmap (or DIB) types.  Depending on what you are doing,
you might be able to work it out using OLE Drag and Drop rather than
using the Clipboard  (???)

For an example of using PaintPicture, add the code below to a form,
and run it.  Then click on the form to see a large (Form default) icon.

LFS

Private Sub Form_Click()
  ' Paint the icon
  PaintPicture Icon, 1000, 1000, 4000, 4000
End Sub

Private Sub Form_Load()
Const BKG = "BACKGROUND"
  ' Some Background artwork
  AutoRedraw = True
  DrawWidth = 15
  Circle (3000, 3000), 2000, vbRed
  Font.Size = 38
  CurrentX = 3000 - (TextWidth(BKG) / 2)
  CurrentY = 2700
  Print BKG
End Sub

Replies

In response to

How to copy a stretched image to clipboard? posted by dos-man 64 on Fri, 1 May 2009