Add recto verso option to simplegraph

Please post bug reports, feature requests, or any question regarding the DELPHI AREA products here.

Add recto verso option to simplegraph

Postby Mirage » October 27th, 2005, 9:19 am

Hello!

Please give me solution to add the option of recto and verso to simplegraph.
:cry:
User avatar
Mirage
Junior Member
Junior Member
 
Posts: 44
Joined: October 26th, 2005, 11:41 am

Postby Kambiz » October 28th, 2005, 11:13 am

Seems you should use two instances of SimpleGraph.

Could you please explain more about your purpose?
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Add recto verso option to simplegraph

Postby Mirage » October 31st, 2005, 8:49 am

Kambiz Hello!
Thank you for your answer!

I wants to add two SimpleGraph one to draw in recto and the other to draw in back I have a problem when I make the save. Please give me a method for save 2 SimpleGraph in only one file.
Thank you in advance! :wink:
User avatar
Mirage
Junior Member
Junior Member
 
Posts: 44
Joined: October 26th, 2005, 11:41 am

Postby Kambiz » October 31st, 2005, 4:33 pm

Hi,

You have to use a stream to save graphs in to the stream, then save stream in the file.

Cheers
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Add recto verso option to simplegraph

Postby Mirage » November 1st, 2005, 7:33 am

Kambiz Hello!

Thank you for your answer!
Please given me a method of use of Stream.
I do not know how not used.

Thank you in advance Mr. Kambiz. :roll:
User avatar
Mirage
Junior Member
Junior Member
 
Posts: 44
Joined: October 26th, 2005, 11:41 am

Postby Kambiz » November 1st, 2005, 9:53 am

Here are two procedures for saving/loading multiple graphs to/from a single file.

Code: Select all
procedure SaveMutipleGraphs(const FileName: String; Graphs: array of TSimpleGraph);
var
  Stream: TFileStream;
  I: Integer;
begin
  Stream := TFileStream.Create(FileName, fmCreate or fmShareExclusive);
  try
    for I := Low(Graphs) to High(Graphs) do
      Graphs[I].SaveToStream(Stream);
  finally
    Stream.Free;
  end;
end;

procedure LoadMutipleGraphs(const FileName: String; Graphs: array of TSimpleGraph);
var
  Stream: TFileStream;
  I: Integer;
begin
  Stream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite);
  try
    for I := Low(Graphs) to High(Graphs) do
      Graphs[I].LoadFromStream(Stream);
  finally
    Stream.Free;
  end;
end;

Here is an example of usage:

Code: Select all
procedure TMainForm.btnSaveClick(Sender: TObject);
begin
  SaveMutipleGraphs('C:\TEST.MG', [SimpleGraph1, SimpleGraph2]);
end;

procedure TMainForm.btnLoadClick(Sender: TObject);
begin
  LoadMutipleGraphs('C:\TEST.MG', [SimpleGraph1, SimpleGraph2]);
end;

Cheers
Kambiz
User avatar
Kambiz
Administrator
Administrator
 
Posts: 2408
Joined: March 7th, 2003, 7:10 pm

Add recto verso option to simplegraph

Postby Mirage » November 1st, 2005, 10:48 am

Thank you, thank you, thank you, thank you for you Kambiz!
You solved me a major problem.
Thank you, thank you, thank you, thank you for my Allah god!
User avatar
Mirage
Junior Member
Junior Member
 
Posts: 44
Joined: October 26th, 2005, 11:41 am

Postby lbc » November 2nd, 2005, 9:31 am

great job
thank you Kambiz
lbc
Junior Member
Junior Member
 
Posts: 48
Joined: February 4th, 2004, 7:50 am
Location: Italy


Return to DELPHI AREA Products

Who is online

Users browsing this forum: No registered users and 1 guest

cron