Documentation / Marblecore Imaging / Methods / SaveToHBitmap
SaveToHBitmap method
Returns a HBITMAP for the current image which can be used to draw the image with high speed to a canvas like a Windows Form. This method is not available in the ATL version of the image component.
Syntax
HBITMAP SaveToHBitmap(nLeft As Number, nTop As Number, nWidth As Number, nHeight As Number)
Return value
Returns a HBITMAP if the function succeeded or NULL if the function failed.
Parameters
Parameter | Type | Required | Description |
nLeft | Number | No | Optional parameter which specifies the left coordinate of the rectangle to return. |
nTop | Number | No | Optional parameter which specifies the top coordinate of the rectangle to return. |
nWidth | Number | No | Optional parameter which specifies the width of the rectangle to return. |
nHeight | Number | No | Optional parameter which specifies the height of the rectangle to return. |
Example
The
SaveToHBitmap method can be used to display an image in a .NET PictureBox or to create a System.Drawing.Bitmap of the image. In the example below we convert the image to a .NET bitmap and display it in a PictureBox with name
pictureBox1. The example is written in C#.
1
2 MarblecoreImaging Imaging = new MarblecoreImaging();
3
4
5 if (Imaging.Create(200, 200))
6 {
7 Imaging.DrawRectangleFilled(0, 0, 200, 200, Imaging.GetColorFromHTML("#ff0000"));
8
9
10 pictureBox1.Image = Image.FromHbitmap(Imaging.SaveToHBitmap());
11 }
Category
Basic operations
See also
Create |
Deserialize |
LoadFromBase64 |
LoadFromFile |
LoadFromSerializedStream |
LoadFromStream |
LoadFromURL |
Reset |
SaveToBase64 |
SaveToFile |
SaveToHBitmapPreMultiplied |
SaveToStream |
Serialize