Saving Page Background

General TRichView support forum. Please post your questions here
Post Reply
Splinter
Posts: 41
Joined: Mon Aug 29, 2005 6:08 pm

Saving Page Background

Post by Splinter »

Hi,

I have two ways to change the RVE background. Either RVE.Color or RVE.Backgroundbitmap.

However, to save storage space (I'm saving to database) I don't want to save the Backgroundbitmap with the RVF file (I want to use a link to external file as most backgrounds will be the same), but I DO want to save any change to RVE.Color.

It looks like both of these are saved if RVE.RVFOptions.rvfoSaveBack and rvfoLoadBack are True, but neither are saved if set to false.

Is there any way I can save the background color but not the image? (I'll use my own code to save a link to the background image file, probably in docproperties)

Also, I've noticed if rvfoSaveBack and rvfoLoadBack are true, sometimes assigning RVE.Backgroundbitmap does not work, the background just does not take, but if they are both false it works everytime. Any thoughts on this?

Thanks
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

May be you can save background color externaly, just like a link to background image?

About not-saving background properties in database: call DBRichViewEdit.CanChange before and DBRichViewEdit.Change after modifying the background properties.
Splinter
Posts: 41
Joined: Mon Aug 29, 2005 6:08 pm

Post by Splinter »

Thanks Sergey,

I had thought of doing that, but for my application I would need backward compatibility. So how can I retrieve the RVE.Color of existing documents if rvfoLoadBack is set to false? :?: If there is a way to do that it could solve my problem.

I'm not using DB components (using standard RVE), I have own routine for saving and loading to database via streams, so I don't think .CanChange is required? I'm finding that for some documents that have been loaded when I use the command:

RVE.Backgroundbitmap.loadfromfile(somefile);

For some loaded documents it works fine every time, but for others it is ignored completely, but this only happens if rvfoSaveBack and rvfoLoadBack are true. Weird.
Splinter
Posts: 41
Joined: Mon Aug 29, 2005 6:08 pm

Post by Splinter »

Any thoughts on this?
So how can I retrieve the RVE.Color of existing documents if rvfoLoadBack is set to false? If there is a way to do that it could solve my problem.
Thanks
Sergey Tkachenko
Site Admin
Posts: 17253
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

It's easy.
The first RVF line is always
-8 1 3
If background is present, it's the second line.
The example of this line is
-7 2 0 0 2 0 3 -2147483643
where the first number (-7) means that this is a record about background.
The last two numbers are ord(BackgroundStyle) (3) and background color (-2147483643).
Post Reply