The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: JayPee on October 14, 2010, 04:54:56 AM

Title: RoundRect
Post by: JayPee on October 14, 2010, 04:54:56 AM
Hi All

I would like to write a routine similar to the RoundRect function. I just require the rounded corner drawing function however not being into graphics I'm not sure where to start. If someone could point me in the right direction or has source it would be appreciated.

Thank you
John
Title: Re: RoundRect
Post by: Farabi on October 14, 2010, 05:38:39 AM
Why not use the existing one? You can call roundrect on GDI library.
Title: Re: RoundRect
Post by: JayPee on October 14, 2010, 06:03:31 AM
Quote from: Farabi on October 14, 2010, 05:38:39 AM
Why not use the existing one? You can call roundrect on GDI library.

Thanks for the reply
The reason I'm not using the existing one is I want to overlay a rounded rect over a graphic however when trying it with RoundRect it wiped the image and using a Transparent Brush didn't recover the image.
Title: Re: RoundRect
Post by: sinsi on October 14, 2010, 06:45:07 AM
Have you tried CreatePatternBrush with the bitmap? Use SelectObject and then RoundRect - according to MSDN:
"The rectangle is outlined by using the current pen and filled by using the current brush."
Title: Re: RoundRect
Post by: Tedd on October 14, 2010, 11:29:50 PM
The following works fine, you can still see the text, you just get the outline.


.IF (eax==WM_PAINT)
    push ebx
    invoke BeginPaint, hwnd,ADDR ps
    mov ebx,eax ;hDC

    invoke TextOut, ebx,20,20,ADDR test_str,SIZEOF test_str
    invoke GetStockObject, HOLLOW_BRUSH
    invoke SelectObject, ebx,eax
    invoke RoundRect, ebx,5,5,100,60,12,12

    invoke EndPaint, hwnd,ADDR ps
    pop ebx
Title: Re: RoundRect
Post by: JayPee on October 16, 2010, 12:29:38 AM
Hi Tedd

Thank you very much - that did the trick nicely.

I managed to come up with my own version without fill using the Arc Function - if anyone is interested I will post the code when I finish tidying it up.