첨부 실행 코드는 나눔고딕코딩 폰트를 사용합니다.
------------------------------------------------------------------------------------------------------------------------------------------------------
728x90
728x170

■ Bitmap 클래스를 사용해 비트맵 크기를 변경하는 방법을 보여준다.

 

▶ 예제 코드 (C#)

using System.Drawing;

#region 비트맵 크기 변경하기 - ResizeBitmap(sourceBitmap, targetWidth, targetHeight)

/// <summary>
/// 비트맵 크기 변경하기
/// </summary>
/// <param name="sourceBitmap">소스 비트맵</param>
/// <param name="targetWidth">타겟 너비</param>
/// <param name="targetHeight">타겟 높이</param>
/// <returns>크기 변경 비트맵</returns>
public Bitmap ResizeBitmap(Bitmap sourceBitmap, int targetWidth, int targetHeight)
{
    Bitmap targetBitmap = new Bitmap(targetWidth, targetHeight);

    using(Graphics graphics = Graphics.FromImage(targetBitmap))
    {
        graphics.DrawImage(sourceBitmap, 0, 0, targetWidth, targetHeight);
    }

    return targetBitmap;
}

#endregion
728x90
그리드형(광고전용)
Posted by icodebroker
,