当前位置: 首页>>代码示例>>C++>>正文


C++ Strng::Length方法代码示例

本文整理汇总了C++中Strng::Length方法的典型用法代码示例。如果您正苦于以下问题:C++ Strng::Length方法的具体用法?C++ Strng::Length怎么用?C++ Strng::Length使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Strng的用法示例。


在下文中一共展示了Strng::Length方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: GetButtonInfo

BOOL CDynToolBar::GetButtonInfo(WPARAM wParam, LPARAM  lParam, LRESULT* pLResult)
  {
  // This notification message has to be handled correctly if 
  // all operations in the custom dialogbox has to function correctly
  // We have to supply information for the button specified by pTBN->tbButton
  //
  // This notification is sent in the following cases
  // 
  // After TBN_BEGINADJUST the control sends these notifications until
  // * pLResult is TRUE. We have to supply valid values when this value is
  // set to TRUE. Here the control is collecting information for all
  // the buttons that have to be displayed in the dialog box
  // 
  // The control sends this notification to get information about
  // a button if the user is trying to add it to the toolbar or 
  // rearranging the buttons on the toolbar from within the dialog
  TBNOTIFY* pTBN = (TBNOTIFY*)lParam;
  UINT StrID;
  if (bButtonsOnce)
    {
    if (pTBN->iItem >= (int)(pTheBitmap->iLen))
      *pLResult = FALSE;
    else
      {
      StrID = pTheBitmap->BtnIDs[pTBN->iItem];
      pTBN->tbButton = pTheBitmap->Btns[pTBN->iItem];
      *pLResult = TRUE;
      }
    }
  else
    {
    if (pTBN->iItem >= (int)iLen)
      *pLResult = FALSE;
    else
      {
      StrID = BtnIDs[pTBN->iItem];
      pTBN->tbButton = Btns[pTBN->iItem];
      *pLResult = TRUE;
      }
    }
  if (*pLResult == TRUE)
    {
    CString Txt;
    Txt.LoadString(StrID);
    Strng s;
    if (Txt.Find('\n')>=0)
      {
      s = (const char*)Txt.Mid(Txt.Find('\n')+1, 256);
      Txt = Txt.Left(Txt.Find('\n'));
      if (s.Length()>0)
        s += " : ";
      }
    s += (const char*)Txt;
    if (s.Length()>0)
      {
      _tcsncpy(pTBN->pszText, s(), pTBN->cchText - 1);
      pTBN->pszText[pTBN->cchText - 1] = '\0';
      }
    else
      pTBN->pszText[0] = '\0';
    }
  return TRUE;
  }
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:63,代码来源:Toolbars.cpp

示例2: LoadState

void CDynToolBar::LoadState(char* pFilename)
  {
  CProfINIFile PF(pFilename);
  CMDIFrameWnd* pM = pTBMngr->pMainFrame;
  Strng Section;
  Section.Set("ToolBar_%d", iWindowID);
  Strng NewTitle = PF.RdStr(Section(), "Title", (char*)(const char*)sTitle);
  if (NewTitle.Length()!=sTitle.GetLength() || strcmp(NewTitle(), (const char*)sTitle)!=0)
    {
    SetWindowText(NewTitle());
    sTitle = NewTitle();
    }
  DWORD BarStyle = GetBarStyle();
  DWORD Style = GetStyle();
  BarStyle = PF.RdLong(Section(), "BarStyle", BarStyle);
  BarStyle &= CBRS_ALL; //CNM Prevent an ASSERT
  SetBarStyle(BarStyle);

  if (bCanConfigure)
    {
    CToolBarCtrl& bc = GetToolBarCtrl();
    int Cnt = bc.GetButtonCount();
    Cnt = PF.RdInt(Section(), "ButtonIDCount", Cnt);
    BOOL Chngd = (Cnt!=bc.GetButtonCount());
    UINT* NewIDs = new UINT[Cnt];
    Strng Item;
    for (int i=0; i<Cnt; i++)
      {
      Item.Set("ID_%d", i);
      int Cmd = (i<(int)iLen ? BtnIDs[i] : ID_SEPARATOR);
      Cmd = PF.RdInt(Section(), Item(), Cmd);
      NewIDs[i] = (UINT)Cmd;
      Chngd = (Chngd || (NewIDs[i]!=BtnIDs[i]));
      }
    if (Chngd)
      ChangeButtons(NewIDs, Cnt);
    delete []NewIDs;
    }

  flag Visible = ((Style & WS_VISIBLE) != 0);
  Visible = PF.RdInt(Section(), "Visible", Visible);
  pM->ShowControlBar(this, Visible, FALSE);
  pM->RecalcLayout(); //get MFC to adjust the dimensions of all docked ToolBars so that GetWindowRect will be accurate
  CRect Rect;
  CWnd* pWnd = GetParent();
  if (BarStyle & CBRS_FLOATING)
    {
    if (pWnd && pWnd->GetParent())
      {
      if (PrjFileVerNo()>=25)
        {
        CRect MRect;
        AfxGetMainWnd()->GetWindowRect(MRect);
        Rect.OffsetRect(-MRect.left, -MRect.top);
        int L=PF.RdInt(Section(), "Left", Rect.left);
        int T=PF.RdInt(Section(), "Top", Rect.top);
        Rect.OffsetRect(L-Rect.left, T-Rect.top);
        Rect.OffsetRect(+MRect.left, +MRect.top);
        }
      else
        {
        pWnd->GetParent()->GetWindowRect(&Rect);
        Location.x = PF.RdInt(Section(), "Left", Rect.left);
        Location.y = PF.RdInt(Section(), "Top", Rect.top);
        }
      pM->FloatControlBar(this, Location);
      }
    }
  else
    {
    GetWindowRect(&Rect);
    if (PrjFileVerNo()>=25)
      {
      CRect MRect;
      AfxGetMainWnd()->GetWindowRect(MRect);
      Rect.OffsetRect(-MRect.left, -MRect.top);
      int L=PF.RdInt(Section(), "Left", Rect.left);
      int T=PF.RdInt(Section(), "Top", Rect.top);
      Rect.OffsetRect(L-Rect.left, T-Rect.top);
      Rect.OffsetRect(+MRect.left, +MRect.top);
      }
    else
      {
    //Rect.left = PF.RdInt(Section(), "Left", Rect.left);
    //Rect.top = PF.RdInt(Section(), "Top", Rect.top);
      int L=PF.RdInt(Section(), "Left", Rect.left);
      int T=PF.RdInt(Section(), "Top", Rect.top);
      Rect.right  += L-Rect.left;
      Rect.bottom += T-Rect.top;
      Rect.left   += L-Rect.left;
      Rect.top    += T-Rect.top;
      }
    //Rect.top = PF.RdInt(Section(), "Top", Rect.top);
    UINT n = 0;
    if (BarStyle & CBRS_ALIGN_TOP)
      {
      Rect.top -= 1;
      Rect.bottom -= 1;
      n = AFX_IDW_DOCKBAR_TOP;
      }
//.........这里部分代码省略.........
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:101,代码来源:Toolbars.cpp


注:本文中的Strng::Length方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。