#pragma once

//演示QQ2009
#define WINDOW_WIDTH 250 //窗口宽度
#define WINDOW_HEIGHT 600 //窗口高度 struct xc_image_res //图片资源
{
HIMAGE image_bk;
HIMAGE hImageLogo; HIMAGE close_leave;
HIMAGE close_stay;
HIMAGE close_down; HIMAGE max_leave;
HIMAGE max_stay;
HIMAGE max_down; HIMAGE min_leave;
HIMAGE min_stay;
HIMAGE min_down; HIMAGE weather; HIMAGE face_leave;
HIMAGE face_stay; HIMAGE userstate_leave;
HIMAGE userstate_stay;
HIMAGE userstate_down; HIMAGE button_leave;
HIMAGE button_stay;
HIMAGE button_down; HIMAGE searchedit; HIMAGE search;
HIMAGE icon1;
HIMAGE icon2;
HIMAGE icon3;
HIMAGE icon7;
HIMAGE icon8;
HIMAGE icon9;
HIMAGE icon10;
HIMAGE icon11;
HIMAGE icon15;
HIMAGE icon16; HIMAGE mainMenu_leave;
HIMAGE mainMenu_stay; HIMAGE hideleftpanel_leave;
HIMAGE hideleftpanel_stay; HIMAGE tabLeft_leave;
HIMAGE tabLeft_stay;
HIMAGE tabLeft_down; HIMAGE leftpane;
HIMAGE tab1;
HIMAGE tab2;
HIMAGE tab3; HIMAGE talkLabel_leave;
HIMAGE talkLabel_stay;
HIMAGE talkLabel_down; HIMAGE talktbico1;
HIMAGE talktbico2;
HIMAGE talktbico3; HIMAGE imp_shrink;
HIMAGE imp_expand;
HIMAGE imp_icon_1;
HIMAGE imp_icon_2;
HIMAGE imp_icon_3;
HIMAGE imp_icon_4;
HIMAGE imp_icon_5;
HIMAGE imp_icon_6; HIMAGE scroll_thumb_leave;
HIMAGE scroll_thumb_down; HIMAGE scroll_up_leave;
HIMAGE scroll_up_down; HIMAGE scroll_down_leave;
HIMAGE scroll_down_down; }; class DemoCPlus : public CXEventMsg
{
public:
DemoCPlus(void);
~DemoCPlus(void);
void CreateWnd(); void LoadImageRes(); void HandleButton_Close(HELE hClose);
void HandleButton_Max(HELE hMax);
void HandleButton_Min(HELE hMin);
void CreateWeatherButton(HWINDOW hWindow);
void HandleButton_Face(HELE hFace);
void HandleButton_UserState(HELE hUserState);
void HandleButton_UserSign(HELE hUserSign);
void HandleEdit_Search(HELE hSearch);
HELE CreateToolButton(HWINDOW hWindow,int x,int y,int cx,int cy);
HELE CreateToolSearchButton(HWINDOW hWindow);
void HandleCreateToolButton(HWINDOW hWindow);
void HandleCreateMainMenuButton(HWINDOW hWindow);
HELE HandleCreateLeftPaneButton(HELE hPic,int x,int y,int cx,int cy);
void HandleCreateLeftPane(HWINDOW hWindow);
void HandleCreateMainTab(HWINDOW hWindow); HMENUX CreatePlayerCombox(); bool OnWndNCEndDrawWindow(HWINDOW hWindow,HDC hdc);
bool OnWndSize(HWINDOW hWindow,UINT flags,SIZE *pSize);
bool OnWndDestroy(HWINDOW hWindow) ;
bool OnFriendsLButtonUp(HELE hEle, POINT *pPt) ;
bool OnFriendsRButtonUp(HELE hEle, POINT *pPt) ; bool EleRButtonDown(HELE hEle,UINT flags,POINT *pPt); private:
xc_image_res image_res;
HWINDOW hWindow;
HELE hWeather;
HELE hUserSign;
HELE hButtonSkin;
HELE hButtonMsg;
HELE hTree;
HELE hTabBar;
HELE hButtonHidePane;
HELE hButtonMainMenu;
HELE hButtonTool1;
HELE hButtonTool2;
HELE hButtonTool3;
HELE hButtonTool4;
HELE hButtonTool5;
HELE hButtonTool6;
HELE hLeftPane;
HELE hSearchEdit;
HELE hComboBox;
HMENUX hMenu;
int group1;
int group2;
};
#include "stdafx.h"
#include "DemoCPlus.h" DemoCPlus::DemoCPlus(void)
{
hMenu = NULL;
} DemoCPlus::~DemoCPlus(void)
{
} void DemoCPlus::LoadImageRes()
{
image_res.image_bk=XImage_LoadZipAdaptive(L"qqImage.zip",L"qqImage/back.bmp",NULL,6,174,123,140);
image_res.hImageLogo=XImage_LoadZip(L"qqImage.zip",L"qqImage/logo2009.png"); image_res.close_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/close_leave.png");
image_res.close_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/close_stay.png");
image_res.close_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/close_down.png"); image_res.max_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/max_leave.png");
image_res.max_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/max_stay.png");
image_res.max_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/max_down.png"); image_res.min_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/min_leave.png");
image_res.min_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/min_stay.png");
image_res.min_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/min_down.png"); image_res.weather=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/weather.png"); image_res.face_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/face_leave.png");
image_res.face_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/face_stay.png"); image_res.userstate_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/userstate_leave.png");
image_res.userstate_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/userstate_stay.png");
image_res.userstate_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/userstate_down.png"); image_res.button_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button_leave.png");
image_res.button_stay=XImage_LoadZipAdaptive(L"qqImage.zip",L"qqImage/button_stay.png",NULL,3,22,3,22);
image_res.button_down=XImage_LoadZipAdaptive(L"qqImage.zip",L"qqImage/button_down.png",NULL,3,22,3,22); image_res.searchedit=XImage_LoadZipAdaptive(L"qqImage.zip",L"qqImage/searchedit.png",NULL,9,13,6,19); image_res.search=XImage_LoadZip(L"qqImage.zip",L"qqImage/17.png"); image_res.icon1=XImage_LoadZip(L"qqImage.zip",L"qqImage/1.png");
image_res.icon2=XImage_LoadZip(L"qqImage.zip",L"qqImage/2.png");
image_res.icon3=XImage_LoadZip(L"qqImage.zip",L"qqImage/3.png");
image_res.icon7=XImage_LoadZip(L"qqImage.zip",L"qqImage/7.png");
image_res.icon8=XImage_LoadZip(L"qqImage.zip",L"qqImage/8.png");
image_res.icon9=XImage_LoadZip(L"qqImage.zip",L"qqImage/9.png");
image_res.icon10=XImage_LoadZip(L"qqImage.zip",L"qqImage/10.png");
image_res.icon11=XImage_LoadZip(L"qqImage.zip",L"qqImage/11.png");
image_res.icon15=XImage_LoadZip(L"qqImage.zip",L"qqImage/15.png");
image_res.icon16=XImage_LoadZip(L"qqImage.zip",L"qqImage/16.png"); image_res.mainMenu_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/mainMenu.png");
image_res.mainMenu_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/mainMenu_stay.png"); image_res.hideleftpanel_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/hideleftpanel_leave.png");
image_res.hideleftpanel_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/hideleftpanel_stay.png"); image_res.tabLeft_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/tabLeft_leave.png");
image_res.tabLeft_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/tabLeft_stay.png");
image_res.tabLeft_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/button/tabLeft_down.png"); image_res.leftpane=XImage_LoadZip(L"qqImage.zip",L"qqImage/leftpane.png",0,true);
image_res.tab1=XImage_LoadZip(L"qqImage.zip",L"qqImage/tab1.png");
image_res.tab2=XImage_LoadZip(L"qqImage.zip",L"qqImage/tab2.png");
image_res.tab3=XImage_LoadZip(L"qqImage.zip",L"qqImage/tab3.png"); image_res.talkLabel_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/talkLabel_leave.png",0,true);
image_res.talkLabel_stay=XImage_LoadZip(L"qqImage.zip",L"qqImage/talkLabel_stay.png",0,true);
image_res.talkLabel_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/talkLabel_check.png",0,true); image_res.talktbico1=XImage_LoadZip(L"qqImage.zip",L"qqImage/talktbico1.png");
image_res.talktbico2=XImage_LoadZip(L"qqImage.zip",L"qqImage/talktbico2.png");
image_res.talktbico3=XImage_LoadZip(L"qqImage.zip",L"qqImage/talktbico3.png"); image_res.imp_shrink=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_shrink.png");
image_res.imp_expand=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_expand.png");
image_res.imp_icon_1=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_1.png");
image_res.imp_icon_2=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_2.png");
image_res.imp_icon_3=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_3.png");
image_res.imp_icon_4=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_4.png");
image_res.imp_icon_5=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_5.png");
image_res.imp_icon_6=XImage_LoadZip(L"qqImage.zip",L"qqImage/avatar/imp_icon_6.png"); image_res.scroll_thumb_leave=XImage_LoadZipAdaptive(L"qqImage.zip",L"qqImage/scroll_thumb_leave.png",NULL,3,11,3,27);
image_res.scroll_thumb_down=XImage_LoadZipAdaptive(L"qqImage.zip",L"qqImage/scroll_thumb_down.png",NULL,3,11,3,27); image_res.scroll_up_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/scroll_up_leave.png");
image_res.scroll_up_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/scroll_up_Down.png"); image_res.scroll_down_leave=XImage_LoadZip(L"qqImage.zip",L"qqImage/scroll_down_leave.png");
image_res.scroll_down_down=XImage_LoadZip(L"qqImage.zip",L"qqImage/scroll_down_down.png");
} void DemoCPlus::HandleButton_Close( HELE hClose )
{
XEle_SetBkTransparent(hClose,true);
XEle_EnableFocus(hClose,false);
RECT rc={0,1,42,18};
XEle_SetRect(hClose,&rc);
XBtn_SetImageLeave(hClose,image_res.close_leave);
XBtn_SetImageStay(hClose,image_res.close_stay);
XBtn_SetImageDown(hClose,image_res.close_down);
} void DemoCPlus::HandleButton_Max( HELE hMax )
{
XEle_EnableFocus(hMax,false);
RECT rc={0,1,26,18};
XEle_SetRect(hMax,&rc);
XBtn_SetImageLeave(hMax,image_res.max_leave);
XBtn_SetImageStay(hMax,image_res.max_stay);
XBtn_SetImageDown(hMax,image_res.max_down);
} void DemoCPlus::HandleButton_Min( HELE hMin )
{
XEle_SetBkTransparent(hMin,true);
XEle_EnableFocus(hMin,false);
RECT rc={0,1,25,18};
XEle_SetRect(hMin,&rc);
XBtn_SetImageLeave(hMin,image_res.min_leave);
XBtn_SetImageStay(hMin,image_res.min_stay);
XBtn_SetImageDown(hMin,image_res.min_down);
} void DemoCPlus::CreateWeatherButton( HWINDOW hWindow )
{
hWeather=XBtn_Create(WINDOW_WIDTH-38-10,10,38,38,NULL,hWindow);
XBtn_EnableCursorHand(hWeather,true);
XEle_SetBkTransparent(hWeather,true);
XBtn_SetImageLeave(hWeather,image_res.weather);
XBtn_SetImageStay(hWeather,image_res.weather);
XBtn_SetImageDown(hWeather,image_res.weather);
} void DemoCPlus::HandleButton_Face( HELE hFace )
{
XEle_SetBkTransparent(hFace,true);
XEle_EnableFocus(hFace,false);
XBtn_SetImageLeave(hFace,image_res.face_leave);
XBtn_SetImageStay(hFace,image_res.face_stay);
XBtn_SetImageDown(hFace,image_res.face_stay);
} void DemoCPlus::HandleButton_UserState( HELE hUserState )
{
XEle_SetBkTransparent(hUserState,true);
XEle_EnableFocus(hUserState,false);
XBtn_SetImageLeave(hUserState,image_res.userstate_leave);
XBtn_SetImageStay(hUserState,image_res.userstate_stay);
XBtn_SetImageDown(hUserState,image_res.userstate_down);
} void DemoCPlus::HandleButton_UserSign( HELE hUserSign )
{
XEle_SetBkTransparent(hUserSign,true);
XEle_EnableFocus(hUserSign,false);
XBtn_SetTextAlign(hUserSign,DT_SINGLELINE | DT_VCENTER); XBtn_SetImageLeave(hUserSign,image_res.button_leave);
XBtn_SetImageStay(hUserSign,image_res.button_stay);
XBtn_SetImageDown(hUserSign,image_res.button_down);
} void DemoCPlus::HandleEdit_Search( HELE hSearch )
{
XSView_SetSpacing(hSearch,8,5,35,0);
XEle_EnableBorder(hSearch,false);
// XSView_SetImage(hSearch,image_res.searchedit);
XEdit_SetImageLeave(hSearch,image_res.searchedit);
XEdit_SetImageStay(hSearch,image_res.searchedit);
} HELE DemoCPlus::CreateToolButton( HWINDOW hWindow,int x,int y,int cx,int cy )
{
HELE hButton=XBtn_Create(x,y,cx,cy,NULL,hWindow);
XEle_SetBkTransparent(hButton,true);
XEle_EnableFocus(hButton,false); XBtn_SetImageLeave(hButton,image_res.button_leave);
XBtn_SetImageStay(hButton,image_res.button_stay);
XBtn_SetImageDown(hButton,image_res.button_down); return hButton;
} HELE DemoCPlus::CreateToolSearchButton( HWINDOW hWindow )
{
hButtonTool6=XBtn_Create(94,WINDOW_HEIGHT-50,60,22,NULL,hWindow);
XEle_SetBkTransparent(hButtonTool6,true);
XEle_EnableFocus(hButtonTool6,false); XBtn_SetImageLeave(hButtonTool6,image_res.button_leave);
XBtn_SetImageStay(hButtonTool6,image_res.button_stay);
XBtn_SetImageDown(hButtonTool6,image_res.button_down); XBtn_SetText(hButtonTool6,L"Search");
XBtn_SetIcon(hButtonTool6,image_res.search);
return hButtonTool6;
} void DemoCPlus::HandleCreateToolButton( HWINDOW hWindow )
{
HELE hButton=CreateToolButton(hWindow,10,52,22,20);
XBtn_SetIcon(hButton,image_res.icon1); hButton=CreateToolButton(hWindow,32,52,22,20);
XBtn_SetIcon(hButton,image_res.icon2); hButton=CreateToolButton(hWindow,54,52,22,20);
XBtn_SetIcon(hButton,image_res.icon3);
////////////////////
hButtonSkin=CreateToolButton(hWindow,WINDOW_WIDTH-10-22,52,22,20);
XBtn_SetIcon(hButtonSkin,image_res.icon8); hButtonMsg=CreateToolButton(hWindow,WINDOW_WIDTH-10-22-22,52,22,20);
XBtn_SetIcon(hButtonMsg,image_res.icon7); //////////////////////
hButtonTool1=CreateToolButton(hWindow,50,WINDOW_HEIGHT-73,22,22);
XBtn_SetIcon(hButtonTool1,image_res.icon9); hButtonTool2=CreateToolButton(hWindow,72,WINDOW_HEIGHT-73,22,22);
XBtn_SetIcon(hButtonTool2,image_res.icon10); hButtonTool3=CreateToolButton(hWindow,94,WINDOW_HEIGHT-73,22,22);
XBtn_SetIcon(hButtonTool3,image_res.icon11);
/////////////////////////
hButtonTool4=CreateToolButton(hWindow,50,WINDOW_HEIGHT-50,22,22);
XBtn_SetIcon(hButtonTool4,image_res.icon15); hButtonTool5=CreateToolButton(hWindow,72,WINDOW_HEIGHT-50,22,22);
XBtn_SetIcon(hButtonTool5,image_res.icon16); CreateToolSearchButton(hWindow);
} void DemoCPlus::HandleCreateMainMenuButton( HWINDOW hWindow )
{
hButtonMainMenu=XBtn_Create(3,WINDOW_HEIGHT-68,42,42,NULL,hWindow);
XEle_SetBkTransparent(hButtonMainMenu,true);
XEle_EnableFocus(hButtonMainMenu,false);
XBtn_SetImageLeave(hButtonMainMenu,image_res.mainMenu_leave);
XBtn_SetImageStay(hButtonMainMenu,image_res.mainMenu_stay);
XBtn_SetImageDown(hButtonMainMenu,image_res.mainMenu_stay); //隐藏左侧工具条面板按钮
hButtonHidePane=XBtn_Create(1,WINDOW_HEIGHT-76,15,15,NULL,hWindow);
XEle_SetBkTransparent(hButtonHidePane,true);
XEle_EnableFocus(hButtonHidePane,false);
XBtn_SetImageLeave(hButtonHidePane,image_res.hideleftpanel_leave);
XBtn_SetImageStay(hButtonHidePane,image_res.hideleftpanel_stay);
XBtn_SetImageDown(hButtonHidePane,image_res.hideleftpanel_stay);
} HELE DemoCPlus::HandleCreateLeftPaneButton( HELE hPic,int x,int y,int cx,int cy )
{
HELE hButton=XBtn_Create(x,y,cx,cy,NULL,hPic);
XEle_SetBkTransparent(hButton,true);
XEle_EnableFocus(hButton,false); XBtn_SetImageLeave(hButton,image_res.tabLeft_leave);
XBtn_SetImageStay(hButton,image_res.tabLeft_stay);
XBtn_SetImageDown(hButton,image_res.tabLeft_down);
XBtn_SetImageCheck(hButton,image_res.tabLeft_stay); return hButton;
} void DemoCPlus::HandleCreateLeftPane( HWINDOW hWindow )
{
hLeftPane=XPic_Create(0,99,33,WINDOW_HEIGHT-99-55-22,hWindow);
XPic_SetImage(hLeftPane,image_res.leftpane); HELE hButton=HandleCreateLeftPaneButton(hLeftPane,0,3,30,30);
XBtn_SetIcon(hButton,image_res.tab1);
hButton=HandleCreateLeftPaneButton(hLeftPane,0,33,30,30);
XBtn_SetIcon(hButton,image_res.tab2);
hButton=HandleCreateLeftPaneButton(hLeftPane,0,63,30,30);
XBtn_SetIcon(hButton,image_res.tab3);
} void DemoCPlus::HandleCreateMainTab( HWINDOW hWindow )
{
hTabBar=XTabBar_Create(33,99,WINDOW_WIDTH-6-33,30,hWindow);
XEle_SetBkColor(hTabBar,RGB(255,0,0));
XTabBar_AddLabel(hTabBar,L"");
XTabBar_AddLabel(hTabBar,L"");
XTabBar_AddLabel(hTabBar,L"");
XTabBar_EnableTile(hTabBar,true);
/////////////////////////////////////
HELE hButton=XTabBar_GetLabel(hTabBar,0);
XEle_EnableFocus(hButton,false);
XBtn_SetIcon(hButton,image_res.talktbico1); XBtn_SetImageLeave(hButton,image_res.talkLabel_leave);
XBtn_SetImageStay(hButton,image_res.talkLabel_stay);
XBtn_SetImageDown(hButton,image_res.talkLabel_down);
XBtn_SetImageCheck(hButton,image_res.talkLabel_down); ///////////////////////////////
hButton=XTabBar_GetLabel(hTabBar,1);
XEle_EnableFocus(hButton,false);
XBtn_SetIcon(hButton,image_res.talktbico2); XBtn_SetImageLeave(hButton,image_res.talkLabel_leave);
XBtn_SetImageStay(hButton,image_res.talkLabel_stay);
XBtn_SetImageDown(hButton,image_res.talkLabel_down);
XBtn_SetImageCheck(hButton,image_res.talkLabel_down);
/////////////////////////////////
hButton=XTabBar_GetLabel(hTabBar,2);
XEle_EnableFocus(hButton,false);
XBtn_SetIcon(hButton,image_res.talktbico3); XBtn_SetImageLeave(hButton,image_res.talkLabel_leave);
XBtn_SetImageStay(hButton,image_res.talkLabel_stay);
XBtn_SetImageDown(hButton,image_res.talkLabel_down);
XBtn_SetImageCheck(hButton,image_res.talkLabel_down); //好友列表
hTree=XTree_Create(33,129,WINDOW_WIDTH-6-33,WINDOW_HEIGHT-130-55-22,hWindow);
XTabBar_SetBindEle(hTabBar,0,hTree);
XSView_SetSpacing(hTree,0,0,0,0);
XTree_EnableLine(hTree,false);
XTree_EnableButton(hTree,false);
XTree_SetIndentation(hTree,0);
XTree_SetItemHeight(hTree,28);
XTree_SetSpacingLeft(hTree,10); HXCGUI hImageList1=XImageList_Create(11,6);
XImageList_AddImage(hImageList1,image_res.imp_shrink);
XImageList_AddImage(hImageList1,image_res.imp_expand); XImageList_AddImage(hImageList1,image_res.imp_icon_1);
XImageList_AddImage(hImageList1,image_res.imp_icon_2);
XImageList_AddImage(hImageList1,image_res.imp_icon_3);
XImageList_AddImage(hImageList1,image_res.imp_icon_4);
XImageList_AddImage(hImageList1,image_res.imp_icon_5);
XImageList_AddImage(hImageList1,image_res.imp_icon_6); XTree_SetImageList(hTree,hImageList1);
group1=XTree_InsertItem(hTree,L"我的好友[6/9]",XTREE_ROOT,1);
group2=XTree_InsertItem(hTree,L"同事[6/10]",XTREE_ROOT,1); XTree_InsertItem(hTree,L"梦飞",group1,3);
wchar_t name[100]={0};
for(int i=0;i<8;i++)
{
swprintf(name,L"炫彩好友-%d",i);
XTree_InsertItem(hTree,name,group1, i%6+2);
} for(int i=0;i<10;i++)
{
swprintf(name,L"炫彩好友-%d",i);
XTree_InsertItem(hTree,name,group2, i%6+2);
} HELE hScrollBar=XSView_GetVScrollBar(hTree);
XSBar_SetImageLeaveSlider(hScrollBar,image_res.scroll_thumb_leave);
XSBar_SetImageStaySlider(hScrollBar,image_res.scroll_thumb_leave);
XSBar_SetImageDownSlider(hScrollBar,image_res.scroll_thumb_down); XSBar_SetImageLeaveUp(hScrollBar,image_res.scroll_up_leave);
XSBar_SetImageStayUp(hScrollBar,image_res.scroll_up_leave);
XSBar_SetImageDownUp(hScrollBar,image_res.scroll_up_down); XSBar_SetImageLeaveDown(hScrollBar,image_res.scroll_down_leave);
XSBar_SetImageStayDown(hScrollBar,image_res.scroll_down_leave);
XSBar_SetImageDownDown(hScrollBar,image_res.scroll_down_down); XCGUI_RegEleMessage(hTree,XM_MOUSEDBCLICK,&DemoCPlus::OnFriendsLButtonUp); XCGUI_RegEleMessage(hTree,XM_RBUTTONDOWN,&DemoCPlus::EleRButtonDown);
} bool DemoCPlus::OnWndNCEndDrawWindow( HWINDOW hWindow,HDC hdc )
{
XDraw_HImage(hdc,image_res.hImageLogo,8,3); SetBkMode(hdc,TRANSPARENT);
TextOut(hdc,100,28,L"炫彩界面库",5); return false;
} bool DemoCPlus::OnWndSize( HWINDOW hWindow,UINT flags,SIZE *pSize )
{
RECT rc={pSize->cx-38-10,10,pSize->cx-10,38};
XEle_SetRect(hWeather,&rc); rc.left=60;
rc.top=25;
rc.right=pSize->cx-60;
rc.bottom=45;
XEle_SetRect(hUserSign,&rc); rc.left=pSize->cx-10-22;
rc.top=52;
rc.right=rc.left+22;
rc.bottom=rc.top+20;
XEle_SetRect(hButtonSkin,&rc); rc.left=pSize->cx-10-22-22;
rc.top=52;
rc.right=rc.left+22;
rc.bottom=rc.top+20;
XEle_SetRect(hButtonMsg,&rc); rc.left=33;
rc.top=99;
rc.right=pSize->cx-6;
rc.bottom=rc.top+30;
XEle_SetRect(hTabBar,&rc); rc.left=33;
rc.top=129;
rc.right=pSize->cx-6;
rc.bottom=pSize->cy-56-22;
XEle_SetRect(hTree,&rc); rc.left=1;
rc.top=pSize->cy-76;
rc.right=rc.left+15;
rc.bottom=rc.top+15;
XEle_SetRect(hButtonHidePane,&rc); rc.left=3;
rc.top=pSize->cy-68;
rc.right=rc.left+42;
rc.bottom=rc.top+42;
XEle_SetRect(hButtonMainMenu,&rc); rc.left=50;
rc.top=pSize->cy-73;
rc.right=rc.left+22;
rc.bottom=rc.top+22;
XEle_SetRect(hButtonTool1,&rc); rc.left=72;
rc.top=pSize->cy-73;
rc.right=rc.left+22;
rc.bottom=rc.top+22;
XEle_SetRect(hButtonTool2,&rc); rc.left=94;
rc.top=pSize->cy-73;
rc.right=rc.left+22;
rc.bottom=rc.top+22;
XEle_SetRect(hButtonTool3,&rc); rc.left=50;
rc.top=pSize->cy-50;
rc.right=rc.left+22;
rc.bottom=rc.top+22;
XEle_SetRect(hButtonTool4,&rc); rc.left=72;
rc.top=pSize->cy-50;
rc.right=rc.left+22;
rc.bottom=rc.top+22;
XEle_SetRect(hButtonTool5,&rc); rc.left=94;
rc.top=pSize->cy-50;
rc.right=rc.left+60;
rc.bottom=rc.top+22;
XEle_SetRect(hButtonTool6,&rc); rc.left=0;
rc.top=99;
rc.right=33;
rc.bottom=pSize->cy-55-22;
XEle_SetRect(hLeftPane,&rc); rc.left=1;
rc.top=73;
rc.right=pSize->cx-8;
rc.bottom=rc.top+26;
XEle_SetRect(hSearchEdit,&rc);
return false;
} bool DemoCPlus::OnWndDestroy( HWINDOW hWindow )
{
if(image_res.hImageLogo)
XImage_Destroy(image_res.hImageLogo);
return false;
} bool DemoCPlus::OnFriendsLButtonUp( HELE hEle, POINT *pPt )
{
int id=XTree_HitTest(hEle,pPt);
if(group1==id || group2==id)
{
if(XTree_IsExpand(hEle,id))
{
XTree_SetItemImage(hTree,id,0);
XTree_Expand(hEle,id,false);
}
else
{
XTree_SetItemImage(hTree,id,1);
XTree_Expand(hEle,id,true);
}
}
else
{
wchar_t* lpText = XTree_GetItemText(hTree,id);
MessageBox(0,lpText,0,0);
}
return false;
} void DemoCPlus::CreateWnd()
{
int style=XC_SY_DEFAULT&~XC_SY_DRAW_CAPTION_ICON;
style&=~XC_SY_DRAW_CAPTION_TITLE;
//创建窗口
hWindow = XWnd_CreateWindow(0,0,WINDOW_WIDTH,WINDOW_HEIGHT,L"炫彩界面库-窗口",NULL,style);
XWnd_EnableDragWindow(hWindow,true);
XWnd_SetBorderSize(hWindow,3,3,3,3);
XWnd_SetRoundSize(hWindow,9);
XWnd_SetCaptionHeight(hWindow,22);
XWnd_SetMinWidth(hWindow,250);
XWnd_SetMinHeight(hWindow,300); XWnd_EnableBorderStrokeInner(hWindow,false);
XWnd_EnableBorderStrokeOuter(hWindow,false); LoadImageRes(); //加载图片资源 //窗口背景图片
XWnd_SetImageNC(hWindow,image_res.image_bk); //关闭按钮
HELE hClose=XWnd_GetButtonClose(hWindow);
HandleButton_Close(hClose); //最大化按钮
HELE hMax=XWnd_GetButtonMax(hWindow);
HandleButton_Max(hMax); //最小化按钮
HELE hMin=XWnd_GetButtonMin(hWindow);
HandleButton_Min(hMin); //天气
CreateWeatherButton(hWindow); //头像
HELE hFace=XBtn_Create(10,0,48,48,NULL,hWindow);
XBtn_EnableCursorHand(hFace,true);
HandleButton_Face(hFace); //状态
HELE hUserState=XBtn_Create(60,0,32,22,NULL,hWindow);
HandleButton_UserState(hUserState); //签名
hUserSign=XBtn_Create(60,25,WINDOW_WIDTH-60-62,20,L"签名:www.xcgui.com",hWindow);
HandleButton_UserSign(hUserSign); //搜索框
hSearchEdit=XEdit_Create(1,73,WINDOW_WIDTH-8,26,hWindow);
HandleEdit_Search(hSearchEdit); //创建工具按钮
HandleCreateToolButton(hWindow); //主菜单按钮
HandleCreateMainMenuButton(hWindow); //创建左边工具面板
HandleCreateLeftPane(hWindow); //tab页
HandleCreateMainTab(hWindow); hMenu = CreatePlayerCombox(); XWnd_Adjust(hWindow); //XCGUI_RegWndNCMessage(hWindow,XWM_NCENDPAINT,&DemoCPlus::OnWndNCEndDrawWindow);
//XCGUI_RegWndMessage(hWindow,WM_SIZE,&DemoCPlus::OnWndSize);
//XCGUI_RegWndMessage(hWindow,WM_DESTROY,&DemoCPlus::OnWndDestroy); XWnd_ShowWindow(hWindow,SW_SHOW);
} bool DemoCPlus::EleRButtonDown( HELE hEle,UINT flags,POINT *pPt )
{
int id = XTree_HitTest(hEle,pPt); if(group1!= id && group2 != id)
{
POINT pt=*pPt;
RECT rc;
XListBox_GetItemRect(hEle,1,&rc); wchar_t* lpText = XTree_GetItemText(hTree,id);
//MessageBox(0,lpText,0,0); XEle_PointToNCWnd(hEle,&pt); HWINDOW hWindow = XEle_GetHWindow(hEle);
ClientToScreen(XWnd_GetHWnd(hWindow),&pt); XMenu_Popup(hMenu,XWnd_GetHWnd(hWindow),pt.x,pt.y);
}
return false;
} HMENUX DemoCPlus::CreatePlayerCombox()
{
HMENUX hMenu = XMenu_Create();
XMenu_AddItem(hMenu,201,L"添加");
XMenu_AddItem(hMenu,202,L"重命名");
XMenu_AddItem(hMenu,203,L"删除");
XMenu_SetAutoDestroy(hMenu, false);
return hMenu;
} int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
{
XInitXCGUI(); DemoCPlus lDemo;
lDemo.CreateWnd(); XRunXCGUI();
return 0;
}

  表示很好玩

这是效果图,决定也开源,之后会有继续开发。只是在原作者发布的Demo上做了简单修改!支持开源!支持炫彩库!

模仿QQ 之弹出菜单的更多相关文章

  1. 【转】 教你如何创建类似QQ的android弹出菜单

    原文地址:http://www.apkbus.com/android-18034-1-1.html 大家可能看到android的自带的系统菜单比较难看,如图: 2011-12-4 23:13 上传 下 ...

  2. css模仿微信弹出菜单

      css模仿微信弹出菜单 效果图: html: <div class="action-sheet-backdrop"> <div class="act ...

  3. 仿酷狗音乐播放器开发日志二十六 duilib在标题栏弹出菜单的方法

    转载请说明原出处,谢谢~~ 上篇日志说明了怎么让自定义控件响应右键消息.之后我给主窗体的标题栏增加右键响应,观察原酷狗后可以发现,在整个标题栏都是可以响应右键并弹出菜单的.应该的效果如下: 本以为像上 ...

  4. Android 使用PopupWindow实现弹出菜单

    在本文当中,我将会与大家分享一个封装了PopupWindow实现弹出菜单的类,并说明它的实现与使用. 因对界面的需求,android原生的弹出菜单已不能满足我们的需求,自定义菜单成了我们的唯一选择,在 ...

  5. Swing-JPopupMenu弹出菜单用法-入门

    弹出菜单是GUI程序中非常常见的一种控件.它通常由鼠标右击事件触发,比如在windows系统桌面上右击时,会弹出一个包含“刷新”.“属性”等菜单的弹出菜单.Swing中的弹出菜单是JPopupMenu ...

  6. Android开发技巧——使用PopupWindow实现弹出菜单

    在本文当中,我将会与大家分享一个封装了PopupWindow实现弹出菜单的类,并说明它的实现与使用. 因对界面的需求,android原生的弹出菜单已不能满足我们的需求,自定义菜单成了我们的唯一选择,在 ...

  7. dragView 屏幕拖拽并且弹出菜单的控件

    dragView 因项目新需求需要添加一个屏幕拖拽按钮可以弹出菜单的控件,因为不是我做的闲来无事写一个demo吧 可能存在一些小bug(毕竟就写了几个小时)兄弟姐妹们理解思路就行 具体的可以自己调试一 ...

  8. Android 高仿QQ滑动弹出菜单标记已读、未读消息

    在上一篇博客<Android 高仿微信(QQ)滑动弹出编辑.删除菜单效果,增加下拉刷新功能>里,已经带着大家学习如何使用SwipeMenuListView这一开源库实现滑动列表弹出菜单,接 ...

  9. 向上弹出菜单jQuery插件

    插件名:柯乐义英文名:Keleyijs文件名称:jquery.keleyi.js插件功能:该插件可以让你轻易地在页面上构建一个向上弹出的二级菜单. 示例查看:http://keleyi.com/kel ...

随机推荐

  1. 卡尔曼滤波算法--核心公式推导导论 - ZZ

    卡尔曼滤波算法--核心公式推导导论 10 个月前 写在最前面:这是我第一篇专栏文章,感谢知乎提供这么一个平台,让自己能和大家分享知识.本人会不定期的开始更新文章,文章的内容应该集中在汽车动力学控制,整 ...

  2. (转)【风宇冲】Unity3D教程宝典之Blur

    原创文章如需转载请注明:转载自风宇冲Unity3D教程学院                   BlurBlur模糊其实理解了以后非常简单.核心原理就是 1个点的颜色 并不用该点的颜色,而是用该点周围 ...

  3. HotSpot Java虚拟机中的“方法区”“持久代”“元数据区”的关系?

    Sun/Oracle JDK的HotSpot VM中,直到JDK7都有“持久代”(Permanent Generation,简称PermGen).也称为方法区.Oracle JDK8的HotSpot ...

  4. JavaScript 上下文环境和作用域,以及 call、apply 和 bind【转载+翻译+整理】

    --看到这篇文章,翻译国外的,虽说写得有点矫情,但总体来看,还是相当不错的- 本文内容 我在哪儿?你又是谁 ? this? 用 apply 和 call 掌控上下文环境 bind 之美 本文将说明上下 ...

  5. springboot微信sdk方式进行微信支付

    https://blog.csdn.net/xsg6509/article/details/80342744

  6. 【Linux】Ubuntu配置服务自启动 sysv-rc-conf

    在Ubuntu下,配置服务系统开机自启动,使用的不是chkconfig,而是sysv-rc-conf. 且看如下: 安装: sudo apt-get install sysv-rc-conf 帮助信息 ...

  7. SqlServer和Mysql插入记录前判断是否存在,存在则插入,不存在则修改。

    SqlServer中是这样: ) ,@title,@searchKeys,@serviceIntervalSecond,@sleepMillisecondPerSearch) ELSE UPDATE ...

  8. vs 15 key

    vs 15 Key :HM6NR-QXX7C-DFW2Y-8B82K-WTYJV vs 15 Key :2XNFG-KFHR8-QV3CP-3W6HT-683CH

  9. ACID、Data Replication、CAP与BASE

    ACID 在传数据库系统中,事务具有ACID 4个属性. (1) 原子性(Atomicity):事务是一个原子操作单元,其对数据的修改,要么全都执行,要么全都不执行. (2) 一致性(Consiste ...

  10. java面试第二天

    局部变量:不是声明在类体括号里面的变量 (1)必须要先赋值,后使用,否则通不过编译,局部变量没有默认初始化值 (2)作用范围:定义开始到定义它的代码块结束 (3)同一范围内,不允许2个局部变量命名冲突 ...