BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Trying to create non-rectangular control

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics
View previous topic :: View next topic  
Author Message
Michael Alexin
Guest





PostPosted: Thu Apr 08, 2004 3:29 pm    Post subject: Trying to create non-rectangular control Reply with quote




Hi all!!
I'm trying to create control non-rectangular control descendant from TCustomControl. I'm use the following code for this:

procedure TDinPoint.Paint;
var
rgn1: HRGN;
br: TBrush;
begin
inherited Paint;
//Fpoints - array of TPoint
rgn1 := CreatePolygonRgn(FPoints, 3, ALTERNATE);
br := TBrush.Create;
br.Color := clWhite;
br.Style := bsSolid;
FillRgn(Canvas.Handle,rgn1,br.Handle);
SetWindowRgn(Self.Handle,rgn1,True);
end;

But if FPoints is dynamic array this trics doesn't work=(
What should i do?
Thanx 4 advance!!!
Back to top
Soeren Muehlbauer
Guest





PostPosted: Thu Apr 08, 2004 3:40 pm    Post subject: Re: Trying to create non-rectangular control Reply with quote



Hi,

Quote:
procedure TDinPoint.Paint;
var
rgn1: HRGN;
br: TBrush;
begin
inherited Paint;
//Fpoints - array of TPoint
rgn1 := CreatePolygonRgn(FPoints, 3, ALTERNATE);
br := TBrush.Create;
br.Color := clWhite;
br.Style := bsSolid;
FillRgn(Canvas.Handle,rgn1,br.Handle);
SetWindowRgn(Self.Handle,rgn1,True);
end;

But if FPoints is dynamic array this trics doesn't work=(
What should i do?
Thanx 4 advance!!!

How about:

rgn1:=CreatePolygonRgn(FPoints[0],Length(FPoints), ALTERNATE);

HTH, Soeren

Back to top
Nils Haeck
Guest





PostPosted: Thu Apr 08, 2004 6:37 pm    Post subject: Re: Trying to create non-rectangular control Reply with quote



Indeed, the address FPoints[0] points to the first element. The FPoints
pointer is not pointing to the first element but another location in memory,
where object and size info is stored (at least, that's what I suspect).

Nils

"Soeren Muehlbauer" <soeren.dd (AT) gmx (DOT) de> wrote

Quote:
Hi,

procedure TDinPoint.Paint;
var
rgn1: HRGN;
br: TBrush;
begin
inherited Paint;
//Fpoints - array of TPoint
rgn1 := CreatePolygonRgn(FPoints, 3, ALTERNATE);
br := TBrush.Create;
br.Color := clWhite;
br.Style := bsSolid;
FillRgn(Canvas.Handle,rgn1,br.Handle);
SetWindowRgn(Self.Handle,rgn1,True);
end;

But if FPoints is dynamic array this trics doesn't work=(
What should i do?
Thanx 4 advance!!!

How about:

rgn1:=CreatePolygonRgn(FPoints[0],Length(FPoints), ALTERNATE);

HTH, Soeren



Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Graphics All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.