本文整理汇总了C++中wtl::CString::Right方法的典型用法代码示例。如果您正苦于以下问题:C++ CString::Right方法的具体用法?C++ CString::Right怎么用?C++ CString::Right使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wtl::CString
的用法示例。
在下文中一共展示了CString::Right方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnCreate
LRESULT CMainFrame::OnCreate(UINT /*uMsg*/, WPARAM /*wParam*/, LPARAM /*lParam*/, BOOL& /*bHandled*/)
{
#ifndef BTNS_SHOWTEXT
#define BTNS_SHOWTEXT 0x0040
#endif
// set title
WTL::CString strTitle;
strTitle.LoadString( IDS_APPLICATION );
SetWindowText(strTitle);
CreateSimpleStatusBar();
HWND hWndToolBar =
CreateSimpleToolBarCtrl(
m_hWnd, IDR_MAINFRAME, FALSE,
ATL_SIMPLE_TOOLBAR_STYLE | BTNS_SHOWTEXT | TBSTYLE_LIST | TBSTYLE_FLAT | TBSTYLE_FLAT);
TBBUTTON tbButton = { 0 };
TBBUTTONINFO tbButtonInfo = { 0 };
TBREPLACEBITMAP replaceBitmap = { 0 };
m_wndToolBar.Attach( hWndToolBar );
m_wndToolBar.SetExtendedStyle( TBSTYLE_EX_DRAWDDARROWS );
// Replace toolbar bitmap to display true color image
replaceBitmap.hInstNew = _Module.GetResourceInstance();
replaceBitmap.hInstOld = _Module.GetResourceInstance();
replaceBitmap.nIDOld = IDR_MAINFRAME;
replaceBitmap.nIDNew = IDB_MAINFRAME;
replaceBitmap.nButtons = 4;
m_wndToolBar.ReplaceBitmap( &replaceBitmap );
// Add strings to the toolbar
m_wndToolBar.SetButtonStructSize(sizeof(TBBUTTON));
for ( int i=0; i < m_wndToolBar.GetButtonCount(); i++ )
{
WTL::CString strCommand;
m_wndToolBar.GetButton( i, &tbButton );
tbButtonInfo.cbSize = sizeof(TBBUTTONINFO);
tbButtonInfo.dwMask = TBIF_STYLE;
m_wndToolBar.GetButtonInfo( tbButton.idCommand, &tbButtonInfo );
tbButtonInfo.dwMask = TBIF_TEXT | TBIF_STYLE;
strCommand.LoadString( tbButton.idCommand );
strCommand = strCommand.Right(
strCommand.GetLength() - strCommand.Find('\n') - 1
);
tbButtonInfo.pszText =
const_cast<LPTSTR>(static_cast<LPCTSTR>(strCommand));
tbButtonInfo.cchText = strCommand.GetLength();
tbButtonInfo.fsState |= BTNS_SHOWTEXT;
m_wndToolBar.AddString( tbButton.idCommand );
m_wndToolBar.SetButtonInfo( tbButton.idCommand, &tbButtonInfo );
}
// Modify mirror button as dropdown button
m_wndToolBar.GetButton(
m_wndToolBar.CommandToIndex(IDM_AGGR_MIRROR),
&tbButton
);
tbButtonInfo.cbSize = sizeof(TBBUTTONINFO);
tbButtonInfo.dwMask = TBIF_STYLE;
tbButtonInfo.fsStyle = tbButton.fsStyle | TBSTYLE_DROPDOWN;
m_wndToolBar.SetButtonInfo( IDM_AGGR_MIRROR, &tbButtonInfo );
CreateSimpleReBar(ATL_SIMPLE_REBAR_NOBORDER_STYLE);
AddSimpleReBarBand(m_wndToolBar);
UIAddToolBar(m_wndToolBar);
m_hWndClient = m_view.Create(
m_hWnd,
rcDefault,
NULL,
WS_CHILD | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN
| TVS_HASLINES | /* TVS_LINESATROOT | */ TVS_SHOWSELALWAYS,
WS_EX_CLIENTEDGE
);
UISetCheck(ID_VIEW_TOOLBAR, 1);
UISetCheck(ID_VIEW_STATUS_BAR, 1);
// TODO : It will be better if we display splash window while
// the treeview is initialized
m_bRefreshing = FALSE;
::InitializeCriticalSection(&m_csThreadRefreshStatus);
StartRefreshStatus();
m_hEventCallback =
::NdasRegisterEventCallback(pNdasEventProc,m_hWnd);
// register object for message filtering and idle updates
CMessageLoop* pLoop = _Module.GetMessageLoop();
ATLASSERT(pLoop != NULL);
pLoop->AddMessageFilter(this);
pLoop->AddIdleHandler(this);
// FIXME : We need to remember the window size
CRect rectResize;
GetClientRect( rectResize );
rectResize = CRect( rectResize.TopLeft(), CSize(500, 500) );
ClientToScreen( rectResize );
MoveWindow( rectResize );
CenterWindow();
//.........这里部分代码省略.........
示例2: SetPaneWidths
/*
void SetPaneWidths(int* arrWidths, int nPanes)
{
// find the size of the borders
int arrBorders[3];
m_status.GetBorders(arrBorders);
// calculate right edge of default pane (0)
arrWidths[0] += arrBorders[2];
for (int i = 1; i < nPanes; i++)
arrWidths[0] += arrWidths[i];
// calculate right edge of remaining panes (1 thru nPanes-1)
for (int j = 1; j < nPanes; j++)
arrWidths[j] += arrBorders[2] + arrWidths[j - 1];
// set the pane widths
m_status.SetParts(m_status.m_nPanes, arrWidths);
}
*/
LRESULT CMainFrame::OnCreate(LPCREATESTRUCT /*lParam*/)
{
//
// create command bar window
//
HWND hWndCmdBar = m_CmdBar.Create(
m_hWnd,
rcDefault,
NULL,
ATL_SIMPLE_CMDBAR_PANE_STYLE);
// attach menu
m_CmdBar.AttachMenu(GetMenu());
// load command bar images
m_CmdBar.SetImageSize(CSize(9,9));
// m_CmdBar.LoadImages(IDR_MAINFRAME);
// remove old menu
SetMenu(NULL);
// set title
WTL::CString strTitle;
strTitle.LoadString( IDS_APPLICATION );
SetWindowText(strTitle);
//
// setting up a tool bar
//
HWND hWndToolBar = CreateSimpleToolBarCtrl(
m_hWnd,
IDR_MAINFRAME,
FALSE,
ATL_SIMPLE_TOOLBAR_PANE_STYLE | TBSTYLE_LIST);
m_wndToolBar.Attach( hWndToolBar );
m_wndToolBar.SetExtendedStyle( TBSTYLE_EX_MIXEDBUTTONS | TBSTYLE_EX_DRAWDDARROWS );
//
// patria:
//
// Some bitmaps are distorted when used with TB_ADDBITMAP
// which is sent from CreateSimpleToolBarCtrl when the bitmap is not true color.
// This is the case with IO-DATA's tool bar image.
// As an workaround, we can directly create a image list directly
// and replace the image list of the tool bar, which corrects such misbehaviors.
//
{
CImageList imageList;
WORD wWidth = 32; // we are using 32 x 32 buttons
imageList.CreateFromImage(
IDR_MAINFRAME,
wWidth,
1,
CLR_DEFAULT,
IMAGE_BITMAP,
LR_CREATEDIBSECTION | LR_DEFAULTSIZE);
m_wndToolBar.SetImageList(imageList);
}
TBBUTTON tbButton = { 0 };
TBBUTTONINFO tbButtonInfo = { 0 };
TBREPLACEBITMAP replaceBitmap = { 0 };
// Add strings to the tool bar
m_wndToolBar.SetButtonStructSize(sizeof(TBBUTTON));
for ( int i=0; i < m_wndToolBar.GetButtonCount(); i++ )
{
WTL::CString strCommand;
m_wndToolBar.GetButton( i, &tbButton );
tbButtonInfo.cbSize = sizeof(TBBUTTONINFO);
tbButtonInfo.dwMask = TBIF_STYLE;
m_wndToolBar.GetButtonInfo( tbButton.idCommand, &tbButtonInfo );
tbButtonInfo.dwMask = TBIF_TEXT | TBIF_STYLE;
strCommand.LoadString( tbButton.idCommand );
strCommand = strCommand.Right(
strCommand.GetLength() - strCommand.Find('\n') - 1
);
tbButtonInfo.pszText =
const_cast<LPTSTR>(static_cast<LPCTSTR>(strCommand));
//.........这里部分代码省略.........