728x90
반응형
728x170
using System.Drawing;
using System.Drawing.Imaging;
#region 투명 비트맵 구하기 - GetTransparentBitmap(sourceBitmap, opacity)
/// <summary>
/// 투명 비트맵 구하기
/// </summary>
/// <param name="sourceBitmap">소스 비트맵</param>
/// <param name="opacity">투명도</param>
public Bitmap GetTransparentBitmap(Bitmap sourceBitmap, float opacity)
{
Bitmap bitmap = new Bitmap(sourceBitmap.Width, sourceBitmap.Height);
Graphics graphics = Graphics.FromImage(bitmap);
ColorMatrix colorMatrix = new ColorMatrix();
colorMatrix.Matrix33 = opacity;
ImageAttributes imageAttributes = new ImageAttributes();
imageAttributes.SetColorMatrix(colorMatrix, ColorMatrixFlag.Default, ColorAdjustType.Bitmap);
graphics.DrawImage
(
sourceBitmap,
new Rectangle(0, 0, bitmap.Width, bitmap.Height),
0,
0,
sourceBitmap.Width,
sourceBitmap.Height,
GraphicsUnit.Pixel,
imageAttributes
);
graphics.Dispose();
return bitmap;
}
#endregion
728x90
반응형
그리드형(광고전용)
'C# > WinForm' 카테고리의 다른 글
[C#/WINFORM] Form 클래스 : ProcessCmdKey 메소드 오버라이딩 설정하기 (0) | 2014.12.02 |
---|---|
[C#/WINFORM] DataGridView 클래스 : 데이터 엑셀(EXCEL) 내보내기 (0) | 2014.12.02 |
[C#/WINFORM] WebBrowser 클래스 : YouTube 검색하기 (0) | 2014.12.02 |
[C#/WINFORM] WebBrowser 클래스 : 자바 스크립트 함수 호출하기 (0) | 2014.12.02 |
[C#/WINFORM] WebBrowser 클래스 : 자바 스크립트 함수 호출하기 (0) | 2014.12.02 |
[C#/WINFORM] ListBox 클래스 : 마지막 항목으로 스크롤 하기 (0) | 2014.12.02 |
[C#/WINFORM] ListBox 클래스 : 첫번째 항목으로 스크롤 하기 (0) | 2014.12.02 |
[C#/WINFORM] ListView 클래스 : 마지막 항목으로 스크롤 하기 (0) | 2014.12.02 |
[C#/WINFORM] ListView 클래스 : 첫번째 항목으로 스크롤 하기 (0) | 2014.12.02 |
[C#/WINFORM] 전체 화면 토글하기 (0) | 2014.12.02 |
댓글을 달아 주세요