🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.multimedia
Article #2

How do I draw on TCanvas from inside a function call ?

#2
From: Joseph
Date: Wed, 05 Mar 2003 06:03
41 lines
2367 bytes
Hello All,

Is it possible to draw on TControlCanvas from inside a function call ?

I mean ...

   void __fastcall TForm1::ShowTabSheet (Object *Sender) {
   
        TControlCanvas *pCanvas = new TControlCanvas ;
        
        pCanvas->Control = Tabsheet ;  // ie., TForm1::Tabsheet. Need to draw
                                       // on TabSheet, not on the main Form.

        DrawOnCanvas ( pCanvas ) ;  //** I need to draw on pCanvas from here 

        delete pCanvas ; 
   };



   void TForm1::DrawOnCanvas ( TControlCanvas *CANVAS ) {

       CANVAS->Pen->Color = clBlue ;
       CANVAS->MoveTo(0,0);
       CANVAS->LineTo(100,200);

   };


 ... This compiles and Links OK, but when I run it I get an error
message saying that "Canvas does not allow drawing". If I do the
drawing from inside the calling function, it's ok. But if done via a
function call, it won't draw.

Is the above the appropriate way of drawing on TControlCanvas from
inside a function ?



Regards,
Joseph 76
Technical Details
Message-ID: <7b424d28.0303042203.21e36935@posting.google.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,69eca6f308d0a81a,start
X-Google-Attributes: gid10cc67,public
X-Google-Thread: 10e433,69eca6f308d0a81a,start
X-Google-Attributes: gid10e433,public
X-Google-Thread: 10d0fc,69eca6f308d0a81a,start
X-Google-Attributes: gid10d0fc,public
X-Google-Thread: 101d59,69eca6f308d0a81a,start
X-Google-Attributes: gid101d59,public
X-Google-Thread: f5ca7,69eca6f308d0a81a,start
X-Google-Attributes: gidf5ca7,public
X-Google-ArrivalTime: 2003-03-04 22:03:20 PST
Path: arc1-ca.pugleaf.net!archiver1.google.com!postnews1.google.com!not-for-mail
From: joseph.redimerio@baesystems.com (Joseph)
Newsgroups: borland.public.cppbuilder.multimedia,borland.public.cppbuilder.nativeapi,borland.public.cppbuilder.graphics,borland.public.cppbuilder.winapi,borland.public.cppbuilder.vcl.components.writing
Subject: How do I draw on TCanvas from inside a function call ?
Date: 4 Mar 2003 22:03:19 -0800
Organization: http://groups.google.com/
Lines: 41
Message-ID: <7b424d28.0303042203.21e36935@posting.google.com>
NNTP-Posting-Host: 130.76.32.16
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 8bit
X-Trace: posting.google.com 1046844199 17451 127.0.0.1 (5 Mar 2003 06:03:19 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: 5 Mar 2003 06:03:19 GMT