Using editable bitmaps

I posted a couple of inquiries regarding using embedded bitmaps. I got no response from the forum, but I wanted to report the results of my experimentation. This may help someone down the road.

I wanted to be able to embed a bitmap in a form so that the user could edit and save it. Then I needed to copy the bitmap into a summary form which was to be printed out for the clients signature.

To embed the MS Paint object, I created a rich text field and placed a button on the work sheet form with this code:

Sub Click(Source As Button)

Dim workspace As New NotesUIWorkspace

Dim uidoc As NotesUIDocument

Set uidoc = workspace.CurrentDocument

If uidoc.FieldGetText(“blnBitmapLoaded”) <> “Y” Then

Call uidoc.GotoField( "rtfBitmap" )

Set bmp = uidoc.CreateObject("Diagram", "Paint.Picture")

Call uidoc.FieldSetText("blnBitmapLoaded", "Y" )

End If

End Sub

This code could just as easily run in the code that creates the form in the first place, rather than in a button.

The reference to “Paint.Picture” is a reflection of my Windows registry entry.

This creates an MSPaint object in the rich text field. Note that MSPaint does not allow OLE automation, so you can’t programmatically access any methods as you would with MS Excel or MS Word. But the users can use it as an embbedded Paint object. They can edit and save the bitmap on the form. Paint controls appear when the bitmap is opened for editing, or double-clicked.

Now to grab the image and insert it into the summary form.

In the lotuscript that creates the summary, I have this code:

If docWorkSheet.HasItem(“rtfBitmap”) Then

Set itemA = docWorkSheet.GetFirstItem( “rtfBitmap” )

Set itemA = itemA.CopyItemToDocument( docSummary, rtfField3 )

End If

rtfField3 is a string variable that has been set to the value of the name of the rich text field on the summary form.

The code grabs the contents of the worksheets rich text field and copies it to an already existing rich text field on the summary form. If the user double clicks on the bitmap on the summary form, it doesn’t allow him to edit it. Which is exactly what I wanted. All I wanted is for the bitmap to be seen on the summary and to print off properly.

Hope this helps someone.

Subject: thanks for sharing