Board index » cppbuilder » TCanvas->ClipRect

TCanvas->ClipRect

Hello all,

The BCB help says that you can set the TCanvas->ClipRect to limit the
drawing area. However, TCanvas->ClipRect is a read only property, and I
cannot change it. How can I overcome this problem? I have tried everything I
can think of!

Paul

 

Re:TCanvas->ClipRect


Hi, Paul.

Quote
Paul Dowd wrote:

> Hello all,

> The BCB help says that you can set the TCanvas->ClipRect to limit the
> drawing area. However, TCanvas->ClipRect is a read only property, and I
> cannot change it. How can I overcome this problem? I have tried everything I
> can think of!

Here is the example from the ClipRect property:

void __fastcall TForm1::Button1Click(TObject *Sender)
{
    HRGN MyRgn;

    MyRgn = ::CreateRectRgn(100,100,200,200);
    ::SelectClipRgn(Image1->Canvas->Handle,MyRgn);
    Image1->Canvas->Brush->Color = clRed;
    Image1->Canvas->FillRect(Image1->Canvas->ClipRect);
    Image1->Invalidate();
    ::SelectClipRgn(Image1->Canvas->Handle,NULL);
    ::DeleteObject(MyRgn);

Quote
}

How odd -- but maybe it will help.

robert

Other Threads