Re: Update a graphic and save it



After posting the question, I had found some information including the
link you provided. In process of reading all the info now. I had
discovered that saving the image as opposed to the picture would keep the
text I had written, but since the image won't fit on the screen, saving it
also causes it to get 'truncated' to that portion that was visible in the
picturebox at the time it was saved. Thought that I might be able to get
away with loading the bitmap to an image control and then calling
textout(image1.picture.handle, ....., but that did not work either.

The .Handle property of a StdPicture object (assuming its type is set to vbPicTypeBitmap) is a hBitmap, where as
TextOut() requires a hDC. As such if you're happy using the TextOut() call directly and managing your own API font
objects, then simply create a new DC and select the Bitmap handle into it:

'***
Dim hDC As Long
Dim hOldBitmap As Long

hDC = CreateCompatibleDC(0)
hOldBitmap = SelectObject(hDC, Image1.Picture.Handle)

TextOut(hDC, ... )

Call SelectObject(hDC, hOldBitmap)
Call DeleteDC(hDC)
'***

You may also want to take a look at my APIDraw library, which encapsulates all the font creation stuff for you.
Hope this helps,

Mike


- Microsoft Visual Basic MVP -
E-Mail: EDais@xxxxxxxx
WWW: Http://EDais.mvps.org/


.



Relevant Pages

  • Re: Clip capture
    ... "when you say you are "getting a negative number on the hDC" do you ... "If the Autoredraw property of the picture box on the second Form is True ... "And does your code set up the picture box to the size of the blit *and* do ... > the bitmap is smaller than the blit, but with the "extra bitmap area" ...
    (comp.lang.basic.visual.misc)
  • Re: Update a graphic and save it
    ... In process of reading all the info now. ... discovered that saving the image as opposed to the picture would keep the ... text I had written, but since the image won't fit on the screen, saving it ... If you want to go the API route then my SaveDIBfunction here will do ...
    (microsoft.public.vb.winapi.graphics)
  • Re: copy picture out of word with full resolution?
    ... Why are you pasting the picture into Word in the first place? ... image using the web page option will create a jpg even if the original ... To preserve image quality you would be better served saving the image ... I paste a high resolution picture into Word. ...
    (microsoft.public.word.newusers)
  • Re: Unknown pointer problem between Visual Basic and C
    ... the picture box must be visible for the drawing to take effect. ... - Does your C code cache the HDC for use later? ... Dim hbr As Long ...
    (microsoft.public.win32.programmer.gdi)
  • Re: Unknown pointer problem between Visual Basic and C
    ... Draw into a picture area. ... except drawing from Visual Basic (HDC seems to be wrong). ... I send to the "Visual Basic wrapper" built in C, dimensions and DC pointer ...
    (microsoft.public.win32.programmer.gdi)