コード例 #1
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
    void Init()
    {
        m_hWindow = XWnd_Create(400, 200, 350, 400, L"炫彩界面库窗口",NULL, xc_window_style_default);
        XBtn_SetType(XBtn_Create(5, 3, 60, 20, L"Close", m_hWindow),button_type_close);
        
        m_hTree= XTree_Create(20,40,300,300,m_hWindow);
        XTree_SetItemTemplateXML(m_hTree,L"Tree_Item.xml");
		
        hAdapter=XAdapterTree_Create();
        XTree_BindAdapter(m_hTree,hAdapter);
        XAdapterTree_AddColumn(hAdapter,(XC_NAME));
        
        wchar_t  buf[256]={0};
        int id=0;
        for (int i=0;i<20;i++)
        {
            wsprintf(buf,L"name-%d-0",i);
            id=XAdapterTree_InsertItemText(hAdapter,buf,XC_ID_ROOT,XC_ID_LAST);
        }
        
		HELE hBtn = XBtn_Create(100,5,100,20,L"删除第一项",m_hWindow);
		XEle_RegEventCPP(hBtn,XE_BNCLICK,&CMyWindowTree::OnBtnClick);
//         int idc1=XAdapterTree_InsertItemText(hAdapter,L"Item1------1",1,XC_ID_LAST);
//         int idc2=XAdapterTree_InsertItemText(hAdapter,L"Item1------2",1,XC_ID_LAST);
//         int idc2_1=XAdapterTree_InsertItemText(hAdapter,L"Item1-----2--1",idc2,XC_ID_LAST);
        
        XEle_RegEventCPP(m_hTree,XE_TREE_SELECT,&CMyWindowTree::OnTreeSelect);
        XEle_RegEventCPP(m_hTree,XE_TREE_EXPAND,&CMyWindowTree::OnTreeExpand);
		
        XEle_RegEventCPP(m_hTree,XE_TREE_TEMP_CREATE,&CMyWindowTree::OnTemplateCreate);
        XEle_RegEventCPP(m_hTree,XE_TREE_TEMP_DESTROY,&CMyWindowTree::OnTemplateDestroy);
        XEle_RegEventCPP(m_hTree,XE_TREE_TEMP_ADJUST_COORDINATE,&CMyWindowTree::OnTemplateAdjustCoordinate);
		
        XWnd_ShowWindow(m_hWindow,SW_SHOW);
    }
コード例 #2
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
    BOOL Create() //创建窗口和按钮
    {
		srand(GetTickCount());
        m_hWindow=XWnd_Create(0,0,500,300,L"炫彩界面库-窗口"); //创建窗口
		m_nCur = 0;
        if(m_hWindow)
        {
            m_hButton =XBtn_Create(10,5,80,20,L"增加标签",m_hWindow); //创建按钮
            XEle_RegEventCPP(m_hButton,XE_BNCLICK,&CMyWnd::OnEventBtnClick); //注册按钮点击事件
			

			m_hButton =XBtn_Create(90,5,80,20,L"表头左",m_hWindow); //创建按钮
            XEle_RegEventCPP(m_hButton,XE_BNCLICK,&CMyWnd::OnEventBtnLeftClick); //注册按钮点击事件

			m_hButton =XBtn_Create(170,5,80,20,L"表头上",m_hWindow); //创建按钮
            XEle_RegEventCPP(m_hButton,XE_BNCLICK,&CMyWnd::OnEventBtnTopClick); //注册按钮点击事件


			m_hButton =XBtn_Create(250,5,80,20,L"表头右",m_hWindow); //创建按钮
            XEle_RegEventCPP(m_hButton,XE_BNCLICK,&CMyWnd::OnEventBtnRightClick); //注册按钮点击事件

			m_hButton =XBtn_Create(330,5,80,20,L"表头下",m_hWindow); //创建按钮
            XEle_RegEventCPP(m_hButton,XE_BNCLICK,&CMyWnd::OnEventBtnBottomClick); //注册按钮点击事件


			RECT rtBody;
			XWnd_GetBodyRect(m_hWindow,&rtBody);
			m_tabBar.Init(rtBody.left,rtBody.top,rtBody.right - rtBody.left,rtBody.bottom - rtBody.top,m_hWindow);
            XWnd_ShowWindow(m_hWindow,SW_SHOW); //显示窗口
            return TRUE;
        }
        return FALSE;
    }
コード例 #3
0
ファイル: sliderBar.cpp プロジェクト: BraveStone/xcgui
void SliderBar_Init(HELE hEle,int x,int y,int cx,int cy,int eleType,HXCGUI hParent)
{
	Ele_Init(hEle,x,y,cx,cy,eleType,hParent);
	AddTypeDebug(hEle,XC_SLIDERBAR);

	slider_ *pObj=SLIDER(hEle);
	pObj->range=100;
	pObj->minPos=1;
	pObj->btnWidth=10;

	if(pObj->bHorizon)
	{
		pObj->hButton= XBtn_Create(0,0,pObj->btnWidth,cy);
	}else
	{
		pObj->hButton= XBtn_Create(0,0,cx,pObj->btnWidth);
	}

	XEle_AddEle(hEle,pObj->hButton);
	XEle_EnableFocus(pObj->hButton,FALSE);
	Ele_SetType(pObj->hButton,XC_BUTTON_SLIDERBAR_SLIDER);

	XEle_RegisterMessage(hEle,XM_PAINT,SliderBar_OnDraw);
	XEle_RegisterMessage(hEle,XM_MOUSEMOVE,SliderBar_OnMouseMove);
	XEle_RegisterMessage(hEle,XM_LBUTTONDOWN,SliderBar_OnLButtonDown);
	XEle_RegisterMessage(hEle,XM_LBUTTONUP,SliderBar_OnLButtonUp);
	XEle_RegisterEvent(hEle,XE_MOUSELEAVE,SliderBar_OnEventMouseLeave);	

	XEle_RegisterMessage(pObj->hButton,XM_PAINT,SliderBar_OnDrawButton);
	XEle_RegisterEvent(hEle,XE_DESTROY,SliderBar_OnDestroy);
}
コード例 #4
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
    void Init()
    {
		XC_RegisterWindowClassName(L"大色秘密");
		m_hWindow = XWnd_CreateEx(NULL,L"大色秘密",L"代理IP",WS_VISIBLE,0, 0, 300, 200);
        //m_hWindow = XWnd_Create(0, 0, 300, 200, L"炫彩界面库窗口",NULL, xc_window_style_default);


        XBtn_SetType(XBtn_Create(5, 3, 60, 20, L"Close", m_hWindow),button_type_close);

        m_hButton = XBtn_Create(100, 50, 80, 25,L"显示更随", m_hWindow);
		XBtn_SetType(m_hButton,button_type_check);
        XEle_RegEventCPP(m_hButton,XE_BUTTON_CHECK,&CMyWindowButton::OnButtonCheck);


		HELE hBtn = XBtn_Create(100, 100, 80, 25,L"弹出广告", m_hWindow);

		XEle_RegEventCPP(hBtn,XE_BNCLICK,&CMyWindowButton::OnBtnClick);


		//主要代码。。。。
		m_RightPane.Create(m_hWindow);
		m_RightPane.AdjustPos();


        XWnd_ShowWindow(m_hWindow,SW_SHOW);

    }
コード例 #5
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
    void Init()
    {
        m_hWindow = XWnd_Create(0, 0, 500, 400, L"ìŲʽçÃæ¿â´°¿Ú",NULL, xc_window_style_default);
        XBtn_SetType(XBtn_Create(5, 3, 60, 20, L"Close", m_hWindow),button_type_close);
    
        m_hListBox=XListBox_Create(20,40,300,310,m_hWindow);
        XListBox_SetItemTemplateXML(m_hListBox,L"ListBox_Item.xml");
        XSView_SetLineSize(m_hListBox,20,20);

        HXCGUI hAdapter=XAdapterTable_Create();
        XListBox_BindAdapter(m_hListBox,hAdapter);
        XAdapterTable_AddColumn(hAdapter,XC_NAME);
        XAdapterTable_AddColumn(hAdapter,XC_NAME2);
        XAdapterTable_AddColumn(hAdapter,XC_NAME3);

        wchar_t  buf[256]={0};
        int  index=0;
        for (int i=0;i<20;i++)
        {
            wsprintf(buf,L"item-%d",i);
            index=XAdapterTable_AddItemTextEx(hAdapter,(XC_NAME),buf);
            if(XC_ID_ERROR!=index)
            {
                wsprintf(buf,L"item-1-%d",i);
                XAdapterTable_SetItemTextEx(hAdapter,index,(XC_NAME2),buf);

                wsprintf(buf,L"item-2-%d",i);
                XAdapterTable_SetItemTextEx(hAdapter,index,(XC_NAME3),buf);
            }
        }

        HELE hButton1=XBtn_Create(330,40,100,18,L"²åÈëindex=1",m_hWindow);
        XEle_RegEventCPP(hButton1,XE_BNCLICK,&CMyWindowListBox::OnBtnClickAdd);

        HELE hButton2=XBtn_Create(330,62,100,18,L"ɾ³ýindex=1",m_hWindow);
        XEle_RegEventCPP(hButton2,XE_BNCLICK,&CMyWindowListBox::OnBtnClickDel);

        HELE hButton3=XBtn_Create(330,84,100,18,L"ɾ³ýindex=(2-3)",m_hWindow);
        XEle_RegEventCPP(hButton3,XE_BNCLICK,&CMyWindowListBox::OnBtnClickDelEx);

        m_hRichEidt=XRichEdit_Create(330,106,120,200,m_hWindow);
        XSView_ShowSBarV(m_hRichEidt,TRUE);
        XRichEdit_EnableMultiLine(m_hRichEidt,TRUE);

        XEle_RegEventCPP(m_hListBox,XE_LISTBOX_TEMP_CREATE,&CMyWindowListBox::OnTemplateCreate);
        XEle_RegEventCPP(m_hListBox,XE_LISTBOX_TEMP_DESTROY,&CMyWindowListBox::OnTemplateDestroy);
        XEle_RegEventCPP(m_hListBox,XE_LISTBOX_TEMP_ADJUST_COORDINATE,&CMyWindowListBox::OnTemplateAdjustCoordinate);
        XEle_RegEventCPP(m_hListBox,XE_LISTBOX_SELECT,&CMyWindowListBox::OnListBoxSelect);
        
        XWnd_ShowWindow(m_hWindow,SW_SHOW);
    }
コード例 #6
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
    void Init()
    {
        m_hWindow = XWnd_Create(0, 0, 350, 200, L"ìŲʽçÃæ¿â´°¿Ú",NULL, xc_window_style_default);
        XBtn_SetType(XBtn_Create(10, 5, 60, 20,L"close",m_hWindow),button_type_close);
		
        m_hGif1=XShapeGif_Create(20,50,100,100,m_hWindow);
        XShapeGif_SetImage(m_hGif1,XImage_LoadFile(L"image\\gif.gif"));
		
        m_hGif2=XShapeGif_Create(150,50,100,100,m_hWindow);
        XShapeGif_SetImage(m_hGif2,XImage_LoadFile(L"image\\gif.gif"));
		
        m_hButton = XBtn_Create(260, 50, 60, 20,L"Ïú»Ù", m_hWindow);
        XEle_RegEventCPP(m_hButton,XE_BNCLICK,&CMyWindowGif::OnBtnClick);
        XWnd_ShowWindow(m_hWindow,SW_SHOW);
    }
コード例 #7
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
    void Init()
    {
        m_hWindow = XWnd_Create(0, 0, 400, 400, L"炫彩界面库窗口",NULL, xc_window_style_default);
        XBtn_SetType(XBtn_Create(5, 3, 60, 20, L"Close", m_hWindow),button_type_close);
		
        m_hListBox=XListBox_Create(20,40,300,310,m_hWindow);
        XListBox_SetItemTemplateXML(m_hListBox,L"ListBox_Item.xml");
        XSView_SetLineSize(m_hListBox,20,20);
        XListBox_EnableMultiSel(m_hListBox,FALSE);
		
        HXCGUI hAdapter=XAdapterTable_Create();
        XListBox_BindAdapter(m_hListBox,hAdapter);
        XAdapterTable_AddColumn(hAdapter,L"name");
		XAdapterTable_AddColumn(hAdapter,L"name1");
		
        wchar_t  buf[256]={0};
        int  index=0;
        for (int i=0;i<20;i++)
        {
            wsprintf(buf,L"item-%d",i);
            index=XAdapterTable_AddItemTextEx(hAdapter,(XC_NAME),buf);
			XAdapterTable_SetItemText(hAdapter,index,1,L"测试");
        }
        //项选择事件
        XEle_RegEventCPP(m_hListBox,XE_LISTBOX_SELECT,&CMyWindowListBox::OnListBoxSelect);
        //项模板实例化完成事件
        XEle_RegEventCPP(m_hListBox,XE_LISTBOX_TEMP_CREATE_END,&CMyWindowListBox::OnListBoxTemplateCreateEnd);
        XWnd_ShowWindow(m_hWindow,SW_SHOW);
    }
コード例 #8
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
int WINAPI wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
    XInitXCGUI();
	
    HWINDOW hWindow = XWnd_Create(0, 0, 300, 200, L"ìŲʽçÃæ¿â´°¿Ú",NULL, xc_window_style_default);
    XBtn_SetType(XBtn_Create(10, 5, 60, 20,L"close",hWindow),button_type_close);
	
    my_image_info  info;
    info.hImage1=XImage_LoadFile(L"1.png");
    info.hImage2=XImage_LoadFile(L"2.png");
    info.hImage3=XImage_LoadFile(L"3.png");
    info.hImage4=XImage_LoadFile(L"4.png");
    info.hImage5=XImage_LoadFile(L"5.png");
    info.hImage6=XImage_LoadFile(L"6.png");
	
    int left=20;
    int top=50;
    CreateButton(left,top,&info,hWindow); left+=50;
    CreateButton(left,top,&info,hWindow); left+=50;
    CreateButton(left,top,&info,hWindow); left+=50;
    CreateButton(left,top,&info,hWindow); left+=50;
    CreateButton(left,top,&info,hWindow); left+=50;
	
    left=20; top=100;
    CreateButtonLoop(left,top,&info,hWindow); left+=50;
    CreateButtonLoop(left,top,&info,hWindow); left+=50;
    CreateButtonLoop(left,top,&info,hWindow); left+=50;
    CreateButtonLoop(left,top,&info,hWindow); left+=50;
    CreateButtonLoop(left,top,&info,hWindow); left+=50;
	
    XWnd_ShowWindow(hWindow,SW_SHOW);
    XRunXCGUI();
    XExitXCGUI();
    return 0;
}
コード例 #9
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
    void Init()
    {
        m_hWindow = XWnd_Create(0, 0, 300, 200, L"ìŲʽçÃæ¿â´°¿Ú", NULL, xc_window_style_default);
        XBtn_SetType(XBtn_Create(5, 3, 60, 20, L"Close", m_hWindow),button_type_close);
		
        m_MenuBar = XMenuBar_Create(20,40,260,28,m_hWindow);
        XMenuBar_AddButton(m_MenuBar, L"Îļþ");
        XMenuBar_AddButton(m_MenuBar, L"±à¼­");
        XMenuBar_AddButton(m_MenuBar, L"ÊÓͼ");
        XMenuBar_AddButton(m_MenuBar, L"aaa");
		
        XMenuBar_AddMenuItem(m_MenuBar, 0, 101, L"101");
        XMenuBar_AddMenuItem(m_MenuBar, 0, 102, L"102");
        XMenuBar_AddMenuItem(m_MenuBar, 0, 103, L"103");
		
        XMenuBar_AddMenuItem(m_MenuBar, 1, 201, L"201");
        XMenuBar_AddMenuItem(m_MenuBar, 1, 202, L"202");
        XMenuBar_AddMenuItem(m_MenuBar, 1, 203, L"203");
		
        XMenuBar_AddMenuItem(m_MenuBar, 2, 301, L"301");
		
        XMenuBar_AddMenuItem(m_MenuBar, 0, 1031, L"3-1",103);
        
        XEle_RegEventCPP(m_MenuBar,XE_MENUSELECT,&CMyWindowMenuBar::OnWndMenuSelect);
        XWnd_ShowWindow(m_hWindow,SW_SHOW);
    }
コード例 #10
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
    void Init()
    {
        m_hWindow = XWnd_Create(0, 0, 400, 300, L"ìŲʽçÃæ¿â´°¿Ú",NULL, xc_window_style_default);
        XBtn_SetType(XBtn_Create(10, 5, 60, 20,L"close",m_hWindow),button_type_close);

        HXCGUI hShapeRect=XShapeRect_Create(20,50,100,100,m_hWindow);
        XWnd_ShowWindow(m_hWindow,SW_SHOW);
    }
コード例 #11
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
    void Init()
    {
        m_hWindow = XWnd_Create(0, 0, 300, 200, L"ìŲʽçÃæ¿â´°¿Ú",NULL, xc_window_style_default);
        XBtn_SetType(XBtn_Create(10, 5, 60, 20,L"close",m_hWindow),button_type_close);
        XWnd_RegEventCPP(m_hWindow,WM_DESTROY,&CWindow_Demo::OnDestroy);

		m_hEle = XEle_Create(8,30,250,150,m_hWindow);
		XEle_RegEventCPP(m_hEle,XE_PAINT,&CWindow_Demo::OnDraw);
        XWnd_ShowWindow(m_hWindow,SW_SHOW);
    }
コード例 #12
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
void CreateButtonLoop(int left,int top,my_image_info  *pInfo,HWINDOW hWindow)
{
    HELE hButton=XBtn_Create(left,top,37,42,L"B",hWindow);
    XBtn_AddAnimationFrame(hButton,pInfo->hImage1,100); //Ìí¼Ó¶¯»­Ö¡
    XBtn_AddAnimationFrame(hButton,pInfo->hImage2,100);
    XBtn_AddAnimationFrame(hButton,pInfo->hImage3,100);
    XBtn_AddAnimationFrame(hButton,pInfo->hImage4,100);
    XBtn_AddAnimationFrame(hButton,pInfo->hImage5,100);
    XBtn_AddAnimationFrame(hButton,pInfo->hImage6,100);
    XBtn_EnableAnimation(hButton,TRUE,TRUE); //Æô¶¯¶¯»­,Ñ­»·²¥·Å
}
コード例 #13
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
int APIENTRY _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine, int nCmdShow)
{
    XInitXCGUI(); //初始化
    hWindow=XWnd_Create(0,0,300,200,L"炫彩界面库-窗口");//创建窗口
    if(hWindow)
    {
        HELE hButton=XBtn_Create(10,10,80,25,L"按钮",hWindow);//创建按钮

		
		ManualDestoryFont(hButton);

        XWnd_ShowWindow(hWindow,SW_SHOW);//显示窗口		
        XRunXCGUI(); //运行
    }
    XExitXCGUI(); //释放资源
    return 0;
}
コード例 #14
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
int APIENTRY _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine, int nCmdShow)
{
    XInitXCGUI(); //初始化
    hWindow=XWnd_Create(0,0,300,200,L"炫彩界面库-窗口");//创建窗口
    if(hWindow)
    {
		XBtn_SetType(XBtn_Create(10,10,80,25,L"关闭",hWindow),button_type_close);

		HELE hChild = XEle_Create(0,0,100,100,hWindow);
		XEle_EnableEvent_XE_MOUSEWHEEL(hChild,TRUE);
		XEle_RegEventC(hChild,XE_MOUSEWHEEL,OnMouseWheel);

        XWnd_ShowWindow(hWindow,SW_SHOW);//显示窗口
        XRunXCGUI(); //运行
    }
    XExitXCGUI(); //释放资源
    return 0;
}
コード例 #15
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
    void Init()
    {
        m_hWindow = XWnd_Create(0, 0, 550, 380, L"ìŲʽçÃæ¿â´°¿Ú",NULL, xc_window_style_default);
        XBtn_SetType(XBtn_Create(5, 3, 60, 20, L"Close", m_hWindow),button_type_close);
		
        m_hList= XList_Create(20,40,500,300,m_hWindow);
        XList_SetItemTemplateXML(m_hList,L"List_Item.xml");
        XSView_SetLineSize(m_hList,20,20);
		
        XList_AddColumn(m_hList,100);
        XList_AddColumn(m_hList,100);
        XList_AddColumn(m_hList,100);
		
        HXCGUI hAdapterHeader=XAdapterMap_Create();
        XList_BindAdapterHeader(m_hList,hAdapterHeader);
        XAdapterMap_AddItemText(hAdapterHeader,(XC_NAME),L"aaa");
        XAdapterMap_AddItemText(hAdapterHeader,(XC_NAME2),L"bbb");
        XAdapterMap_AddItemText(hAdapterHeader,(XC_NAME3),L"ccc");
        XAdapterMap_AddItemText(hAdapterHeader,(XC_NAME4),L"test");
		
        HXCGUI hAdapter=XAdapterTable_Create();
        XList_BindAdapter(m_hList,hAdapter);
        XAdapterTable_AddColumn(hAdapter,(XC_NAME));
        XAdapterTable_AddColumn(hAdapter,(XC_NAME2));
        XAdapterTable_AddColumn(hAdapter,(XC_NAME3));
		
        XList_SetColumnWidth(m_hList,0,150);
        XList_SetColumnWidth(m_hList,1,150);
        XList_SetColumnWidth(m_hList,2,150);
		
        wchar_t tmp[MAX_PATH]={0};
        for (int i=0;i<20;i++)
        {
            wsprintf(tmp,L"item-%d",i);
            XAdapterTable_AddItemText(hAdapter,tmp);
			
            wsprintf(tmp,L"child-%d-1",i);  XAdapterTable_SetItemText(hAdapter,i,1,tmp);
            wsprintf(tmp,L"child-%d-2",i);  XAdapterTable_SetItemText(hAdapter,i,2,tmp);
        }
		
        XWnd_ShowWindow(m_hWindow,SW_SHOW);
    }
コード例 #16
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
int APIENTRY _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine, int nCmdShow)
{
    XInitXCGUI(); //初始化
    hWindow=XWnd_Create(0,0,300,200,L"炫彩界面库-窗口");//创建窗口
    if(hWindow)
    {
        HELE hButton=XBtn_Create(10,10,80,25,L"按钮",hWindow);//创建按钮
        XEle_RegEventC(hButton,XE_BNCLICK,My_EventBtnClick);//注册按钮点击事件
		
		HBKINFOM hBkInfoM = XWnd_GetBkInfoManager(hWindow);

		HIMAGE hImageBody = XImage_LoadRes(IDR_JPG2,L"JPG",TRUE);
		XBkInfoM_AddImage(hBkInfoM,window_state_body_leave,hImageBody);


        XWnd_ShowWindow(hWindow,SW_SHOW);//显示窗口
		
        XRunXCGUI(); //运行
    }
    XExitXCGUI(); //释放资源
    return 0;
}
コード例 #17
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
int APIENTRY _tWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine, int nCmdShow)
{
    XInitXCGUI(); //初始化
    hWindow=XWnd_Create(0,0,300,200,L"炫彩界面库-窗口");//创建窗口
    if(hWindow)
    {
		g_hEle = XEle_Create(8,30,100,50,hWindow);
		//因为形状对象没有事件,所以创建一个 ele作为父,然后接受各种消息
		g_ShapeText = XShapeText_Create(0,0,100,20,L"初始化",g_hEle);
		XEle_RegEventC1(g_hEle,XE_ELEPROCE,OnEventProc);


        HELE hButton=XBtn_Create(10,5,80,20,L"创建线程",hWindow);//创建按钮
        XEle_RegEventC(hButton,XE_BNCLICK,My_EventBtnClick);//注册按钮点击事件
		

		XWnd_RegEventC(hWindow,XE_USER_SETTEXT,OnSetText);
        XWnd_ShowWindow(hWindow,SW_SHOW);//显示窗口
		
        XRunXCGUI(); //运行
    }
    XExitXCGUI(); //释放资源
    return 0;
}
コード例 #18
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
    void Init()
    {
        m_hWindow = XFrameWnd_Create(0, 0, 600, 400, L"炫彩界面库窗口",NULL, xc_window_style_default);
        XBtn_SetType(XBtn_Create(3,3,20,20,L"X",m_hWindow),button_type_close);
		
		HELE hView = XEle_Create(200,10,100,100,m_hWindow);

		XFrameWnd_SetView(m_hWindow,hView);

        m_hPane1=XPane_Create(L"解决方案",200,200,m_hWindow); //创建窗格
        m_hPane2=XPane_Create(L"类视图",200,200,m_hWindow);
        m_hPane3=XPane_Create(L"属性管理",200,200,m_hWindow);
		m_hPane4=XPane_Create(L"团队资源",200,200,m_hWindow); //创建窗格
        m_hPane5=XPane_Create(L"起始页",200,200,m_hWindow);
        m_hPane6=XPane_Create(L"服务器",200,200,m_hWindow);
		m_hPane7=XPane_Create(L"工具箱",200,200,m_hWindow); //创建窗格
		m_hPane8=XPane_Create(L"输出",200,200,m_hWindow); //创建窗格
		
        XFrameWnd_AddPane(m_hWindow,NULL,m_hPane1,align_left); //添加窗格
		XFrameWnd_AddPane(m_hWindow,NULL,m_hPane5,align_right);
        XFrameWnd_AddPane(m_hWindow,NULL,m_hPane6,align_right);
		XFrameWnd_AddPane(m_hWindow,NULL,m_hPane8,align_bottom);

        XFrameWnd_MergePane(m_hWindow, m_hPane1, m_hPane2); //合并窗格
		XFrameWnd_MergePane(m_hWindow, m_hPane1, m_hPane3); //合并窗格
		XFrameWnd_MergePane(m_hWindow, m_hPane1, m_hPane4); //合并窗格

		XFrameWnd_MergePane(m_hWindow, m_hPane6, m_hPane7); //合并窗格
		
        //XFrameWnd_SetView(m_hWindow,XEle_Create(0,0,100,100,m_hWindow)); //设置主视图
        XWnd_RegEventCPP(m_hWindow,WM_RBUTTONUP,&CFrameWindow_Demo::OnWndRButtonUp);
        XWnd_RegEventCPP(m_hWindow, XWM_MENU_SELECT, &CFrameWindow_Demo::OnWndMenuSelect);
        
        XWnd_AdjustLayout(m_hWindow);
        XWnd_ShowWindow(m_hWindow,SW_SHOW);
    }
コード例 #19
0
ファイル: WinMain.cpp プロジェクト: ylca/XCGUI
	_tagLabel CreateNewLabel(int labelSize,const wchar_t* pLabelName)
	{
		int xBtn = 0;
		int yBtn = 0;
		int cxBtn = 100;
		int cyBtn = 20;
		if (m_bHorizon)
		{
			xBtn = labelSize;
		}else
		{
			yBtn = labelSize;
		}
		
		int xPage = 0;
		int yPage = 0;
		int cxPage = 0;
		int cyPage = 0;

		RECT rtSView;
		XEle_GetClientRect(m_hSview,&rtSView);
		RECT rtTabBar;
		XEle_GetClientRect(m_hEle,&rtTabBar);

		switch (m_Direction)
		{
		case tabbar_direction_left:
			{
				xPage = rtSView.right;
				cxPage = rtTabBar.right - rtSView.right;
				cyPage = rtTabBar.bottom;
			}
			break;
		case tabbar_direction_top:
			{
				yPage = rtSView.bottom;
				cxPage= rtTabBar.right;
				cyPage= rtTabBar.bottom - rtSView.bottom;
			}
			break;
		case tabbar_direction_right:
			{
				cxPage = rtTabBar.right - rtSView.right;
				cyPage = rtTabBar.bottom;
			}
			break;
		case tabbar_direction_bottom:
			{
				cxPage = rtTabBar.right;
				cyPage = rtTabBar.bottom - rtSView.bottom;
			}
			break;
		}

		_tagLabel labelData;
		labelData.hBtn = XBtn_Create(xBtn,yBtn,cxBtn,cyBtn,pLabelName,m_hSview);
		XBtn_SetType(labelData.hBtn,button_type_radio);
		XBtn_SetStyle(labelData.hBtn,button_style_default);
		labelData.hPage = XEle_Create(xPage,yPage,cxPage,cyPage,m_hEle);

		XEle_RegEventCPP1(labelData.hBtn,XE_BUTTON_CHECK,&CTabBar::OnLabelCheck);

		XEle_AddBkFill(labelData.hPage,rand(),255);

		return labelData;
	}
コード例 #20
0
ファイル: example_richEdit.cpp プロジェクト: BraveStone/xcgui
int APIENTRY _tWinMain(HINSTANCE hInstance,  HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	XInitXCGUI();

	//创建窗口
	HWINDOW hWindow=XWnd_CreateWindow(0,0,550,450,L"炫彩界面库-窗口");
	XWnd_EnableDragBorder(hWindow,FALSE);

	HELE hButton=XBtn_Create(10,10,60,22,L"插入元素",hWindow);
	XEle_EnableEle(hButton,FALSE);
	XEle_RegisterEvent(hButton,XE_BNCLICK,MyEventBtnClick);

	HELE hButton2=XBtn_Create(80,10,60,22,L"插入图片",hWindow);
	XEle_EnableFocus(hButton2,FALSE);
	XEle_RegisterEvent(hButton2,XE_BNCLICK,MyEventBtnClick2);

	HELE hButton3=XBtn_Create(150,10,60,22,L"插入GIF",hWindow);
	XEle_EnableFocus(hButton3,FALSE);
	XEle_RegisterEvent(hButton3,XE_BNCLICK,MyEventBtnClick3);

	HELE hButton4=XBtn_Create(220,10,60,22,L"插入GIF",hWindow);
	XEle_EnableFocus(hButton4,FALSE);
	XEle_RegisterEvent(hButton4,XE_BNCLICK,MyEventBtnClick4);

	HELE hButton5=XBtn_Create(290,10,60,22,L"插入GIF",hWindow);
	XEle_EnableFocus(hButton5,FALSE);
	XEle_RegisterEvent(hButton5,XE_BNCLICK,MyEventBtnClick5);

	hRichEdit=XRichEdit_Create(10,40,390,350,hWindow); //创建RichEdit

	HELE hView=XSView_GetView(hRichEdit);
	XEle_SetBkColor(hView,RGB(220,220,220));

	//创建字体
	XC_InitFont(&Font1,L"宋体",12);
	XC_InitFont(&Font2,L"宋体",16);
	XC_InitFont(&Font3,L"宋体",20);
	XC_InitFont(&Font4,L"宋体",28);
	XC_InitFont(&Font5,L"宋体",16,TRUE);
	XC_InitFont(&Font6,L"宋体",16,FALSE,TRUE);
	XC_InitFont(&Font7,L"宋体",16,FALSE,FALSE,TRUE);

	XStatic_Create(420,30,100,20,L"设置字体:",hWindow);

	HELE hButtonFont1=XBtn_Create(420,50,100,22,L"字体 12号",hWindow);	//12
	HELE hButtonFont2=XBtn_Create(420,80,100,22,L"字体 16号",hWindow); //16
	HELE hButtonFont3=XBtn_Create(420,110,100,22,L"字体 20号",hWindow); //20
	HELE hButtonFont4=XBtn_Create(420,140,100,22,L"字体 28号",hWindow); //28

	HELE hButtonFont5=XBtn_Create(420,170,100,22,L"粗体 16号",hWindow);//粗体16号
	HELE hButtonFont6=XBtn_Create(420,200,100,22,L"斜体 16号",hWindow);//斜体16号
	HELE hButtonFont7=XBtn_Create(420,230,100,22,L"下划线 16号",hWindow);//下弧线16号

	XEle_EnableFocus(hButtonFont1,FALSE);
	XEle_EnableFocus(hButtonFont2,FALSE);
	XEle_EnableFocus(hButtonFont3,FALSE);
	XEle_EnableFocus(hButtonFont4,FALSE);
	XEle_EnableFocus(hButtonFont5,FALSE);
	XEle_EnableFocus(hButtonFont6,FALSE);
	XEle_EnableFocus(hButtonFont7,FALSE);

	XEle_RegisterEvent(hButtonFont1,XE_BNCLICK,MyEventBtnClick6);
	XEle_RegisterEvent(hButtonFont2,XE_BNCLICK,MyEventBtnClick7);
	XEle_RegisterEvent(hButtonFont3,XE_BNCLICK,MyEventBtnClick8);
	XEle_RegisterEvent(hButtonFont4,XE_BNCLICK,MyEventBtnClick9);
	XEle_RegisterEvent(hButtonFont5,XE_BNCLICK,MyEventBtnClick10);
	XEle_RegisterEvent(hButtonFont6,XE_BNCLICK,MyEventBtnClick11);
	XEle_RegisterEvent(hButtonFont7,XE_BNCLICK,MyEventBtnClick12);

	XStatic_Create(420,265,100,20,L"设置颜色:",hWindow);
	hColor=XCHColor_Create(420,290,100,22,hWindow);
	XEle_RegisterEvent(hColor,XE_EDIT_CHANGE,OnEventEditChange);

	HELE hButtonTest=XBtn_Create(420,320,100,20,L"测试",hWindow);
	XEle_EnableFocus(hButtonTest,FALSE);
	XEle_RegisterEvent(hButtonTest,XE_BNCLICK,MyEventBtnClick1_Test);

	//XRichEdit_SetText(hRichEdit,L"123456");

	XWnd_ShowWindow(hWindow,SW_SHOW);

	XRunXCGUI();

	return 0;
}
コード例 #21
0
ファイル: example_richEdit.cpp プロジェクト: BraveStone/xcgui
int APIENTRY _tWinMain(HINSTANCE hInstance,  HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
	XInitXCGUI();

	//创建窗口
	HWINDOW hWindow=XWnd_CreateWindow(0,0,550,450,L"炫彩界面库-窗口-RichEdit");
	XWnd_EnableDragBorder(hWindow,FALSE);
	XWnd_SetBkColor(hWindow,RGB(230,242,253));

	int top=2;
	hRichEdit1=XRichEdit_Create(2,top,530,200,hWindow); //创建RichEdit 1
	XEle_SetBkColor(XSView_GetView(hRichEdit1),RGB(240,240,240));
	XRichEdit_SetReadOnly(hRichEdit1,TRUE);
	top+=200;

	HELE hToolBarEle=XEle_Create(2,top,530,68,hWindow);
	XEle_SetBkColor(hToolBarEle,RGB(230,242,253));
	XEle_EnableBorder(hToolBarEle,FALSE);
	top+=68;

	hRichEdit2=XRichEdit_Create(2,top,530,110,hWindow); //创建RichEdit 2
	XRichEdit_SetText(hRichEdit2,L"待发送的文本内容123456.");
	top+=112;
	HELE hBtnSend=XBtn_Create(530-60,top,60,22,L"发送",hWindow);
	XEle_EnableFocus(hBtnSend,FALSE);

	////////默认属性///////////////////////////////
	int left=5;
	HELE hStatic1=XStatic_Create(left,2,60,20,L"默认属性:",hToolBarEle);	//默认属性
	XEle_SetBkTransparent(hStatic1,TRUE);
	left+=62;

	hColor=XCHColor_Create(left,2,75,20,hToolBarEle); //颜色
	XCHColor_SetColor(hColor,RGB(0,0,0));
	left+=77;

	//字体名称
	hCombox_fontName=XComboBox_Create(left,2,80,20,hToolBarEle);
	XComboBox_EnableEdit(hCombox_fontName,FALSE);
	XComboBox_AddString(hCombox_fontName,L"宋体");
	XComboBox_AddString(hCombox_fontName,L"隶书");
	XComboBox_AddString(hCombox_fontName,L"方正舒体");
	XComboBox_AddString(hCombox_fontName,L"华文彩云");
	XComboBox_SetSelectItem(hCombox_fontName,0);
	left+=82;

	hFontSize=XComboBox_Create(left,2,60,20,hToolBarEle); //字体大小
	XComboBox_EnableEdit(hFontSize,FALSE);
	XComboBox_AddString(hFontSize,L"12");
	XComboBox_AddString(hFontSize,L"14");
	XComboBox_AddString(hFontSize,L"16");
	XComboBox_AddString(hFontSize,L"18");
	XComboBox_AddString(hFontSize,L"20");
	XComboBox_SetSelectItem(hFontSize,0);
	left+=62;

	hBold=XBtn_Create(left,2,30,20,L"B",hToolBarEle); //粗体
	left+=32;

	hItalic=XBtn_Create(left,2,30,20,L"/",hToolBarEle); //斜体
	left+=32;
	hUnderline=XBtn_Create(left,2,30,20,L"&U",hToolBarEle); //下划线

	//////////选择属性//////////////////////////////////////
	left=5;
	HELE hStatic2=XStatic_Create(left,24,60,20,L"选择属性:",hToolBarEle);
	XEle_SetBkTransparent(hStatic2,TRUE);
	left+=62;
	hColor2=XCHColor_Create(left,24,75,20,hToolBarEle); //颜色
	left+=77;

	//字体名称
	hCombox_fontName2=XComboBox_Create(left,24,80,20,hToolBarEle);
	XComboBox_EnableEdit(hCombox_fontName2,FALSE);
	XComboBox_AddString(hCombox_fontName2,L"宋体");
	XComboBox_AddString(hCombox_fontName2,L"隶书");
	XComboBox_AddString(hCombox_fontName2,L"方正舒体");
	XComboBox_AddString(hCombox_fontName2,L"华文彩云");
	XComboBox_SetSelectItem(hCombox_fontName2,0);
	left+=82;

	hFontSize2=XComboBox_Create(left,24,60,20,hToolBarEle); //字体大小
	XComboBox_EnableEdit(hFontSize2,FALSE);
	XComboBox_AddString(hFontSize2,L"12");
	XComboBox_AddString(hFontSize2,L"14");
	XComboBox_AddString(hFontSize2,L"16");
	XComboBox_AddString(hFontSize2,L"18");
	XComboBox_AddString(hFontSize2,L"20");
	XComboBox_SetSelectItem(hFontSize2,0);
	left+=62;

	hBold2=XBtn_Create(left,24,30,20,L"B",hToolBarEle); //粗体
	left+=32;

	hItalic2=XBtn_Create(left,24,30,20,L"/",hToolBarEle); //斜体
	left+=32;
	hUnderline2=XBtn_Create(left,24,30,20,L"&U",hToolBarEle); //下划线

	///////////////////////////////////////////////////
	left=5;
	HELE hBtnImage=XBtn_Create(left,46,60,20,L"图片",hToolBarEle); //插入图片
	left+=64;
	HELE hBtnGif=XBtn_Create(left,46,60,20,L"GIF",hToolBarEle);//插入GIF

	XEle_RegisterEvent(hCombox_fontName,XE_COMBOBOX_SELECT,OnEventComboBoxSelect_default_fontName);
	XEle_RegisterEvent(hColor,XE_EDIT_CHANGE,OnEventEditChange_default_color);
	XEle_RegisterEvent(hFontSize,XE_COMBOBOX_SELECT,OnEventComboBoxSelect_default_fontSize);
	XEle_RegisterEvent(hBold,XE_BNCLICK,OnEventBtnClick_default_bold);
	XEle_RegisterEvent(hItalic,XE_BNCLICK,OnEventBtnClick_default_italic);
	XEle_RegisterEvent(hUnderline,XE_BNCLICK,OnEventBtnClick_default_underline);

	XEle_RegisterEvent(hCombox_fontName2,XE_COMBOBOX_SELECT,OnEventComboBoxSelect_select_fontName);
	XEle_RegisterEvent(hColor2,XE_EDIT_CHANGE,OnEventEditChange_select_color);
	XEle_RegisterEvent(hFontSize2,XE_COMBOBOX_SELECT,OnEventComboBoxSelect_select_fontSize);
	XEle_RegisterEvent(hBold2,XE_BNCLICK,OnEventBtnClick_select_bold);
	XEle_RegisterEvent(hItalic2,XE_BNCLICK,OnEventBtnClick_select_italic);
	XEle_RegisterEvent(hUnderline2,XE_BNCLICK,OnEventBtnClick_select_underline);

	XEle_RegisterEvent(hBtnImage,XE_BNCLICK,OnEventBtnClick_Image);
	XEle_RegisterEvent(hBtnGif,XE_BNCLICK,OnEventBtnClick_GIF);
	XEle_RegisterEvent(hBtnSend,XE_BNCLICK,OnEventBtnClick_Send);

	XWnd_ShowWindow(hWindow,SW_SHOW);
	XRunXCGUI();

	return 0;
}