Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

drawing a rectangle

3 views
Skip to first unread message

R.A.F.

unread,
Oct 4, 2007, 3:07:05 AM10/4/07
to
Hi,

I'm trying to draw a simple rectangle with the following code :
...
this->Canvas->Pen->Color = TColor(0x00FFAAAA);
this->Canvas->Pen->Width = 1;
this->Canvas->Rectangle(0,0,this->Width, this->Height);
...

this works perfectly.
however, if for some reason i do not want to draw the rectangle border
but only the contents (the brush), i do :
...
//this->Canvas->Pen->Color = TColor(0x00FFAAAA);
this->Canvas->Pen->Width = 0;
this->Canvas->Rectangle(0,0,this->Width, this->Height);
...

but anyway, it draws the border...
where is the problem ?

thx.

RAF

Eelke

unread,
Oct 4, 2007, 3:49:51 AM10/4/07
to
R.A.F. schreef:
Try setting the penstyle to psClear

this->Canvas->Pen->Style = psClear;

Eelke

riweber

unread,
Oct 4, 2007, 9:30:29 AM10/4/07
to
You can use the Canvas->FillRect function.

Asger Jørgensen schrieb:
> In article <47049117$1...@newsgroups.borland.com>,
> Hi RAF
>
> nos...@noemail.com says...
>> Hi,


>>
>> this->Canvas->Pen->Width = 0;
>

> You don't need the this pointer
> You can write only:


>
> Canvas->Pen->Width = 0;
>

> Kind regards
> Asger

Asger Jørgensen

unread,
Oct 4, 2007, 9:17:23 AM10/4/07
to
In article <47049117$1...@newsgroups.borland.com>,
Hi RAF

nos...@noemail.com says...
> Hi,
>

> this->Canvas->Pen->Width = 0;

You don't need the this pointer
You can write only:

Canvas->Pen->Width = 0;

Kind regards
Asger

Remy Lebeau (TeamB)

unread,
Oct 4, 2007, 12:38:02 PM10/4/07
to

"R.A.F." <nos...@noemail.com> wrote in message
news:47049117$1...@newsgroups.borland.com...

> this->Canvas->Pen->Width = 0;

You can't set the Width below 1. This is stated in the TPen documentation:

"If Width is set to a value less than 1, the pen is given a Width of 1."

> but anyway, it draws the border...

Rectangle() is supposed to always draw a border. The TCanvas documentation
says as much:

"Use Rectangle to draw a rectangle using Pen and fill it with Brush...To
fill a rectangular region without drawing the boundary in the current pen,
use FillRect."


Gambit


R.A.F.

unread,
Oct 4, 2007, 2:16:14 PM10/4/07
to
And is there a method to draw a 3D rectangle or should i play with
lines, rectangle and fillrect ?

Remy Lebeau (TeamB)

unread,
Oct 4, 2007, 2:25:11 PM10/4/07
to

"R.A.F." <nos...@noemail.com> wrote in message
news:47052ddd$1...@newsgroups.borland.com...

> And is there a method to draw a 3D rectangle or should
> i play with lines, rectangle and fillrect ?

Look at the Frame3D() function.


Gambit


R.A.F.

unread,
Oct 4, 2007, 2:18:47 PM10/4/07
to
in fact i would like to recreate the same look as the BevelOuter,
BevelEdge and so on, but in 1 property :-)
0 new messages