"Canvas does not allow drawing" document with SRVControls
"Canvas does not allow drawing" document with SRVControls
After inserting jpg in RVHeader, from a document with SRV Controls I got an error "canvas does not allow drawing".........
-
- Site Admin
- Posts: 17554
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: "Canvas does not allow drawing" document with SRVControls
What version of ScaleRichView do you use?
Please give me step-by-step instructions how to reproduce.
Please give me step-by-step instructions how to reproduce.
Re: "Canvas does not allow drawing" document with SRVControls
try
editor1.srv.RVHeader.Canvas.lock;
cabec:=TJpegImage.create;
cabec.loadfromfile(vCaminhoImagens+'\logo.'+formatzero(5,strtoint(gCodigoClinica))+'.jpg');
editor1.srv.RVHeader.clear;
editor1.srv.RVHeader.InsertPicture('cabec', cabec, rvvaLeft);
editor1.srv.RVHeader.Visible:=true;
editor1.srv.RVHeader.Format;
cabec.Free;
finally
editor1.srv.RVHeader.Canvas.unlock;
end;
but after, when move mouse over document .rvf with control insert show error...
editor1.srv.RVHeader.Canvas.lock;
cabec:=TJpegImage.create;
cabec.loadfromfile(vCaminhoImagens+'\logo.'+formatzero(5,strtoint(gCodigoClinica))+'.jpg');
editor1.srv.RVHeader.clear;
editor1.srv.RVHeader.InsertPicture('cabec', cabec, rvvaLeft);
editor1.srv.RVHeader.Visible:=true;
editor1.srv.RVHeader.Format;
cabec.Free;
finally
editor1.srv.RVHeader.Canvas.unlock;
end;
but after, when move mouse over document .rvf with control insert show error...
Re: "Canvas does not allow drawing" document with SRVControls
7.7.2 d 10 berlin
-
- Site Admin
- Posts: 17554
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: "Canvas does not allow drawing" document with SRVControls
You must not free the image inserted in TRichView/ScaleRichView. It is owned by the editor and will be freed by the editor.
By the way, if you want to insert an image in a header as an editing operation, the code should be:
If you want to generate a document containing an image in the header:
By the way, if you want to insert an image in a header as an editing operation, the code should be:
Code: Select all
// srv must be formatted when calling this code, and RVHeader must not be hidden
cabec:=TJpegImage.create;
cabec.loadfromfile(vCaminhoImagens+'\logo.'+formatzero(5,strtoint(gCodigoClinica))+'.jpg');
editor1.srv.StartEditing(srvrveHeader);
editor1.srv.RVHeader.InsertPicture('cabec', cabec, rvvaLeft);
If you want to generate a document containing an image in the header:
Code: Select all
// srv must be either unformatted, or the main editor must be active
// if srv is formatted, you can make sure that the main editor is active by calling editor1.srv.StartEditing(srvrveMain)
// before this code
cabec:=TJpegImage.create;
cabec.loadfromfile(vCaminhoImagens+'\logo.'+formatzero(5,strtoint(gCodigoClinica))+'.jpg');
with editor1.srv.SubDocuments[srvhftNormalHeader] do
begin
Clear;
AddPicture('cabec', cabec, 0, rvvaLeft);
Add('', 0); // for any case, adding one non-floating text object in the header)
end;
editor1.srv.Format;