Make the default transparent color transparent to this Bitmap.
Overload list
Make the default transparent color to this Bitmap object transparent.
[Visual Basic]
Overloads public sub manetransparent ()
[C #]
Public void manetransparent ();
[C ]
Public: void manetransparent ();
[Jscript]
Public function manetransparent ();
Transparently to this Bitmap object on this Bitmap object.
[Visual Basic]
Overloads Public Sub MakeTransparent (Color)
[C #]
Public Void MakeTransparent (Color);
[C ]
Public: Void MakeTransparent (Color);
[Jscript]
Public Function MakeTransparent (Color);
Example
[Visual Basic, C #] The following example is intended to use the Windows Form, which requires Painteventargs E (this is the parameter of the Paint event handler). Code performs the following:
Get the color of the pixels in the Bitmap object. The color is transparent to the bitmap. Draw the Bitmap object to the screen.
[Visual Basic, C #]
Note that this example shows how to use
A overload version of MakeTransparent. For other available examples, see a separate overload topic.
[Visual Basic]
Public Sub MakeTransparent_example (e as painteventargs)
'Create a Bitmap Object from an image file.
DIM MyBitmap As New Bitmap ("Grapes.gif")
'Draw mybitmap to the screen.
E.Graphics.drawImage (Mybitmap, 0, 0, Mybitmap.width, _
mybitmap.height)
'Get The Color of a Background Pixel.
DIM backcolor as color = mybitmap.getpixel (1, 1)
'Make Backcolor Transparent for Mybitmap.
Mybitmap.maketransparent (Backcolor)
'Draw the Transparent Bitmap to the screen.
E.Graphics.drawImage (mybitmap, mybitmap.width, 0, mybitmap.width, _
mybitmap.height)
End Sub
[C #]
Public void makeTransparent_example (Painteventargs E)
{
// CREATE A Bitmap Object from an image file.
Bitmap mybitmap = new bitmap ("grapes.gif");
// draw mybitmap to the screen.
E.Graphics.drawImage (
Mybitmap,
0,
0,
Mybitmap.width,
mybitmap.height);
// Get The Color of a Background Pixel.
Color backcolor = mybitmap.getpixel (1, 1);
// make backcolor transparent for mybitmap.mybitmap.maketransparent (Backcolor);
// Draw the Transparent Bitmap to the screen.
E.Graphics.drawImage (
Mybitmap,
Mybitmap.width,
0,
Mybitmap.width,
mybitmap.height);
}
[C , JScript] No examples of C or JScript. To view the Visual Basic or C # example, click the "Language Filter" button in the upper left corner.
See
Bitmap class | Bitmap member | system.drawing namespace
Syntax document version 1.1.1 based on .NET Framework version 1.1.1
Send an opinion about this topic
TabINDEX = "0" keywords = "Copybeta_nonfidential"> © Microsoft Corporation. all rights reserved.