mirror of
https://github.com/Cc28256/CcRemote.git
synced 2025-06-08 13:29:50 +00:00
增加了工具栏,界面添加了部分图标
This commit is contained in:
parent
848bf9f560
commit
434c8dbacf
Binary file not shown.
Binary file not shown.
@ -194,6 +194,7 @@
|
||||
<ClInclude Include="PublicStruct.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="targetver.h" />
|
||||
<ClInclude Include="TrueColorToolBar.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CcRemote.cpp" />
|
||||
@ -204,6 +205,7 @@
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TrueColorToolBar.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="CcRemote.rc" />
|
||||
@ -213,6 +215,8 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="res\CcRemote.ico" />
|
||||
<Image Include="res\toolbar1.bmp" />
|
||||
<Image Include="res\ToolBar_Main.bmp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
|
@ -13,6 +13,9 @@
|
||||
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="重写控件">
|
||||
<UniqueIdentifier>{476b0088-5a08-4c04-af41-397f23c6743b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="CcRemote.h">
|
||||
@ -36,6 +39,9 @@
|
||||
<ClInclude Include="PublicStruct.h">
|
||||
<Filter>头文件</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TrueColorToolBar.h">
|
||||
<Filter>重写控件</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="CcRemote.cpp">
|
||||
@ -47,6 +53,9 @@
|
||||
<ClCompile Include="CcRemoteDlg.cpp">
|
||||
<Filter>源文件</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TrueColorToolBar.cpp">
|
||||
<Filter>重写控件</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="CcRemote.rc">
|
||||
@ -62,5 +71,11 @@
|
||||
<Image Include="res\CcRemote.ico">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
<Image Include="res\toolbar1.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
<Image Include="res\ToolBar_Main.bmp">
|
||||
<Filter>资源文件</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -82,6 +82,10 @@ BEGIN_MESSAGE_MAP(CCcRemoteDlg, CDialogEx)
|
||||
ON_COMMAND(ID_ONLINE_VIDEO, &CCcRemoteDlg::OnOnlineVideo)
|
||||
ON_COMMAND(ID_ONLINE_WINDOW, &CCcRemoteDlg::OnOnlineWindow)
|
||||
ON_COMMAND(ID_ONLINE_DELETE, &CCcRemoteDlg::OnOnlineDelete)
|
||||
ON_COMMAND(IDM_MAIN_SET, &CCcRemoteDlg::OnMainSet)
|
||||
ON_COMMAND(IDM_MAIN_CLOSE, &CCcRemoteDlg::OnMainClose)
|
||||
ON_COMMAND(IDM_MAIN_BUILD, &CCcRemoteDlg::OnMainBuild)
|
||||
ON_COMMAND(IDM_MAIN_ABOUT, &CCcRemoteDlg::OnMainAbout)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
|
||||
@ -117,9 +121,12 @@ BOOL CCcRemoteDlg::OnInitDialog()
|
||||
SetIcon(m_hIcon, FALSE); // 设置小图标
|
||||
|
||||
// TODO: 在此添加额外的初始化代码
|
||||
|
||||
|
||||
|
||||
|
||||
InitToolBar();//初始化工具栏按钮控件
|
||||
InitMyMenu();//初始化主界面菜单控件
|
||||
InitList();//初始化列表控件
|
||||
InitStatusBar();//初始化状态栏控件
|
||||
//---------改变窗口大小出发动态调整-------|
|
||||
CRect rect;
|
||||
GetWindowRect(&rect);
|
||||
@ -187,6 +194,10 @@ void CCcRemoteDlg::OnSize(UINT nType, int cx, int cy)
|
||||
{
|
||||
double dcx = cx; //对话框的总宽度
|
||||
CDialogEx::OnSize(nType, cx, cy);
|
||||
|
||||
if (SIZE_MINIMIZED == nType)//当窗口最小化避免大小为0造成崩溃直接返回
|
||||
return;
|
||||
|
||||
if (m_CList_Online.m_hWnd != NULL)
|
||||
{
|
||||
CRect rc;
|
||||
@ -212,7 +223,7 @@ void CCcRemoteDlg::OnSize(UINT nType, int cx, int cy)
|
||||
rc.left = 1; //列表的左坐标
|
||||
rc.top = cy - 156; //列表的上坐标
|
||||
rc.right = cx - 1; //列表的右坐标
|
||||
rc.bottom = cy - 6; //列表的下坐标
|
||||
rc.bottom = cy - 20; //列表的下坐标
|
||||
m_CList_Message.MoveWindow(rc);
|
||||
|
||||
for (int i = 0; i < COLUMN_MESSAGE_COUNT; i++) { //遍历每一个列
|
||||
@ -223,9 +234,39 @@ void CCcRemoteDlg::OnSize(UINT nType, int cx, int cy)
|
||||
m_CList_Message.SetColumnWidth(i, (lenth)); //设置当前的宽度
|
||||
}
|
||||
}
|
||||
|
||||
if (m_wndStatusBar.m_hWnd != NULL) { //当对话框大小改变时 状态条大小也随之改变
|
||||
CRect rc;
|
||||
rc.top = cy - 20;
|
||||
rc.left = 0;
|
||||
rc.right = cx;
|
||||
rc.bottom = cy;
|
||||
m_wndStatusBar.MoveWindow(rc);
|
||||
m_wndStatusBar.SetPaneInfo(0, m_wndStatusBar.GetItemID(0), SBPS_POPOUT, cx - 10);
|
||||
}
|
||||
|
||||
if (m_ToolBar.m_hWnd != NULL) //工具条
|
||||
{
|
||||
CRect rc;
|
||||
rc.top = rc.left = 0;
|
||||
rc.right = cx;
|
||||
rc.bottom = 80;
|
||||
m_ToolBar.MoveWindow(rc); //设置工具条大小位置
|
||||
}
|
||||
// TODO: 在此处添加消息处理程序代码
|
||||
}
|
||||
|
||||
|
||||
int CCcRemoteDlg::InitMyMenu()
|
||||
{
|
||||
HMENU hmenu;
|
||||
hmenu = LoadMenu(NULL, MAKEINTRESOURCE(IDR_MENU_MAIN)); //载入菜单资源
|
||||
::SetMenu(this->GetSafeHwnd(), hmenu); //为窗口设置菜单
|
||||
::DrawMenuBar(this->GetSafeHwnd()); //显示菜单
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int CCcRemoteDlg::InitList()
|
||||
{
|
||||
m_CList_Online.SetExtendedStyle(LVS_EX_FULLROWSELECT);
|
||||
@ -255,6 +296,7 @@ void CCcRemoteDlg::AddList(CString strIP, CString strAddr, CString strPCName, CS
|
||||
m_CList_Online.SetItemText(0, ONLINELIST_CPU, strCPU);
|
||||
m_CList_Online.SetItemText(0, ONLINELIST_VIDEO, strVideo);
|
||||
m_CList_Online.SetItemText(0, ONLINELIST_PING, strPing);
|
||||
ShowMessage(true, strIP + "主机上线");
|
||||
}
|
||||
|
||||
void CCcRemoteDlg::ShowMessage(bool bIsOK, CString strMsg)
|
||||
@ -272,16 +314,36 @@ void CCcRemoteDlg::ShowMessage(bool bIsOK, CString strMsg)
|
||||
m_CList_Message.InsertItem(0, strIsOK);
|
||||
m_CList_Message.SetItemText(0, 1, strTime);
|
||||
m_CList_Message.SetItemText(0, 2, strMsg);
|
||||
|
||||
|
||||
CString strStatusMsg;
|
||||
if (strMsg.Find("上线") > 0) //处理上线还是下线消息
|
||||
{
|
||||
m_OnlineCount++;
|
||||
}
|
||||
else if (strMsg.Find("下线") > 0)
|
||||
{
|
||||
m_OnlineCount--;
|
||||
}
|
||||
else if (strMsg.Find("断开") > 0)
|
||||
{
|
||||
m_OnlineCount--;
|
||||
}
|
||||
m_OnlineCount = (m_OnlineCount <= 0 ? 0 : m_OnlineCount); //防止iCount 有-1的情况
|
||||
strStatusMsg.Format("已连接: %d", m_OnlineCount);
|
||||
m_wndStatusBar.SetPaneText(0, strStatusMsg); //在状态条上显示文字
|
||||
|
||||
}
|
||||
|
||||
|
||||
void CCcRemoteDlg::Test()
|
||||
{
|
||||
ShowMessage(true, "软件初始化成功...");
|
||||
AddList("192.168.0.1", "本机局域网", "CHANG", "Windows7", "2.2GHZ", "有", "123232");
|
||||
AddList("192.168.10.1", "本机局域网", "WANG", "Windows10", "2.2GHZ", "无", "111111");
|
||||
AddList("192.168.18.25", "本机局域网", "LIU", "Windows8", "2.2GHZ", "有", "654321");
|
||||
AddList("192.168.97.162", "本机局域网", "SHANG", "WindowsXP", "2.2GHZ", "无", "123456");
|
||||
ShowMessage(true, "软件初始化成功...");
|
||||
|
||||
}
|
||||
|
||||
void CCcRemoteDlg::OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult)
|
||||
@ -373,3 +435,98 @@ void CCcRemoteDlg::OnOnlineDelete()
|
||||
strIP += " 由主机主动断开连接";
|
||||
ShowMessage(true, strIP);//显示日志
|
||||
}
|
||||
|
||||
|
||||
void CCcRemoteDlg::OnMainSet()
|
||||
{
|
||||
// TODO: 在此添加命令处理程序代码
|
||||
}
|
||||
|
||||
|
||||
void CCcRemoteDlg::OnMainClose()
|
||||
{
|
||||
// TODO: 在此添加命令处理程序代码
|
||||
PostMessage(WM_CLOSE);
|
||||
}
|
||||
|
||||
|
||||
void CCcRemoteDlg::OnMainBuild()
|
||||
{
|
||||
// TODO: 在此添加命令处理程序代码
|
||||
}
|
||||
|
||||
|
||||
void CCcRemoteDlg::OnMainAbout()
|
||||
{
|
||||
// TODO: 在此添加命令处理程序代码
|
||||
CAboutDlg dlgAbout;
|
||||
dlgAbout.DoModal();
|
||||
}
|
||||
|
||||
|
||||
//状态栏数组
|
||||
static UINT indicators[] =
|
||||
{
|
||||
IDR_STATUSBAR_STRING
|
||||
};
|
||||
|
||||
|
||||
//初始化状态栏
|
||||
void CCcRemoteDlg::InitStatusBar()
|
||||
{
|
||||
if (!m_wndStatusBar.Create(this) ||
|
||||
!m_wndStatusBar.SetIndicators(indicators,
|
||||
sizeof(indicators) / sizeof(UINT))) //创建状态条并设置字符资源的ID
|
||||
{
|
||||
TRACE0("Failed to create status bar\n");
|
||||
return; // fail to create
|
||||
}
|
||||
CRect rc;
|
||||
::GetWindowRect(m_wndStatusBar.m_hWnd, rc);
|
||||
m_wndStatusBar.MoveWindow(rc); //移动状态条到指定位置
|
||||
}
|
||||
|
||||
|
||||
//初始化工具条按钮控件
|
||||
void CCcRemoteDlg::InitToolBar()
|
||||
{
|
||||
//创建工具条
|
||||
if (!m_ToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
|
||||
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
|
||||
!m_ToolBar.LoadToolBar(IDR_TOOLBAR_MAIN))//载入创建好的控件资源
|
||||
{
|
||||
TRACE0("Failed to create toolbar\n");
|
||||
return; // fail to create
|
||||
}
|
||||
m_ToolBar.ModifyStyle(0, TBSTYLE_FLAT); //Fix for WinXP
|
||||
|
||||
//加载位图资源
|
||||
m_ToolBar.LoadTrueColorToolBar
|
||||
(
|
||||
48, //加载真彩工具条
|
||||
IDB_BITMAP_MAIN,
|
||||
IDB_BITMAP_MAIN,
|
||||
IDB_BITMAP_MAIN
|
||||
);
|
||||
RECT rt, rtMain;
|
||||
GetWindowRect(&rtMain);//获取窗口大小
|
||||
rt.left = 0;
|
||||
rt.top = 0;
|
||||
rt.bottom = 80;
|
||||
rt.right = rtMain.right - rtMain.left + 10;
|
||||
m_ToolBar.MoveWindow(&rt, TRUE);
|
||||
|
||||
m_ToolBar.SetButtonText(0, "终端管理");
|
||||
m_ToolBar.SetButtonText(1, "进程管理");
|
||||
m_ToolBar.SetButtonText(2, "窗口管理");
|
||||
m_ToolBar.SetButtonText(3, "桌面管理");
|
||||
m_ToolBar.SetButtonText(4, "文件管理");
|
||||
m_ToolBar.SetButtonText(5, "语音管理");
|
||||
m_ToolBar.SetButtonText(6, "视频管理");
|
||||
m_ToolBar.SetButtonText(7, "服务管理");
|
||||
m_ToolBar.SetButtonText(8, "注册表管理");
|
||||
m_ToolBar.SetButtonText(10, "参数设置");
|
||||
m_ToolBar.SetButtonText(11, "生成服务端");
|
||||
m_ToolBar.SetButtonText(12, "帮助");
|
||||
RepositionBars(AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0);
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
|
||||
// CcRemoteDlg.h: 头文件
|
||||
//
|
||||
#include "TrueColorToolBar.h"
|
||||
#include "PublicStruct.h"
|
||||
#pragma once
|
||||
|
||||
@ -32,13 +33,17 @@ protected:
|
||||
afx_msg HCURSOR OnQueryDragIcon();
|
||||
DECLARE_MESSAGE_MAP()
|
||||
public:
|
||||
CStatusBar m_wndStatusBar;//状态控件
|
||||
CListCtrl m_CList_Online;//在线列表变量
|
||||
CListCtrl m_CList_Message;//消息列表变量
|
||||
CTrueColorToolBar m_ToolBar;//工具条按钮控件变量
|
||||
afx_msg void OnSize(UINT nType, int cx, int cy);
|
||||
|
||||
|
||||
private:
|
||||
//--------------主界面列表的显示变量及常量----------------
|
||||
//--------------变量及常量----------------
|
||||
int m_OnlineCount;
|
||||
|
||||
#define COLUMN_ONLINE_COUNT 7 //在线列表的个数
|
||||
#define COLUMN_MESSAGE_COUNT 3 //消息列表的个数
|
||||
int m_Column_Online_Width = 0; //在线列表宽度和
|
||||
@ -62,12 +67,19 @@ private:
|
||||
{"信息内容", 660 }
|
||||
};
|
||||
|
||||
|
||||
|
||||
//-----------------------函数-----------------------
|
||||
int InitList();//初始化list控件信息
|
||||
int InitMyMenu();//初始化主页面上方菜单
|
||||
void InitStatusBar();//初始化状态控件
|
||||
void InitToolBar();//初始化工具条按钮控件
|
||||
void AddList(CString strIP, CString strAddr, CString strPCName, CString strOS, CString strCPU, CString strVideo, CString strPing);
|
||||
void ShowMessage(bool bIsOK, CString strMsg);
|
||||
void Test();
|
||||
|
||||
|
||||
|
||||
public:
|
||||
afx_msg void OnNMRClickOnline(NMHDR *pNMHDR, LRESULT *pResult);
|
||||
afx_msg void OnOnlineAudio();
|
||||
@ -80,4 +92,8 @@ public:
|
||||
afx_msg void OnOnlineVideo();
|
||||
afx_msg void OnOnlineWindow();
|
||||
afx_msg void OnOnlineDelete();
|
||||
afx_msg void OnMainSet();
|
||||
afx_msg void OnMainClose();
|
||||
afx_msg void OnMainBuild();
|
||||
afx_msg void OnMainAbout();
|
||||
};
|
||||
|
@ -2,6 +2,7 @@ g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.pch
|
||||
g:\ccremote\ccremote\ccremote\ccremote\debug\vc141.pdb
|
||||
g:\ccremote\ccremote\ccremote\ccremote\debug\vc141.idb
|
||||
g:\ccremote\ccremote\ccremote\ccremote\debug\pch.obj
|
||||
g:\ccremote\ccremote\ccremote\ccremote\debug\truecolortoolbar.obj
|
||||
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremotedlg.obj
|
||||
g:\ccremote\ccremote\ccremote\ccremote\debug\ccremote.obj
|
||||
g:\ccremote\ccremote\ccremote\debug\ccremote.ilk
|
||||
|
@ -1,7 +1,8 @@
|
||||
pch.cpp
|
||||
CcRemote.cpp
|
||||
CcRemoteDlg.cpp
|
||||
g:\ccremote\ccremote\ccremote\ccremote\ccremotedlg.cpp(205): warning C4244: “初始化”: 从“double”转换到“int”,可能丢失数据
|
||||
g:\ccremote\ccremote\ccremote\ccremote\ccremotedlg.cpp(222): warning C4244: “初始化”: 从“double”转换到“int”,可能丢失数据
|
||||
g:\ccremote\ccremote\ccremote\ccremote\ccremotedlg.cpp(216): warning C4244: “初始化”: 从“double”转换到“int”,可能丢失数据
|
||||
g:\ccremote\ccremote\ccremote\ccremote\ccremotedlg.cpp(233): warning C4244: “初始化”: 从“double”转换到“int”,可能丢失数据
|
||||
TrueColorToolBar.cpp
|
||||
正在生成代码...
|
||||
CcRemote.vcxproj -> G:\CcRemote\CcRemote\CcRemote\Debug\CcRemote.exe
|
||||
|
Binary file not shown.
139
CcRemote/CcRemote/TrueColorToolBar.cpp
Normal file
139
CcRemote/CcRemote/TrueColorToolBar.cpp
Normal file
@ -0,0 +1,139 @@
|
||||
/***=========================================================================
|
||||
==== ====
|
||||
==== D C U t i l i t y ====
|
||||
==== ====
|
||||
=============================================================================
|
||||
==== ====
|
||||
==== File name : TrueColorToolBar.cpp ====
|
||||
==== Project name : Tester ====
|
||||
==== Project number : --- ====
|
||||
==== Creation date : 13/1/2003 ====
|
||||
==== Author(s) : Dany Cantin ====
|
||||
==== ====
|
||||
==== Copyright ?DCUtility 2003 ====
|
||||
==== ====
|
||||
=============================================================================
|
||||
===========================================================================*/
|
||||
#include "pch.h"
|
||||
#include "TrueColorToolBar.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTrueColorToolBar
|
||||
|
||||
CTrueColorToolBar::CTrueColorToolBar()
|
||||
{
|
||||
m_bDropDown = FALSE;
|
||||
}
|
||||
|
||||
CTrueColorToolBar::~CTrueColorToolBar()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
BEGIN_MESSAGE_MAP(CTrueColorToolBar, CToolBar)
|
||||
//{{AFX_MSG_MAP(CTrueColorToolBar)
|
||||
ON_NOTIFY_REFLECT(TBN_DROPDOWN, OnToolbarDropDown)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTrueColorToolBar message handlers
|
||||
BOOL CTrueColorToolBar::LoadTrueColorToolBar(int nBtnWidth,
|
||||
UINT uToolBar,
|
||||
UINT uToolBarHot,
|
||||
UINT uToolBarDisabled)
|
||||
{
|
||||
if (!SetTrueColorToolBar(TB_SETIMAGELIST, uToolBar, nBtnWidth))
|
||||
return FALSE;
|
||||
|
||||
if (uToolBarHot) {
|
||||
if (!SetTrueColorToolBar(TB_SETHOTIMAGELIST, uToolBarHot, nBtnWidth))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (uToolBarDisabled) {
|
||||
if (!SetTrueColorToolBar(TB_SETDISABLEDIMAGELIST, uToolBarDisabled, nBtnWidth))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
BOOL CTrueColorToolBar::SetTrueColorToolBar(UINT uToolBarType,
|
||||
UINT uToolBar,
|
||||
int nBtnWidth)
|
||||
{
|
||||
CImageList cImageList;
|
||||
CBitmap cBitmap;
|
||||
BITMAP bmBitmap;
|
||||
|
||||
if (!cBitmap.Attach(LoadImage(AfxGetResourceHandle(), MAKEINTRESOURCE(uToolBar),
|
||||
IMAGE_BITMAP, 0, 0,
|
||||
LR_DEFAULTSIZE|LR_CREATEDIBSECTION)) ||
|
||||
!cBitmap.GetBitmap(&bmBitmap))
|
||||
return FALSE;
|
||||
|
||||
CSize cSize(bmBitmap.bmWidth, bmBitmap.bmHeight);
|
||||
int nNbBtn = cSize.cx/nBtnWidth;
|
||||
RGBTRIPLE* rgb = (RGBTRIPLE*)(bmBitmap.bmBits);
|
||||
COLORREF rgbMask = RGB(rgb[0].rgbtRed, rgb[0].rgbtGreen, rgb[0].rgbtBlue);
|
||||
|
||||
if (!cImageList.Create(nBtnWidth, cSize.cy, ILC_COLOR24|ILC_MASK, nNbBtn, 0))
|
||||
return FALSE;
|
||||
|
||||
if (cImageList.Add(&cBitmap, rgbMask) == -1)
|
||||
return FALSE;
|
||||
|
||||
SendMessage(uToolBarType, 0, (LPARAM)cImageList.m_hImageList);
|
||||
cImageList.Detach();
|
||||
cBitmap.Detach();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CTrueColorToolBar::AddDropDownButton(CWnd* pParent, UINT uButtonID, UINT uMenuID)
|
||||
{
|
||||
if (!m_bDropDown) {
|
||||
GetToolBarCtrl().SendMessage(TB_SETEXTENDEDSTYLE, 0, (LPARAM)TBSTYLE_EX_DRAWDDARROWS);
|
||||
m_bDropDown = TRUE;
|
||||
}
|
||||
|
||||
SetButtonStyle(CommandToIndex(uButtonID), TBSTYLE_DROPDOWN);
|
||||
|
||||
stDropDownInfo DropDownInfo;
|
||||
DropDownInfo.pParent = pParent;
|
||||
DropDownInfo.uButtonID = uButtonID;
|
||||
DropDownInfo.uMenuID = uMenuID;
|
||||
m_lstDropDownButton.Add(DropDownInfo);
|
||||
}
|
||||
|
||||
void CTrueColorToolBar::OnToolbarDropDown(NMHDR * pnmtb, LRESULT *plr)
|
||||
{
|
||||
NMTOOLBARA * pnmtbb=(NMTOOLBARA *)pnmtb;
|
||||
for (int i = 0; i < m_lstDropDownButton.GetSize(); i++) {
|
||||
|
||||
stDropDownInfo DropDownInfo = m_lstDropDownButton.GetAt(i);
|
||||
|
||||
if (DropDownInfo.uButtonID == UINT(pnmtbb->iItem)) {
|
||||
|
||||
CMenu menu;
|
||||
menu.LoadMenu(DropDownInfo.uMenuID);
|
||||
CMenu* pPopup = menu.GetSubMenu(0);
|
||||
|
||||
CRect rc;
|
||||
SendMessage(TB_GETRECT, (WPARAM)pnmtbb->iItem, (LPARAM)&rc);
|
||||
ClientToScreen(&rc);
|
||||
|
||||
pPopup->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_VERTICAL,
|
||||
rc.left, rc.bottom, DropDownInfo.pParent, &rc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
88
CcRemote/CcRemote/TrueColorToolBar.h
Normal file
88
CcRemote/CcRemote/TrueColorToolBar.h
Normal file
@ -0,0 +1,88 @@
|
||||
/***=========================================================================
|
||||
==== ====
|
||||
==== D C U t i l i t y ====
|
||||
==== ====
|
||||
=============================================================================
|
||||
==== ====
|
||||
==== File name : TrueColorToolBar.h ====
|
||||
==== Project name : Tester ====
|
||||
==== Project number : --- ====
|
||||
==== Creation date : 13/1/2003 ====
|
||||
==== Author(s) : Dany Cantin ====
|
||||
==== ====
|
||||
==== Copyright ?DCUtility 2003 ====
|
||||
==== ====
|
||||
=============================================================================
|
||||
===========================================================================*/
|
||||
|
||||
|
||||
#ifndef TRUECOLORTOOLBAR_H_
|
||||
#define TRUECOLORTOOLBAR_H_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
|
||||
#include <afxtempl.h>
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CTrueColorToolBar
|
||||
|
||||
class CTrueColorToolBar : public CToolBar
|
||||
{
|
||||
// Construction
|
||||
public:
|
||||
CTrueColorToolBar();
|
||||
|
||||
// Attributes
|
||||
private:
|
||||
BOOL m_bDropDown;
|
||||
|
||||
struct stDropDownInfo {
|
||||
public:
|
||||
UINT uButtonID;
|
||||
UINT uMenuID;
|
||||
CWnd* pParent;
|
||||
};
|
||||
|
||||
CArray <stDropDownInfo, stDropDownInfo&> m_lstDropDownButton;
|
||||
|
||||
// Operations
|
||||
public:
|
||||
BOOL LoadTrueColorToolBar(int nBtnWidth,
|
||||
UINT uToolBar,
|
||||
UINT uToolBarHot = 0,
|
||||
UINT uToolBarDisabled = 0);
|
||||
|
||||
void AddDropDownButton(CWnd* pParent, UINT uButtonID, UINT uMenuID);
|
||||
|
||||
private:
|
||||
BOOL SetTrueColorToolBar(UINT uToolBarType,
|
||||
UINT uToolBar,
|
||||
int nBtnWidth);
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CTrueColorToolBar)
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CTrueColorToolBar();
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CTrueColorToolBar)
|
||||
afx_msg void OnToolbarDropDown(NMHDR * pnmh, LRESULT* plRes);
|
||||
//}}AFX_MSG
|
||||
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // TRUECOLORTOOLBAR_H_
|
BIN
CcRemote/CcRemote/res/123.bmp
Normal file
BIN
CcRemote/CcRemote/res/123.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 108 KiB |
BIN
CcRemote/CcRemote/res/ToolBar_Main.bmp
Normal file
BIN
CcRemote/CcRemote/res/ToolBar_Main.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 81 KiB |
BIN
CcRemote/CcRemote/res/toolbar1.bmp
Normal file
BIN
CcRemote/CcRemote/res/toolbar1.bmp
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@ -6,9 +6,14 @@
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define IDS_ABOUTBOX 101
|
||||
#define IDD_CCREMOTE_DIALOG 102
|
||||
#define IDR_STATUSBAR_STRING 102
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDR_MENU1 130
|
||||
#define IDR_MENU_ONLINE 130
|
||||
#define IDR_MENU2 133
|
||||
#define IDR_MENU_MAIN 133
|
||||
#define IDR_TOOLBAR_MAIN 134
|
||||
#define IDB_BITMAP_MAIN 136
|
||||
#define IDC_ONLINE 1000
|
||||
#define IDC_LIST2 1001
|
||||
#define IDC_MESSAGE 1001
|
||||
@ -32,13 +37,33 @@
|
||||
#define ID_ONLINE_CMD 32788
|
||||
#define ID_ONLINE_32789 32789
|
||||
#define ID_ONLINE_DELETE 32790
|
||||
#define ID_32791 32791
|
||||
#define ID_32792 32792
|
||||
#define ID_32793 32793
|
||||
#define ID_32794 32794
|
||||
#define IDM_MAIN_ABOUT 32795
|
||||
#define IDM_MAIN_SET 32796
|
||||
#define IDM_MAIN_BUILD 32797
|
||||
#define IDM_MAIN_CLOSE 32798
|
||||
#define ID_BUTTON32799 32799
|
||||
#define ID_BUTTON32800 32800
|
||||
#define ID_BUTTON32801 32801
|
||||
#define ID_BUTTON32802 32802
|
||||
#define ID_BUTTON32803 32803
|
||||
#define ID_BUTTON32804 32804
|
||||
#define ID_BUTTON32805 32805
|
||||
#define ID_BUTTON32806 32806
|
||||
#define ID_BUTTON32807 32807
|
||||
#define ID_BUTTON32808 32808
|
||||
#define ID_BUTTON32810 32810
|
||||
#define ID_BUTTON32811 32811
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 133
|
||||
#define _APS_NEXT_COMMAND_VALUE 32791
|
||||
#define _APS_NEXT_RESOURCE_VALUE 137
|
||||
#define _APS_NEXT_COMMAND_VALUE 32812
|
||||
#define _APS_NEXT_CONTROL_VALUE 1002
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user