⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 blobdatafrm.pas

📁 delphi本地数据库引擎
💻 PAS
字号:
unit BlobDataFrm;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics,
  Controls, Forms, Dialogs, StdCtrls, DBCtrls,
  ExtCtrls, Db, TinyDB, BaseFrm;

type
  TBlobDataFormData = record
    TinyTable: TTinyTable;
    DataSource: TDataSource;
  end;

  TBlobDataForm = class(TBaseForm)
    BlobPanel: TPanel;
    BottomPanel: TPanel;
    CloseButton: TButton;
    procedure BottomPanelResize(Sender: TObject);
  private
    { Private declarations }
    FData: TBlobDataFormData;
  public
    { Public declarations }
    procedure SetData(Value: TBlobDataFormData);
    procedure SetCurFieldIdx(Value: Integer);
  end;

var
  BlobDataForm: TBlobDataForm;

implementation

uses LangMgr;

{$R *.DFM}

procedure TBlobDataForm.SetData(Value: TBlobDataFormData);
var
  I: Integer;
begin
  FData := Value;
  for I := 0 to Value.TinyTable.Fields.Count - 1 do
  begin
    if Value.TinyTable.Fields[I].IsBlob then
    begin
      case Value.TinyTable.Fields[I].DataType of
        ftGraphic:
          with TDBImage.Create(Self) do
          begin
            Parent := BlobPanel;
            Align := alClient;
            DataSource := Value.DataSource;
            DataField := Value.TinyTable.Fields[I].FieldName;
            Name := 'Blob' + IntToStr(I);
          end;
        else
          with TDBMemo.Create(Self) do
          begin
            Parent := BlobPanel;
            Align := alClient;
            Name := 'Blob' + IntToStr(I);
            Lines.Clear;
            DataSource := Value.DataSource;
            DataField := Value.TinyTable.Fields[I].FieldName;
            ScrollBars := ssVertical;
          end;
      end;
    end;
  end;
end;

procedure TBlobDataForm.SetCurFieldIdx(Value: Integer);
begin
  (FindComponent('Blob' + IntToStr(Value)) as TControl).BringToFront;
  Caption := FData.TinyTable.Fields[Value].FieldName;
end;

procedure TBlobDataForm.BottomPanelResize(Sender: TObject);
begin
  CloseButton.Left := BottomPanel.ClientWidth - CloseButton.Width - 6;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -