?? pictures.pas
字號(hào):
unit Pictures;
interface
uses
{$IFDEF LINUX}
SysUtils, Types, Classes, QGraphics, QControls, QForms, QDialogs, QStdCtrls,
QDBCtrls, QComCtrls, QExtCtrls, QGrids, QDBGrids, QButtons, OdacClx,
{$ELSE}
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DBCtrls, ExtCtrls, Grids, DBGrids, StdCtrls, ToolWin, ComCtrls, ExtDlgs,
Buttons, OdacVcl,
{$ENDIF}
Db, MemDS, DBAccess, Ora, OraSmart, OdacDemoFrame, OdacDemoForm;
type
TPicturesFrame = class(TOdacDemoFrame)
DBGrid: TDBGrid;
ToolBar: TPanel;
ToolBar1: TPanel;
Splitter1: TSplitter;
ScrollBox1: TScrollBox;
DBImage: TDBImage;
dsPictures: TDataSource;
quPictures: TSmartQuery;
Panel1: TPanel;
btLoad: TSpeedButton;
btSave: TSpeedButton;
btClear: TSpeedButton;
Panel2: TPanel;
btOpen: TSpeedButton;
btClose: TSpeedButton;
DBNavigator: TDBNavigator;
procedure btOpenClick(Sender: TObject);
procedure btCloseClick(Sender: TObject);
procedure btLoadClick(Sender: TObject);
procedure btSaveClick(Sender: TObject);
procedure btClearClick(Sender: TObject);
private
{ Private declarations }
public
procedure Initialize; override;
procedure SetDebug(Value: boolean); override;
end;
implementation
uses
OraCall;
{$IFDEF CLR}
{$R *.nfm}
{$ENDIF}
{$IFDEF WIN32}
{$R *.dfm}
{$ENDIF}
{$IFDEF LINUX}
{$R *.xfm}
{$ENDIF}
procedure TPicturesFrame.Initialize;
begin
inherited;
quPictures.Connection := Connection;
end;
procedure TPicturesFrame.btOpenClick(Sender: TObject);
begin
quPictures.Open;
end;
procedure TPicturesFrame.btCloseClick(Sender: TObject);
begin
quPictures.Close;
end;
procedure TPicturesFrame.btLoadClick(Sender: TObject);
begin
{$IFDEF LINUX}
with TOpenDialog.Create(nil) do
{$ELSE}
with TOpenPictureDialog.Create(nil) do
{$ENDIF}
try
InitialDir := ExtractFilePath(Application.ExeName) + 'Pictures';
if Execute then begin
if quPictures.State in [dsBrowse] then
quPictures.Edit;
TBlobField(quPictures.FieldByName('Picture')).
LoadFromFile(FileName);
end;
finally
Free;
end;
end;
procedure TPicturesFrame.btSaveClick(Sender: TObject);
begin
{$IFDEF LINUX}
with TSaveDialog.Create(nil) do
{$ELSE}
with TSavePictureDialog.Create(nil) do
{$ENDIF}
try
InitialDir := ExtractFilePath(Application.ExeName) + 'Pictures';
if Execute then begin
TBlobField(quPictures.FieldByName('Picture')).
SaveToFile(FileName);
end;
finally
Free;
end;
end;
procedure TPicturesFrame.btClearClick(Sender: TObject);
begin
if quPictures.State in [dsBrowse] then
quPictures.Edit;
TBlobField(quPictures.FieldByName('Picture')).Clear;
end;
procedure TPicturesFrame.SetDebug(Value: boolean);
begin
quPictures.Debug := Value;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -