delphi for DirectUI界面库

穿精又带淫゛_ 提交于 2019-11-27 02:45:12

下面是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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!