delphi for DirectUI界面庫


下面是form代碼:

unit Unit1;

interface

uses
    Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
    Dialogs, CometSkin, StdCtrls, ComCtrls, ExtCtrls, Menus;
const

    IDM_MODULE_HOME = 100;
    IDM_MODULE_PROTEC = 101;
    IDM_MODULE_SEARCH = 102;
    IDM_MODULE_TOOLS = 103;
    IDM_MODULE_CLOCK = 104;
    IDM_MODULE_HISTORY = 105;

type
    TForm1 = class(TSkinForm)
    Label1: TLabel;
    PopupMenu1: TPopupMenu;
    N11: TMenuItem;
    Button1: TButton;

        procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    private
    { Private declarations }
        procedure WMControlClick(var msg: TMessage); message
            WM_SkinControl_Click;
    public
    { Public declarations }
    end;

var
    Form1: TForm1;

implementation

{$R *.dfm}
{$R '.\Res\SkinRes.RES'}


procedure TForm1.Button1Click(Sender: TObject);
begin

end;

procedure TForm1.FormCreate(Sender: TObject);
begin
    SetBkImage('BkImage1_jpg', 'Skin', 255, 150, 60, 60);
    AddModuleButton(IDM_MODULE_HOME, '首 頁', 'Module_Home_png', 'Skin');
    AddModuleButton(IDM_MODULE_PROTEC, '保 護', 'Module_protec_png', 'Skin');
    AddModuleButton(IDM_MODULE_SEARCH, '查 殺', 'Module_search_png', 'Skin');
    AddModuleButton(IDM_MODULE_TOOLS, '工 具', 'Module_tools_png', 'Skin');
    AddModuleButton(IDM_MODULE_CLOCK, '任 務', 'Module_clock_png', 'Skin');
    AddModuleButton(IDM_MODULE_HISTORY, '記 錄', 'Module_history_png', 'Skin');
    AddModuleButton(IDM_MODULE_HISTORY, '記 錄', 'Module_history_png', 'Skin');
    SetModuleCheck(IDM_MODULE_HOME);
end;

procedure TForm1.WMControlClick(var msg: TMessage);
var
    CtlID: Integer; //控件ID
    nIndex: Integer; //控件索引
    pt: TPoint;
begin
    CtlID := msg.WParam;
    nIndex := msg.LParam;
    case CtlID of
        SCM_MAINMENU:
            begin
            //MessageBox(Handle, '你點擊[主菜單]了', '提示', MB_ICONINFORMATION);
            GetCursorPos(pt);
            PopupMenu1.Popup(pt.X,pt.Y);
            end;
        IDM_MODULE_HOME:
            begin
                SetModuleCheck(CtlID);
                MessageBox(Handle, '你點擊[首 頁]了', '提示',
                    MB_ICONINFORMATION);
            end;

        IDM_MODULE_PROTEC:
            begin
                SetModuleCheck(CtlID);
                MessageBox(Handle, '你點擊[保 護]了', '提示',
                    MB_ICONINFORMATION);
            end;
        IDM_MODULE_SEARCH:
            begin
                SetModuleCheck(CtlID);
                MessageBox(Handle, '你點擊[查 殺]了', '提示',
                    MB_ICONINFORMATION);
            end;
        IDM_MODULE_TOOLS:
            begin
                SetModuleCheck(CtlID);
                MessageBox(Handle, '你點擊[工 具]了', '提示',
                    MB_ICONINFORMATION);
            end;
        IDM_MODULE_CLOCK:
            begin
                SetModuleCheck(CtlID);
                MessageBox(Handle, '你點擊[任 務]了', '提示',
                    MB_ICONINFORMATION);
            end;
        IDM_MODULE_HISTORY:
            begin
                SetModuleCheck(CtlID);
                MessageBox(Handle, '你點擊[記 錄]了', '提示',
                    MB_ICONINFORMATION);
            end;
    end;
end;
end.

開源DirectUI界面庫

 

微軟 
https://github.com/jameskeane/directui
中國
http://code.google.com/p/duilib/
俄國
https://github.com/rsdn/avalon


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM