如何在 TButton 上放置多行的 Caption

有關Delphi 的語法, 程式, 等
回覆文章
頭像
tim
文章: 1380
註冊時間: 2008年 11月 26日, 00:49

如何在 TButton 上放置多行的 Caption

文章 tim »

在 vcl 的 TButton 上要放置多行, 必須要先改變其 GWL_style 的屬性,
實作的方法則要使用 Window API 中的 SetWindowLong 和 GetWindowLong,
如下:

代碼: 選擇全部

    // TButton 可放置多行 caption 
    procedure SetMultiLineButton(abuttion: TButton); 
    var 
      ah: THandle; 
    begin 
      ah := abuttion.Handle; 
      SetWindowLong(ah, GWL_style, GetWindowLong(ah, GWL_style) OR BS_MULTILINE); 
    end; 
多多留言, 整理文章, 把經驗累積下來.....
回覆文章