kabae
asked on
how to save a file and retrieve
i got a hard time saving a text with assign properties like the color, the font size, and the font style that when i retrieve it again the assign properties of the last file i save will be applied to the file that i retrieve. can anybody help me.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Did you tried the SaveToFile method of the Picture property of the TImage component?
ASKER
this is a sample program that im working. Can you do this the right way coz im new in delphi programming.
im trying the savetofile method together with a timage with it i cant find a way to do it. plz help me.
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, LblEffct, Buttons, aprstore, sDialogEx, oDialogEx;
type
TfAutoPropStore = class(TForm)
Edit1: TEdit;
BitBtn1: TBitBtn;
BitBtn2: TBitBtn;
Button4: TButton;
FontD: TFontDialog;
OpenD: TOpenDialogEx;
SaveD: TSaveDialogEx;
BitBtn3: TBitBtn;
lb1: TLabel;
procedure BitBtn1Click(Sender: TObject);
procedure Edit1Change(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure BitBtn2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure BitBtn3Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
fAutoPropStore: TfAutoPropStore;
a: integer;
implementation
{$R *.DFM}
procedure TfAutoPropStore.BitBtn1Cli
VAR I:INTEGER;
F1:FILE;
begin
IF saved.Execute THEN
BEGIN
//aps.SaveProperties;
a :=strtoint( EDIT1.TEXT);
ASSIGNFILE(F1,saved.FILENA
REWRITE(F1,1);
I:=36;
BLOCKWRITE(F1,a,I,I);
CLOSEFILE(F1);
//aps.Items.Clear;
END;
end;
procedure TfAutoPropStore.Edit1Chang
begin
lb1.Caption := edit1.Text;
end;
procedure TfAutoPropStore.Button4Cli
begin
fontd.Execute;
lb1.Font := fontd.Font;
end;
procedure TfAutoPropStore.BitBtn2Cli
VAR I:INTEGER;
F1:FILE;
begin
edit1.Text := ' ';
IF OPENd.EXECUTE THEN
BEGIN
ASSIGNFILE(F1,OPENd.FILENA
RESET(F1,1);
I:={10116064;55404;;}36;
BLOCKREAD(F1,a,SIZEOF(a),I
CLOSEFILE(F1);
EDIT1.TEXT:= inttostr(a) ;
END;
end;
procedure TfAutoPropStore.FormActiva
begin
edit1.Text := ' ';
end;
procedure TfAutoPropStore.BitBtn3Cli
begin
close;
end;
end.