I am trying to render an API image to a background (image) memory location then use that image as a source for a BitBlt API call.
In my former life as a VB6 programmer I could simply render the image to a PictureBox (located off screen) with AutoRedraw = True.
I realize that this wasn't 'technically' rendering to memory but it served the purpose of giving me an 'off screen' intermediate memory location that had a HDC handle so I could use the hidden image as a source for BitBit.
I now find myself in the .NET - C# (C sharp) world trying to accomplish this same feat.
I can render from the EM_Message to an intermediate picture box but if it is not located in a visable area of the screen, it will not render. This method acts like the old VB6 PictureBox with AutoRedrw = False.
I made a stab it it below....
1st I create a memory bitmap called intImage...
Bitmap intImage = new Bitmap(533, 165);
then get a handle to it...
IntPtr memHDC = intImage.GetHbitmap();
I have a feeling that maybe I am not creating a 'Graphic' but I am unsure how to do that?
Or maybe I just missing something simple that would allow me to render an API painted image in the background.
FYI - Note: I am using EM_FORMATRANGE (below) to render the initial image and it works fine when rendered to a PictureBox.
//Render the selected RTF text into the tempPicBox hdc (from FORMATRANGE structure)
res = SendMessage(Handle, EM_FORMATRANGE, wparam, lparam);
Thank You in advance for your time and kind assistance.