2024年1月15日 星期一

DialogLib.pas 記錄

 

InputBox


EditConnectionString


FindDialog / ReplaceDialog


OpenDialog / SaveDialog


Waiting Form



2023年12月26日 星期二

ComboBox 繪製模式

 

ComboBox1.Style

csOwnerDrawFixed

  • 當 ComboBox.Style 設定為 csOwnerDrawFixed 時,所有項目將以相同的高度顯示,並且當需要時,控制元件會調用 OnDrawItem 事件來繪製每個項目。
  • 所有項目的高度由 ItemHeight 屬性定義。這表示無論項目的內容有多長,顯示的高度都是相同的。
  • 對於列表中的每個項目,OnDrawItem 事件都會觸發,並且您必須在該事件中進行繪製。

csOwnerDrawVariable

  • 當 ComboBox.Style 設定為 csOwnerDrawVariable 時,可以根據每個項目的實際內容來設置不同的高度,並且在需要時會調用 OnMeasureItem 和 OnDrawItem 事件來繪製每個項目。
  • OnMeasureItem 事件用於指定每個項目的高度,您可以根據項目的內容計算不同的高度。這樣,不同的項目可以具有不同的顯示高度。
  • OnDrawItem 事件用於實際的繪製操作。在該事件中,您可以根據需要來繪製每個項目的外觀。


資料來源 : CharGPT 

2023年12月25日 星期一

PopupMenuLib.pas 記錄


AttachFilePopupMenu

procedure TForm1.FormCreate(Sender: TObject);
begin
  popAttachFile := TAttachFilePopupMenu.Create;
end;

procedure TForm1.Button9Click(Sender: TObject);
begin
  popAttachFile.Popup(Button9);  //參數 nil  會在游標處展開下拉選單
end;

//Property
//  popAttachFile.AttachFiles       //附加的文件清單
//  popAttachFile.Readonly          //唯讀,不可附加、移除
//  popAttachFile.DisableAttachFile //不提供附加
//  popAttachFile.DisableRemove     //不提供移除
//  popAttachFile.DisableOpenFile   //不提供文件開啟


PrinterPopupMenu

Uses Printers;

procedure TForm1.Button9Click(Sender: TObject);
var pmPrinterList: TPrinterPopupMenu;
begin
   pmPrinterList := TPrinterPopupMenu.Create;
   pmPrinterList.Popup(Button9);  //參數 nil  會在游標處展開下拉選單
end;

// Property
//   pmPrinterList.PrinterIndex   //印表機Index
//   pmPrinterList.PrinterName    //印表機名稱