[GDI+] RoundRect 그리기

GDI에는 RoundRect함수가 있다. 하지만 Gdiplus에는 없다..?
하지만 그릴수 있는 방법이 있다는 사실.. 쪼금 손이 많이 가지만..

    GraphicsPath GetRoundRectPath(int x, int y, int width, int height, int radius)
    {
        GraphicsPath pg;

        gp.AddLine( x + radius, y, x + width - radius, y );   
        gp.AddArc( x + width - radius, y, radius, radius, 270, 90 );   
        gp.AddLine( x + width, y + radius, x + width, y + height - radius );   
        gp.AddArc( x + width - radius, y + height - radius, radius, radius, 0, 90 );   
        gp.AddLine( x + width - radius, y + height, x + radius, y + height );   
        gp.AddArc( x, y + height - radius, radius, radius, 90, 90 );   
        gp.AddLine( x, y + height - radius, x, y + radius );   
        gp.AddArc( x, y, radius, radius, 180, 90 );   
        gp.CloseFigure();

        return pg;
    }


그리고 그릴때는 DrawPath함수와 FillPath 함수를 이용한다.. 하지만 둥근게 썩 마음에 들진 않는다.
셋팅에 SmoothingModeAntiAlias을 주어도 아직 미흡했다. 좀더 부드럽게 그리는 방법을 찾아야 겠다.

이 글과 관련있는 글을 자동검색한 결과입니다 [?]

by 이카로스 | 2008/11/24 16:26 | GDI+ | 트랙백 | 덧글(0)

트랙백 주소 : http://icarosss.egloos.com/tb/2148574
☞ 내 이글루에 이 글과 관련된 글 쓰기 (트랙백 보내기) [도움말]

:         :

:

비공개 덧글

.

<< 이전 페이지     다음 페이지 >>