Arch4ngel
Well-known member
I found this code on the internet and thought that it would be nice to share with everyone who want to make a nice spash screen or something like it.
files :
- Bitmap2Region.cs
- Mouse.bmp
namespace : BitmapToRegion
How it work:
This is my code that I used with the current bmp. Just try it ! Youll probably find many utility to this little piece of code.
N.B.: It contains UNSAFE CODE.
To allow compilation of Unsafe code :
-------------------------------------
[edit]I found that some "white" stay or that the image got cut sometime. I dont know whats the bug and if some find it... tell me ![/edit]
files :
- Bitmap2Region.cs
- Mouse.bmp
namespace : BitmapToRegion
How it work:
C#:
[size=2]Bitmap bmp = [/size][size=2][color=#0000ff]new[/color][/size][size=2] Bitmap(@"C:\mouse.bmp");
Region reg = BitmapToRegion.BitmapToRegion.Convert(bmp, Color.White, BitmapToRegion.TransparencyMode.ColorKeyTransparent);
[/size][size=2][color=#0000ff]this[/color][/size][size=2].BackgroundImage = Image.FromFile(@"C:\mouse.bmp");
[/size][size=2][color=#0000ff]this[/color][/size][size=2].Region = reg;[/size]
This is my code that I used with the current bmp. Just try it ! Youll probably find many utility to this little piece of code.
N.B.: It contains UNSAFE CODE.
To allow compilation of Unsafe code :
- Project / Properties
- Configuration Properties
- Under "Code Generation" set Allow unsafe code blocks to true.
-------------------------------------
[edit]I found that some "white" stay or that the image got cut sometime. I dont know whats the bug and if some find it... tell me ![/edit]
Attachments
Last edited by a moderator: