亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? autodbgrid.pas

?? Delphi自動縮放數據表格控件
?? PAS
字號:
//-----------------------------------------------------------------
//控件名稱:自動縮放數據表格 AutoDBGrid V1.0                        
//控件作者:與月共舞工作室 周勁羽
//下載網址:http://yygw.126.com
//Eamil   :yygw@yeah.net; yygw@sina.com
//發布類型:明信片控件 未經作者允許請勿用于任何盈利性場合                 
//開發平臺:Windows 98 SE + Delphi 5.0
//最后修改:2001.3.20                                             
//-----------------------------------------------------------------
unit AutoDBGrid;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Grids, DBGrids, DB, Consts, DsgnIntf;

type
  TDispTitle = class;
  TDispTitles = class;
  TAutoDBGrid = class;

{ TDispTitle }

  TDispTitle = class(TCollectionItem)
  private
    FWidth: Integer;
    FTitle: string;
    FFieldName: string;
    procedure SetFieldName(const Value: string);
    procedure SetTitle(const Value: string);
    procedure SetWidth(const Value: Integer);
    function GetDispTitles: TDispTitles;
    procedure Changed;
  protected
    function GetDisplayName: string; override;
  public
    constructor Create(Collection: TCollection); override;
    property DispTitles: TDispTitles read GetDispTitles;
  published
    property FieldName: string read FFieldName write SetFieldName;
    property Width: Integer read FWidth write SetWidth;
    property Title: string read FTitle write SetTitle;
  end;

{ TDispTitles }

  TDispTitles = class(TOwnedCollection)
  private
    FDBGrid: TAutoDBGrid;
    function GetItem(Index: Integer): TDispTitle;
    procedure SetItem(Index: Integer; const Value: TDispTitle);
    procedure SetDBGrid(const Value: TAutoDBGrid);
    procedure Changed;
  public
    constructor Create(AOwner: TAutoDBGrid);
    function IndexOf(const FieldName: string): Integer;
    property Items[Index: Integer]: TDispTitle read GetItem write SetItem; default;
    property DBGrid: TAutoDBGrid read FDBGrid write SetDBGrid;
  end;

{ TAddAllProperty }

  TAddAllProperty = class(TPropertyEditor)
  public
    procedure Edit; override;
    function GetAttributes: TPropertyAttributes; override;
    function GetValue: string; override;
  end;

{ TAbout }

  TAbout = class(TPropertyEditor)
  public
    function GetAttributes: TPropertyAttributes; override;
    procedure Edit; override;
    function GetValue: string; override;
  end;

{ TAutoDBGrid }

  TGetTitleEvent = procedure(Sender: TAutoDBGrid; Field: TField;
    var Title: string; var Width: Integer) of Object;

  TAutoDBGrid = class(TDBGrid)
  private
    FTitles: TDispTitles;
    FAutoSize: Boolean;
    FOnGetTitle: TGetTitleEvent;
    FOnGetTitleFail: TGetTitleEvent;
    FMinFixed: Boolean;
    FMinCharWidth: Integer;
    FAddAll: TAddAllProperty;
    FAbout: TAbout;
    procedure SetTitles(const Value: TDispTitles);
    procedure SetAutoSize(const Value: Boolean);
    procedure WMSize(var Msg: TWMSize); message WM_SIZE;
    procedure SetMinFixed(const Value: Boolean);
    procedure SetMinCharWidth(const Value: Integer);
    procedure AutoReset;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure Reset;
  published
    property About: TAbout read FAbout write FAbout;
    property AddAll: TAddAllProperty read FAddAll write FAddAll;
    property Titles: TDispTitles read FTitles write SetTitles;
    property AutoSize: Boolean read FAutoSize write SetAutoSize default True;
    property MinCharWidth: Integer read FMinCharWidth write SetMinCharWidth default 7;
    property MinFixed: Boolean read FMinFixed write SetMinFixed default True;
    property OnGetTitle: TGetTitleEvent read FOnGetTitle write FOnGetTitle;
    property OnGetTitleFail: TGetTitleEvent read FOnGetTitleFail write
      FOnGetTitleFail;
  end;

procedure Register;

implementation

procedure Register;
begin
  RegisterComponents('Yygw', [TAutoDBGrid]);
  RegisterPropertyEditor(TypeInfo(TAddAllProperty), TAutoDBGrid, 'AddAll',
    TAddAllProperty);
  RegisterPropertyEditor(TypeInfo(TAbout), TAutoDBGrid, 'About', TAbout);
end;

{ TDispTitle }

procedure TDispTitle.Changed;
begin
  if Assigned(DispTitles) then
    DispTitles.Changed;
end;

constructor TDispTitle.Create(Collection: TCollection);
begin
  inherited Create(Collection);
  Width := 0;
  Title := '';
  FieldName := '';
end;

function TDispTitle.GetDisplayName: string;
begin
  if FieldName <> '' then
    Result := FieldName
  else
    Result := inherited GetDisplayName;
end;

function TDispTitle.GetDispTitles: TDispTitles;
begin
  if Collection is TDispTitles then
    Result := TDispTitles(Collection)
  else
    Result := nil;
end;

procedure TDispTitle.SetFieldName(const Value: string);
begin
  if (Value <> '') and (AnsiCompareText(Value, FFieldName) <> 0) and
    (Collection is TDispTitles) and (TDispTitles(Collection).IndexOf(Value) >= 0) then
    raise Exception.Create(SDuplicateString);
  FFieldName := Value;
  if FTitle = '' then
    FTitle := FFieldName;
  if FWidth = 0 then
    FWidth := Length(FTitle);
  Changed;
end;

procedure TDispTitle.SetTitle(const Value: string);
begin
  if FTitle <> Value then
  begin
    FTitle := Value;
    if FWidth = 0 then
      FWidth := Length(FTitle);
    Changed;
  end;
end;

procedure TDispTitle.SetWidth(const Value: Integer);
begin
  if FWidth <> Value then
  begin
    FWidth := Value;
    Changed;
  end;
end;

{ TDispTitles }

procedure TDispTitles.Changed;
begin
  if Assigned(DBGrid) and DBGrid.AutoSize then
    DBGrid.Reset;
end;

constructor TDispTitles.Create(AOwner: TAutoDBGrid);
begin
  inherited Create(AOwner, TDispTitle);
  DBGrid := AOwner;
end;

function TDispTitles.GetItem(Index: Integer): TDispTitle;
begin
  Result := TDispTitle(inherited Items[Index]);
end;

function TDispTitles.IndexOf(const FieldName: string): Integer;
begin
  for Result := 0 to Count - 1 do
    if AnsiCompareText(Items[Result].FieldName, FieldName) = 0 then Exit;
  Result := -1;
end;

procedure TDispTitles.SetDBGrid(const Value: TAutoDBGrid);
begin
  FDBGrid := Value;
end;

procedure TDispTitles.SetItem(Index: Integer; const Value: TDispTitle);
begin
  inherited SetItem(Index, TCollectionItem(Value));
end;

{ TAddAllProperty }

procedure TAddAllProperty.Edit;
var
  i, j: Integer;
  Added: Integer;
begin
  Added := 0;
  for i := 0 to PropCount - 1 do
  begin
    if GetComponent(i) is TAutoDBGrid then
      with TAutoDBGrid(GetComponent(i)) do
      begin
        if Columns.Count > 1 then
        begin
          for j := 0 to Columns.Count - 1 do
          begin
            if Titles.IndexOf(Columns[j].FieldName) < 0 then
            begin
              with TDispTitle(Titles.Add) do
                FieldName := Columns[j].FieldName;
              Inc(Added);
            end;
          end;
        end;
      end;
  end;
  if Added > 0 then
    Application.MessageBox(PChar(IntToStr(Added) + ' Fields added!'),'Hint', MB_OK)
  else
    Application.MessageBox('None Field added!','Hint', MB_OK);
end;

function TAddAllProperty.GetAttributes: TPropertyAttributes;
begin
  Result := [paMultiSelect, paDialog, paReadOnly];
end;

function TAddAllProperty.GetValue: string;
begin
  Result := 'AddAllFields';
end;

{ TAbout }

procedure TAbout.Edit;
begin
  Application.MessageBox('TAutoDBGrid V1.0' + #10#13#10#13 + 'Author: Zhoujingyu'
    + '  Email: yygw@yeah.net' + #10#13 + 'Date: 2001.3.20','About',
    MB_OK)
end;

function TAbout.GetValue: string;
begin
 Result := 'About';
end;

function TAbout.GetAttributes: TPropertyAttributes;
begin
 Result := [paMultiSelect, paDialog, paReadOnly];
end;

{ TAutoDBGrid }

constructor TAutoDBGrid.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FTitles := TDispTitles.Create(Self);
  FMinCharWidth := 7;
  FMinFixed := True;
  FAutoSize := True;
end;

destructor TAutoDBGrid.Destroy;
begin
  FTitles.Free;
  inherited;
end;

procedure TAutoDBGrid.Reset;
var
  i: Integer;
  TotalWidth: Integer;
  NewWidth: Integer;
  DispTitle: string;
  DispWidth: Integer;
  iTemp: Integer;
  procedure GetTitle(AField: TField; var ATitle: string; var AWidth: Integer);
  var
    Index: Integer;
  begin
    Index := Titles.IndexOf(AField.FieldName);
    if Index >= 0 then
    begin
      ATitle := Titles.Items[Index].Title;
      AWidth := Titles.Items[Index].Width;
    end
    else
    begin
      ATitle := AField.FieldName;
      AWidth := Length(ATitle);
      if Assigned(OnGetTitleFail) then
        OnGetTitleFail(Self, AField, ATitle, AWidth);
    end;
    if Assigned(OnGetTitle) then
      OnGetTitle(Self, AField, ATitle, AWidth);
  end;
begin
  if Columns.Count <= 1 then
    Exit;

  TotalWidth := 0;
  for i := 0 to Columns.Count - 1 do
  begin
    GetTitle(Columns[i].Field, DispTitle, DispWidth);
    TotalWidth := TotalWidth + DispWidth;
  end;

  NewWidth := ClientWidth - 6;
  if dgIndicator in Self.Options then
    NewWidth := NewWidth - 12;
  if (NewWidth < TotalWidth * MinCharWidth) and MinFixed then
    NewWidth := TotalWidth * MinCharWidth;

  BeginUpdate;
  iTemp := 0;
  for i := 0 to Columns.Count - 1 do
  begin
    GetTitle(Columns[i].Field, DispTitle, DispWidth);
    Columns[i].Width := Round((iTemp + DispWidth) * NewWidth / TotalWidth)
      - Round(iTemp * NewWidth / TotalWidth);
    iTemp := iTemp + DispWidth;
    Columns[i].Title.Caption := DispTitle;
    Columns[i].Title.Alignment := Columns[i].Alignment
  end;
  EndUpdate;
end;

procedure TAutoDBGrid.SetAutoSize(const Value: Boolean);
begin
  FAutoSize := Value;
  if FAutoSize then
    Reset;
end;

procedure TAutoDBGrid.SetTitles(const Value: TDispTitles);
begin
  FTitles.Assign(Value);
end;

procedure TAutoDBGrid.SetMinFixed(const Value: Boolean);
begin
  if FMinFixed <> Value then
  begin
    FMinFixed := Value;
    AutoReset;
  end;
end;

procedure TAutoDBGrid.SetMinCharWidth(const Value: Integer);
begin
  if (FMinCharWidth > 0) and (FMinCharWidth <= 20) and (FMinCharWidth <> Value) then
  begin
    FMinCharWidth := Value;
    AutoReset;
  end;
end;

procedure TAutoDBGrid.WMSize(var Msg: TWMSize);
begin
  AutoReset;
  inherited;
end;

procedure TAutoDBGrid.AutoReset;
begin
  if AutoSize then
    Reset;
end;

end.

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
久久久亚洲精华液精华液精华液| 日本女人一区二区三区| 日本不卡在线视频| 北条麻妃国产九九精品视频| 欧美久久久久久久久| 亚洲欧洲在线观看av| 久久er99精品| 欧美日韩视频专区在线播放| 国产精品色哟哟| 国产精品一二三区| 欧美一区二区精品| 亚洲精品中文在线观看| 不卡电影免费在线播放一区| 精品粉嫩超白一线天av| 视频一区在线播放| 在线视频一区二区三区| 综合色天天鬼久久鬼色| 成人免费视频国产在线观看| 久久一区二区视频| 国产在线播放一区| 精品动漫一区二区三区在线观看| 亚洲高清中文字幕| 欧美色大人视频| 亚洲一二三四区| 在线欧美日韩国产| 亚洲成人精品影院| 91高清在线观看| 亚洲最大成人综合| 日本电影欧美片| 一区二区免费视频| 欧美日韩免费电影| 五月天久久比比资源色| 欧美高清视频一二三区| 丝袜诱惑制服诱惑色一区在线观看 | 99re在线精品| 国产精品九色蝌蚪自拍| 91亚洲大成网污www| 亚洲欧美日韩国产综合在线| 99久久国产免费看| 亚洲视频在线观看三级| 一本久道中文字幕精品亚洲嫩| 亚洲男人天堂av| 欧美精品久久天天躁| 日本不卡的三区四区五区| 日韩午夜精品视频| 国产精品一品二品| 成人欧美一区二区三区视频网页| 色婷婷久久综合| 青青草原综合久久大伊人精品| 日韩欧美亚洲另类制服综合在线| 韩国av一区二区三区在线观看| 久久久www成人免费无遮挡大片| 国产精品一品二品| 亚洲欧美日韩一区二区| 欧美综合色免费| 毛片基地黄久久久久久天堂| 日本一区二区成人| 91福利在线观看| 久久超级碰视频| 国产精品传媒视频| 欧美精品v国产精品v日韩精品| 激情深爱一区二区| 亚洲视频小说图片| 日韩精品专区在线影院重磅| 粉嫩蜜臀av国产精品网站| 一卡二卡三卡日韩欧美| 精品久久久久久久久久久久包黑料 | 国产精品视频一二三区| 日本韩国一区二区三区视频| 久久精品国产成人一区二区三区| 国产精品国产三级国产三级人妇 | 国产女人18毛片水真多成人如厕 | 国产精品99久久久久| 亚洲精品自拍动漫在线| 久久久久久免费网| 欧美日韩亚洲综合一区| 国产成人av福利| 日韩黄色在线观看| 国产精品免费视频一区| 欧美一区二区三区视频在线| 99精品欧美一区| 精品一区二区三区久久| 亚洲一区影音先锋| 国产视频在线观看一区二区三区| 欧美日韩免费电影| 91女厕偷拍女厕偷拍高清| 久久精品免费看| 亚洲va韩国va欧美va| 欧美激情一区二区三区| 欧美xingq一区二区| 在线观看一区二区精品视频| 成人av资源在线观看| 国产综合色在线| 日韩av网站免费在线| 一区二区三区四区蜜桃| 国产精品女人毛片| 久久综合色8888| 日韩免费在线观看| 91精品国产乱码久久蜜臀| 91国在线观看| 91丨九色丨黑人外教| 成av人片一区二区| 国产成人自拍高清视频在线免费播放| 日韩精品三区四区| 亚洲一区二区精品久久av| 亚洲日本va在线观看| 国产精品美女久久福利网站| 国产视频一区在线观看| 久久亚洲精品国产精品紫薇| 91精品国产综合久久精品app| 色噜噜狠狠成人网p站| av电影天堂一区二区在线| 懂色中文一区二区在线播放| 黄页网站大全一区二区| 精品亚洲porn| 国产一区二区三区免费看| 奇米精品一区二区三区四区| 日本成人在线网站| 日韩电影在线观看一区| 全国精品久久少妇| 日本最新不卡在线| 免费成人av在线| 蜜桃视频在线观看一区| 精品一区二区三区日韩| 国产精品2024| 成人理论电影网| 色婷婷狠狠综合| 欧美高清性hdvideosex| 精品av久久707| 国产欧美精品国产国产专区 | 久久色在线视频| 久久综合狠狠综合| 国产欧美精品在线观看| 国产精品久久精品日日| 一区二区三区四区亚洲| 日本欧美加勒比视频| 老汉av免费一区二区三区 | 久久精品国产久精国产爱| 精品一区二区三区在线观看| 国产福利一区二区三区视频| 91网站最新网址| 91精品国产一区二区| 久久这里只有精品视频网| 国产欧美日韩另类一区| 亚洲亚洲精品在线观看| 国内偷窥港台综合视频在线播放| 成人a级免费电影| 欧美日韩电影在线| 久久理论电影网| 亚洲一区二区视频| 国产精品一区二区三区99| 日本黄色一区二区| 久久久久久免费毛片精品| 亚洲裸体xxx| 国产精品系列在线观看| 欧美午夜精品久久久久久孕妇| 日韩精品一区二区三区swag| 亚洲欧洲三级电影| 美女一区二区三区在线观看| 懂色av一区二区在线播放| 欧美日韩国产高清一区二区| 国产女人18毛片水真多成人如厕| 午夜久久久久久| 99久久久无码国产精品| 精品福利一二区| 午夜精品福利在线| 94-欧美-setu| 久久精品夜色噜噜亚洲aⅴ| 亚洲成a人v欧美综合天堂| 成人av电影免费观看| 久久综合网色—综合色88| 亚洲一区二区三区中文字幕在线 | 欧美欧美欧美欧美首页| 国产精品久久三| 精品一区二区综合| 91精品国产黑色紧身裤美女| 伊人色综合久久天天| 高清在线成人网| 欧美成人欧美edvon| 同产精品九九九| 在线免费观看日本欧美| 国产欧美一区二区精品婷婷| 久久国内精品自在自线400部| 欧美三级资源在线| 亚洲色图19p| 97久久久精品综合88久久| 欧美国产乱子伦| 国产成人免费在线视频| 久久精品这里都是精品| 久久aⅴ国产欧美74aaa| 日韩欧美高清一区| 麻豆精品精品国产自在97香蕉| 91精品在线麻豆| 午夜视频在线观看一区| 欧美精品日日鲁夜夜添| 视频一区国产视频| 欧美二区乱c少妇| 日韩精品成人一区二区三区| 337p亚洲精品色噜噜| 日本亚洲三级在线|