Go Back   TX Text Control Community > TX Text Control Discussion and Support Forums > TX Text Control .NET

TX Text Control .NET Please use this forum for TX Text Control .NET support only. If you need support for a different product, please use the appropriate forum.

Reply
 
Thread Tools Display Modes
  #1  
Old February 26, 2010
sjngoal sjngoal is offline
Registered User
 
Join Date: Sep 2009
Posts: 10
images added from memory

how can I add a filename or index to an image that has been added from memory? A user can add multiple images and delete them but I need to know the image that the user double clicked on becuase we send a byte array of the image to edit the image. But I need to know which byte array to send. Here is my code to get the image into the text control but how do I assign a unique value once this is done. The file does not exist on disk. It is stored as binary in the db.

Dim stream As New System.IO.MemoryStream
Dim buffer() As Byte
Dim RTFString As String
Dim ImageString As New System.Text.StringBuilder

Dim img As Image = byteArrayToImage(aNode.Tag("ImageFile"))
Dim strFileUniqueKey As String = GenerateRandomKey() & Path.GetFileName(aNode.Tag("FileName"))

da.UpdatePatientNoteImages("UpdatePatientNoteImage s", PatientID, ApplicationInfo.UserID, CInt(NoteID.Text), strFileUniqueKey, imageToByteArray(img, strFileUniqueKey))

img.Save(stream, System.Drawing.Imaging.ImageFormat.Jpeg)
buffer = stream.ToArray()

For Each nbyte As Byte In buffer
ImageString.Append(nbyte.ToString("x2"))
Next

RTFString = "{\rtf1" + vbCr

RTFString += "{\shp{\*\shpinst\shpfhdr0\shpbxcolumn\shpbypara\s hpwr2\shpwrk0\shpfblwtxt0\shplid1025{\sp{\sn shapeType}{\sv 75}}{\sp{\sn dxWrapDistLeft}{\sv 0}}{\sp{\sn dxWrapDistRight}{\sv 0}}{\sp{\sn pib}{\sv "

RTFString += "{\pict\jpegblip\picscalex50\picscaley50" + vbCr
RTFString += ImageString.ToString()
RTFString += "}}"

RTFString += "\par}"

tx.Selection.Load(RTFString, TXTextControl.StringStreamType.RichTextFormat)
Reply With Quote
  #2  
Old February 26, 2010
Reallyethical's Avatar
Reallyethical Reallyethical is offline
TX Text Control MVP
 
Join Date: Sep 2008
Location: Derby, England
Posts: 230
Send a message via Skype™ to Reallyethical
Re: images added from memory

If your using 15.1 then just use the ID property.
Reply With Quote
Reply

Bookmarks

Tags
images , stream

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
printpreview doesn't work with images added with DisplaceCompleteLines David Burson TX Text Control .NET 0 August 20, 2008 18:25:08
Inserting images from memory tnoel TX Text Control .NET 2 November 12, 2007 15:14:43
Loading images from memory wizzard TX Text Control .NET 2 March 1, 2005 14:19:21
HTML + Images = Insufficient Memory Error? bcpCharles TX Text Control .NET 2 December 27, 2004 22:15:25
Inserting images from memory Unregistered TX Text Control ActiveX 1 December 6, 2002 11:02:35


All times are GMT +1. The time now is 06:20:44.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
© 1991 - 2010 The Imaging Source Europe GmbH