■ DrawingVisual 클래스 : 객체 구하기

----------------------------------------------------------------------------------------------------

using System.Windows.Media;

 

#region DrawingVisual 객체 구하기 - GetDrawingVisual(width, height)

 

/// <summary>

/// DrawingVisual 객체 구하기

/// </summary>

/// <param name="width">너비</param>

/// <param name="height">높이</param>

/// <returns>DrawingVisual 객체</returns>

public DrawingVisual GetDrawingVisual(double width, double height)

{

    DrawingVisual drawingVisual = new DrawingVisual();

 

    DrawingContext drawingContext = drawingVisual.RenderOpen();

 

    //////////////////////////////////////// 비트맵 그리기 시작

 

    double penWidth = 10d;

 

    drawingContext.DrawRoundedRectangle

    (

        Brushes.Blue,

        new Pen(Brushes.Red, penWidth),

        new Rect(penWidth / 2d, penWidth / 2d, width - penWidth, height - penWidth),

        penWidth,

        penWidth

    );

 

    //////////////////////////////////////// 비트맵 그리기 종료

 

    drawingContext.Close();

 

    return drawingVisual;

}

 

#endregion

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker

댓글을 달아 주세요