The MASM Forum Archive 2004 to 2012

General Forums => The Campus => Topic started by: Airam on July 22, 2009, 09:07:03 PM

Title: GdipFillRectangleI problem.
Post by: Airam on July 22, 2009, 09:07:03 PM
Hello!

I'm trying to paint a rectangle with border. This is a very little piece of code
<code>
Invoke GdipCreatePen1, ARGB(50, 10, 10, 10), FP4(1.0), UNITPIXEL, Addr pen

Invoke GdipDrawRectangleI, graphics, Pen, Ecx, Edx, Eax, Ebx
Invoke GdipFillRectangleI, graphics, brush, Ecx, Edx, Eax, Ebx
</code>
The problem is that I don't know how to initialize the brush. May I use GdipCreateLineBrushI ???
Other problem is that i don't know how to use GdipCreateLineBrusI. I have look for that function but i finally don't know how to use it.

Thanks in advance!!
Title: Re: GdipFillRectangleI problem.
Post by: Airam on July 22, 2009, 09:08:13 PM
Quote from: Airam on July 22, 2009, 09:07:03 PM
Hello!

I'm trying to paint a rectangle with border. This is a very little piece of code

QuoteInvoke GdipCreatePen1, ARGB(50, 10, 10, 10), FP4(1.0), UNITPIXEL, Addr pen

Invoke GdipDrawRectangleI, graphics, Pen, Ecx, Edx, Eax, Ebx
Invoke GdipFillRectangleI, graphics, brush, Ecx, Edx, Eax, Ebx

The problem is that I don't know how to initialize the brush. May I use GdipCreateLineBrushI ???
Other problem is that i don't know how to use GdipCreateLineBrusI. I have look for that function but i finally don't know how to use it.

Thanks in advance!!
Title: Re: GdipFillRectangleI problem.
Post by: MichaelW on July 22, 2009, 09:25:39 PM
Patience is a virtue.

There are some related PowerBASIC examples  here (http://www.jose.it-berater.org/smfforum/index.php?topic=263.0), and you can use the forum search feature to find others.
Title: Re: GdipFillRectangleI problem.
Post by: six_L on July 23, 2009, 01:32:38 AM
hi,Airam
try it.
OnDraw proc hDC
local @pGraphics
local @Pen,@Brush

invoke GdipCreateFromHDC,hDC,addr @pGraphics

invoke GdipCreatePen1,0FFFF0000h,defPenWidth,0,addr @Pen
invoke GdipCreateHatchBrush,HatchStyleCross,0FF00FF00h,0FF0000FFh,addr @Brush

invoke GdipDrawRectangleI,@pGraphics,@Pen,50,50,100,60
invoke GdipFillRectangleI,@pGraphics,@Brush,50,50,100,60

invoke GdipSetPageUnit,@pGraphics,UnitMillimeter
invoke GdipSetPageScale,@pGraphics,defScale
invoke GdipTranslateWorldTransform,@pGraphics,defCoorX,defCoorY,0

invoke GdipDrawRectangleI,@pGraphics,@Pen,50,50,100,60
invoke GdipFillRectangleI,@pGraphics,@Brush,50,50,100,60

invoke GdipDeleteBrush,@Brush
invoke GdipDeletePen,@Pen

invoke GdipDeleteGraphics,@pGraphics
ret

OnDraw endp
Title: Re: GdipFillRectangleI problem.
Post by: Airam on July 23, 2009, 09:15:56 AM
Thank you very much! It works great!!
Title: Re: GdipFillRectangleI problem.
Post by: Airam on July 23, 2009, 09:16:45 AM
Thank you MichaelW!