void CXTPNewToolbarDlg::OnOK()
{
	UpdateData();

	// If no text was entered, alert user.
	if (m_strToolbar.IsEmpty())
	{
		XTPResourceManager()->ShowMessageBox(XTP_IDS_ERROR_BLANKNAME, MB_ICONSTOP);
		return;
	}

	m_nNewID = AFX_IDW_CONTROLBAR_FIRST;

	// Loop through all of the existing control bars to find
	// an available ID to use.
	int nCount = m_pCommandBars->GetCount();
	int nIndex = 0;
	while (nIndex < nCount)
	{
		CXTPToolBar* pBar = m_pCommandBars->GetAt(nIndex);
		ASSERT(pBar != NULL);

		// We found a control bar with the same ID as m_nNewID, increment
		// m_nNewID and reset the position back to the head.
		if (pBar && m_pCommandBar == NULL && pBar->GetBarID() == m_nNewID)
		{
			m_nNewID++;

			// If m_nNewID is greater than the maximum number of allowed
			// custom commands, alert the user and abort.
			if ((int)m_nNewID >= AFX_IDW_CONTROLBAR_LAST)
			{
				XTPResourceManager()->ShowMessageBox(XTP_IDS_ERROR_LIMIT, MB_ICONSTOP);
				CDialog::OnCancel();
				return;
			}

			nIndex = 0;
			continue;
		}


		// Now check to see if the title for the toolbar has already
		// been used, if so, alert the user and return.
		if (pBar && m_pCommandBar != pBar && m_strToolbar.Compare(pBar->GetTitle()) == 0)
		{
			CString strName, strError;

			CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strError, XTP_IDS_ERROR_EXISTS));
			strName.Format(strError, (LPCTSTR)m_strToolbar);

			XTPResourceManager()->ShowMessageBox(strName, MB_ICONSTOP);
			return;
		}

		nIndex++;
	}

	CDialog::OnOK(); // success!
}
void CXTPSyntaxEditPropertiesPageFont::OnSelChangeComboStyles()
{
	if (!m_wndComboStyle.GetListBox().SelChanged())
		return;

	if (GetLBText(m_wndComboStyle, m_csStyle) == CB_ERR)
		return;

	LOGFONT lf = {0};
	if (!GetSafeLogFont(lf))
		return;

	CString csBuffer;
	XTPResourceManager()->LoadString(&csBuffer, XTP_IDS_EDIT_ITALIC);
	lf.lfItalic = (m_csStyle.Find(csBuffer) == -1)? (BYTE)FALSE: (BYTE)TRUE;

	XTPResourceManager()->LoadString(&csBuffer, XTP_IDS_EDIT_BOLD);
	lf.lfWeight = (m_csStyle.Find(csBuffer) == -1)? FW_NORMAL: FW_BOLD;

	if (CreateSafeFontIndirect(m_editFont, lf))
	{
		UpdateSampleFont();
		SetModified(TRUE);
	}
}
Exemplo n.º 3
0
void CXTPEditListBoxToolBar::Initialize(bool bAutoFont/*= true*/)
{
	// Create the ToolTip control.
	m_tooltip.Create(this);
	m_tooltip.Activate(TRUE);

	CImageList imageList;
	imageList.Create(14, 12, ILC_COLOR8 | ILC_MASK, 0, 1);

	CBitmap bmp;
	CXTPResourceManager::AssertValid(XTPResourceManager()->LoadBitmap(&bmp, XTP_IDB_LISTEDIT));
	imageList.Add(&bmp, RGB(255, 0, 255));

	for (int i = 0; i < _countof(m_arButton); ++i)
	{
		if ((!m_bShowNewDeleteButtons) && ((i==0) || (i==1)))
			continue;

		if ((!m_bShowUpDownButtons) && ((i==2) || (i==3)))
			continue;

		if (!m_arButton[i].Create(NULL, WS_CHILD | WS_VISIBLE | BS_ICON | BS_CENTER | BS_VCENTER,
			CRect(0, 0, 0, 0), this, _arButtonID[i]))
		{
			TRACE0("Unable to create edit button.\n");
			continue;
		}

		m_arIcon[i] = imageList.ExtractIcon(i);
		m_arButton[i].SetIcon(CSize(0), m_arIcon[i]);

		CString strToolTip;
		CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strToolTip, _arButtonID[i]));
		// Add tooltips to group buttons.
		m_tooltip.AddTool(&m_arButton[i], strToolTip);

		// make sure the button is Windows XP theme compatible using
		// the toolbar button theme.
		if (m_arButton[i].SetTheme(xtpControlThemeFlat))
		{
			CXTPButtonTheme* pTheme = m_arButton[i].GetTheme();
			if (pTheme)
			{
				pTheme->EnableToolbarStyle(TRUE);
			}
			m_arButton[i].SetUseVisualStyle(TRUE);
		}
	}

	// Move the buttons to their correct location.
	MoveButtons();

	// Set the font for this window.
	if (bAutoFont)
	{
		SetFont(&XTPAuxData().font);
	}
}
void CXTPDockingPaneSplitterWnd::Create(CXTPDockingPaneSplitterContainer* pContainer, CXTPDockingPaneBase* pFirst, CXTPDockingPaneBase* pSecond)
{
	m_pFirst = pFirst;
	m_pSecond = pSecond;
	m_pContainer = pContainer;
	m_bHoriz = !m_pContainer->IsHoriz();
	m_pManager = m_pContainer->GetDockingPaneManager();

	m_hCursor = XTPResourceManager()->LoadCursor(pContainer->m_bHoriz ? XTP_IDC_HSPLITBAR :  XTP_IDC_VSPLITBAR);
	XTPResourceManager()->AssertValid(m_hCursor != 0);

	CWnd::Create(_T("XTPDockingPaneSplitter"), _T("Splitter"), WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, CRect(0, 0, 0, 0), pContainer->GetDockingSite(), 0);
}
Exemplo n.º 5
0
CXTPChartDiagramView::CXTPChartDiagramView(CXTPChartDiagram* pDiagram, CXTPChartElementView* pParentView)
	: CXTPChartElementView(pParentView)
{
	m_pDiagram = pDiagram;
	m_rcBounds.SetRectEmpty();
	m_pLabelsView = NULL;
	m_pSeriesView = NULL;

	m_hcurNormalHand = XTPResourceManager()->LoadCursor(XTP_IDC_CHART_NORMALHAND);
	m_hcurDragHand = XTPResourceManager()->LoadCursor(XTP_IDC_CHART_DRAGHAND);


	m_pTitlesView = new CXTPChartElementView(this);
}
CXTPCustomizeDropSource::CXTPCustomizeDropSource(CXTPCommandBars* pCommandBars)
{
	m_hcurDelete = XTPResourceManager()->LoadCursor(XTP_IDC_COMMANDBARS_DRAGDELETE);
	m_hcurMove = XTPResourceManager()->LoadCursor(XTP_IDC_COMMANDBARS_DRAGMOVE);
	m_hcurCopy = XTPResourceManager()->LoadCursor(XTP_IDC_COMMANDBARS_DRAGCOPY);
	m_pSheet = NULL;
	m_pCommandBars = pCommandBars;

	m_hwndCapture = 0;
	m_pControl = 0;
	m_bMove = FALSE;
	m_bCopyOnly = FALSE;
	m_pTarget = NULL;
}
BOOL CXTPReportPageSetupDialog::OnInitDialog ()
{
	CPageSetupDialog::OnInitDialog();

	ASSERT(m_pOptions);

	VERIFY( m_ctrlHeaderFormat.SubclassDlgItem(XTP_IDC_HEADER_FORMAT, this) );
	VERIFY( m_ctrlFooterFormat.SubclassDlgItem(XTP_IDC_FOOTER_FORMAT, this) );

	VERIFY( m_ctrlHeaderFormatBtn.SubclassDlgItem(XTP_IDC_HEADER_FORMAT_BTN, this) );
	VERIFY( m_ctrlFooterFormatBtn.SubclassDlgItem(XTP_IDC_FOOTER_FORMAT_BTN, this) );

	if (m_pOptions && m_pOptions->GetPageHeader())
		m_ctrlHeaderFormat.SetWindowText(m_pOptions->GetPageHeader()->m_strFormatString);

	if (m_pOptions && m_pOptions->GetPageFooter())
		m_ctrlFooterFormat.SetWindowText(m_pOptions->GetPageFooter()->m_strFormatString);

	if (GetDlgItem(rad1))
		GetDlgItem(rad1)->EnableWindow(TRUE); //1056 Portrait
	if (GetDlgItem(rad2))
		GetDlgItem(rad2)->EnableWindow(TRUE); //1057 Landscape

	BOOL bIsInches = m_pOptions ? m_pOptions->IsMarginsMeasureInches() : FALSE;

	UINT uStrID = bIsInches ? XTP_IDS_REPORT_MARGINS_INCH : XTP_IDS_REPORT_MARGINS_MM;
	CString strCaption;
	CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strCaption, uStrID));

	if (!strCaption.IsEmpty() && GetDlgItem(grp4))
		GetDlgItem(grp4)->SetWindowText(strCaption);

	return FALSE;
}
void CXTPNewToolbarDlg::SetSuggestedName()
{
	CString szMsg;
	XTPResourceManager()->LoadString(&szMsg, XTP_IDS_CUSTOM_BAR);

	int iNewID = 1;
	CString strCustom;
	strCustom.Format(szMsg, iNewID);

	int nCount = m_pCommandBars->GetCount();
	int nIndex = 0;
	while (nIndex < nCount)
	{
		CXTPToolBar* pBar = m_pCommandBars->GetAt(nIndex);
		ASSERT(pBar != NULL);

		if (pBar && strCustom.Compare(pBar->GetTitle()) == 0)
		{
			strCustom.Format(szMsg, iNewID++);
			nIndex = 0;
			continue;
		}
		nIndex++;
	}

	m_strToolbar = strCustom;
	UpdateData(FALSE);
}
INT_PTR CXTPDockingPaneSidePanel::OnToolHitTest(CPoint point, TOOLINFO* pTI) const
{

	ASSERT_VALID(this);
	ASSERT(::IsWindow(m_hWnd));

	// check child windows first by calling CControlBar
	INT_PTR nHit = CWnd::OnToolHitTest(point, pTI);
	if (nHit != -1)
		return nHit;

	CXTPDockingPaneCaptionButton* pButton = HitTestCaptionButton(point);

	if (pButton)
	{
		nHit = (INT_PTR)pButton->GetID();
		CString strTip;
		XTPResourceManager()->LoadString(&strTip, (UINT)nHit);

		if (strTip.GetLength() == 0)
			return -1;

		CXTPToolTipContext::FillInToolInfo(pTI, m_hWnd, pButton->GetRect(), nHit, strTip);

		return nHit;
	}

	return -1;
}
CXTPReportPageSetupDialog::CXTPReportPageSetupDialog(
	CXTPReportViewPrintOptions* pOptions,
	DWORD dwFlags, CWnd* pParentWnd)
	: CPageSetupDialog(dwFlags, pParentWnd)
{
	ASSERT(pOptions);
	m_pOptions = pOptions;

	if (m_pOptions)
	{
		BOOL bIsInches = m_pOptions->IsMarginsMeasureInches();
		DWORD dwMeasure = bIsInches ? PSD_INTHOUSANDTHSOFINCHES : PSD_INHUNDREDTHSOFMILLIMETERS;

		m_psd.Flags &= ~PSD_INWININIINTLMEASURE;
		m_psd.Flags |= dwMeasure;
	}

	m_psd.Flags |= PSD_ENABLEPAGESETUPTEMPLATEHANDLE;
	m_psd.hPageSetupTemplate = (HGLOBAL)XTPResourceManager()->LoadDialogTemplate(IDD);
	ASSERT(m_psd.hPageSetupTemplate);

	if (m_pOptions)
		m_psd.rtMargin = m_pOptions->m_rcMargins;

	m_nIDHelp = CXTPReportPageSetupDialog::IDD;
}
void CXTPCustomizeToolbarsPage::OnResetToolbar()
{
	int nIndex = m_checkList.GetCurSel();
	if (nIndex == LB_ERR)
		return;

	CXTPCommandBars* pCommandBars = m_pSheet->GetCommandBars();

	int i = (int)m_checkList.GetItemData(nIndex);
	if (i < 0 || i >= pCommandBars->GetCount())
		return;

	CXTPToolBar* pToolBar = pCommandBars->GetAt(i);

	if (!pToolBar->IsBuiltIn())
		return;

	CString strMessage, strTitle = pToolBar->GetTitle(), strReset;

	CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strReset, XTP_IDS_CONFIRM_RESET));
	strMessage.Format(strReset, (LPCTSTR)strTitle);

	if (m_pSheet->MessageBox(strMessage, MB_ICONWARNING | MB_OKCANCEL) != IDOK)
		return;

	pToolBar->Reset(FALSE);
	RefreshToolbarsList();
}
CXTPCalendarEventRecurrenceDlg::CXTPCalendarEventRecurrenceDlg(CXTPCalendarEvent* pMasterEvent,
		CWnd* pParent, UINT nIDTemplate)
	:
	m_nOccurNum(10),
	m_dtEndDate(COleDateTime::GetCurrentTime()),
	m_nDayInterval(1),
	m_nWeeklyInterval(1),
	m_bMonday(TRUE),
	m_bTuesday(FALSE),
	m_bWednesday(FALSE),
	m_bThursday(FALSE),
	m_bFriday(FALSE),
	m_bSaturday(FALSE),
	m_bSunday(FALSE),
	m_MonthDate(1),
	m_nMonthInterval(1),
	m_nMonthInterval2(1),
	m_nDayOfMonth(m_dtEndDate.GetDay()),
	m_ptrMasterEvent(pMasterEvent, TRUE),
	m_bDisableRemove(FALSE)
{
	InitModalIndirect(XTPResourceManager()->LoadDialogTemplate(nIDTemplate), pParent);

	ASSERT(m_ptrMasterEvent);

	m_ptrPattern = m_ptrMasterEvent->GetRecurrencePattern();
	m_dtStart = m_ptrPattern->GetStartTime();
	m_dtEnd = m_dtStart + m_ptrPattern->GetDuration();

	m_dtStartDate = m_ptrPattern->GetPatternStartDate();
}
CXTPSyntaxEditPropertiesPageFont::CXTPSyntaxEditPropertiesPageFont(CXTPSyntaxEditView* pEditView/*=NULL*/)
: //CPropertyPage(CXTPSyntaxEditPropertiesPageFont::IDD),
m_bModified(FALSE)
, m_pEditView(pEditView)
, m_uFaceSize(LF_FACESIZE)
{
	m_psp.dwFlags |= PSP_DLGINDIRECT;
	m_psp.pResource = XTPResourceManager()->LoadDialogTemplate(IDD);

	//{{AFX_DATA_INIT(CXTPSyntaxEditPropertiesPageFont)
	m_bStrikeOut = FALSE;
	m_bUnderline = FALSE;
	m_csName = _T("Courier");
	m_csStyle = _T("Regular");
	m_csSize = _T("10");
	//}}AFX_DATA_INIT

	m_iCharSet = DEFAULT_CHARSET;
	m_crHiliteText = ::GetSysColor(COLOR_HIGHLIGHTTEXT);
	m_crHiliteBack = ::GetSysColor(COLOR_HIGHLIGHT);
	m_crText = ::GetSysColor(COLOR_WINDOWTEXT);
	m_crBack = ::GetSysColor(COLOR_WINDOW);

	ReadRegistryValues();
}
void CXTPCustomizeToolbarsPage::OnDeleteToolbar()
{
	int nIndex = m_checkList.GetCurSel();
	if (nIndex == LB_ERR)
		return;

	CXTPCommandBars* pCommandBars = m_pSheet->GetCommandBars();

	int i = (int)m_checkList.GetItemData(nIndex);
	if (i < 0 || i >= pCommandBars->GetCount())
		return;

	CXTPToolBar* pToolBar = pCommandBars->GetAt(i);

	if (pToolBar->IsBuiltIn())
		return;

	CString strMessage;

	CString strDelete;
	CXTPResourceManager::AssertValid(XTPResourceManager()->LoadString(&strDelete, XTP_IDS_CONFIRM_DELETE));
	strMessage.Format(strDelete, (LPCTSTR)pToolBar->GetTitle());

	if (m_pSheet->MessageBox(strMessage, MB_ICONWARNING | MB_OKCANCEL) == IDOK)
	{
		pCommandBars->GetSite()->SendMessage(WM_XTP_CUSTOMIZATION_DELETETOOLBAR, 0, (LPARAM)pToolBar);

		pCommandBars->Remove(pToolBar);
		RefreshToolbarsList();
	}
}
Exemplo n.º 15
0
void CXTPEditListBox::SetListEditStyle(UINT nTitle, DWORD dwLStyle/*= LBS_XTP_DEFAULT*/)
{
	CString strTitle;
	XTPResourceManager()->LoadString(&strTitle, nTitle);

	SetListEditStyle(strTitle, dwLStyle);
}
Exemplo n.º 16
0
CXTPNewToolbarDlg::CXTPNewToolbarDlg(CWnd* pParent, CXTPCommandBars* pCommandBars, CXTPCommandBar* pCommandBar)
	: m_pCommandBars(pCommandBars), m_pCommandBar(pCommandBar)
{
	InitModalIndirect(XTPResourceManager()->LoadDialogTemplate(XTP_IDD_NEWTOOLBAR), pParent);

	m_strToolbar = _T("");
	m_nNewID = 0;
}
Exemplo n.º 17
0
void CXTPTabManager::CNavigateButtonArrowLeft::Reposition(CRect& rcNavigateButtons)
{
	XTPResourceManager()->LoadString(&m_strToolTip, m_pManager->IsHorizontalPosition() ? XTP_IDS_TABNAVIGATEBUTTON_LEFT : XTP_IDS_TABNAVIGATEBUTTON_UP);

	m_bEnabled = m_pManager->GetHeaderOffset() < 0;

	CNavigateButtonArrow::Reposition(rcNavigateButtons);
}
CXTPSyntaxEditInsertStringCommand::CXTPSyntaxEditInsertStringCommand(
    CXTPSyntaxEditBufferManager* pMgr,
    LPCTSTR szText, const XTP_EDIT_LINECOL& lcFrom, const XTP_EDIT_LINECOL& lcTo)
    : CXTPSyntaxEditBufferCommand(pMgr, szText, lcFrom, lcTo)
{
    XTPResourceManager()->LoadString(&m_strCommandText, XTP_IDS_EDIT_INSERT);
    m_strCommandText += m_strText;
}
Exemplo n.º 19
0
CString CStartupView::GetToolTipByID(UINT uID) const 
{
   CString strTipText;
    // don't handle the message if no string resource found
	if (XTPResourceManager()->LoadString(&strTipText, uID))
		return strTipText;

   return _T("Title");
}
void CXTPSyntaxEditUndoRedoManager::SetLastCommandText(UINT nTextId)
{
    // load text from resources
    CString strText;
    XTPResourceManager()->LoadString(&strText, nTextId);

    // run text changing
    SetLastCommandText(strText);
}
CXTPSyntaxEditReplaceStringCommand::CXTPSyntaxEditReplaceStringCommand(
    CXTPSyntaxEditBufferManager* pMgr,
    LPCTSTR szText, LPCTSTR szReplacedText,
    const XTP_EDIT_LINECOL& lcFrom, const XTP_EDIT_LINECOL& lcTo)
    : CXTPSyntaxEditBufferCommand(pMgr, szText, lcFrom, lcTo), m_strReplacedText(szReplacedText)
{
    XTPResourceManager()->LoadString(&m_strCommandText, XTP_IDS_EDIT_MULTIPLE);
    m_strCommandText += m_strText;
}
int CXTPSyntaxEditColorComboBox::SetAutoColor(COLORREF crColor, LPCTSTR lpszAutoText/*=NULL*/)
{
	CString csAuto;
	if (lpszAutoText == NULL)
	{
		XTPResourceManager()->LoadString(
			&csAuto, XTP_IDS_CLR_AUTOMATIC);

		int nTipIndex = csAuto.Find(_T('\n'), 0);
		if (nTipIndex > 0)
			csAuto.ReleaseBuffer(nTipIndex);
	}
	else
	{
		csAuto = lpszAutoText;
	}

	if (crColor == COLORREF_NULL)
	{
		m_crAuto = COLORREF_NULL;

		int iIndex = FindStringExact(-1, csAuto);
		if (iIndex != CB_ERR)
		{
			return DeleteString(iIndex);
		}

		return CB_ERR;
	}

	if (m_crAuto == COLORREF_NULL)
	{
		int iIndex = InsertString(0, csAuto);
		if (iIndex != CB_ERR)
		{
			m_crAuto = crColor;
			SetItemData(iIndex, (DWORD)m_crAuto);
			RedrawWindow();
			return iIndex;
		}
	}
	else
	{
		int iIndex = FindStringExact(-1, csAuto);
		if (iIndex != CB_ERR)
		{
			m_crAuto = crColor;
			SetItemData(iIndex, (DWORD)m_crAuto);
			RedrawWindow();
			return iIndex;
		}
	}

	return CB_ERR;
}
Exemplo n.º 23
0
void CXTPTabManager::CNavigateButtonArrowRight::Reposition(CRect& rcNavigateButtons)
{
	XTPResourceManager()->LoadString(&m_strToolTip, m_pManager->IsHorizontalPosition() ? XTP_IDS_TABNAVIGATEBUTTON_RIGHT : XTP_IDS_TABNAVIGATEBUTTON_DOWN);

	CRect rcHeaderMargin = m_pManager->GetPaintManager()->GetAppearanceSet()->GetHeaderMargin();

	m_bEnabled = m_pManager->GetItemsLength() + m_pManager->GetHeaderOffset() >
		m_pManager->GetRectLength(rcNavigateButtons) - (rcHeaderMargin.left + rcHeaderMargin.right) - 28;

	CNavigateButtonArrow::Reposition(rcNavigateButtons);
}
// CXTPCalendarOccurSeriesChooseDlg dialog
CXTPCalendarOccurSeriesChooseDlg::CXTPCalendarOccurSeriesChooseDlg(CWnd* pParent,
							UINT nIDResourceLabels, LPCTSTR lpszResourceIcon, UINT nIDTemplate)
{
	InitModalIndirect(XTPResourceManager()->LoadDialogTemplate(nIDTemplate), pParent);

	m_bOccur = TRUE;
	m_nIDResourceLabels = nIDResourceLabels;
	m_hIcon = XTPLoadIconEx(lpszResourceIcon);

	SetEvent(NULL);
}
Exemplo n.º 25
0
void CXTPColorDialog::AddPage(CPropertyPage* pPage)
{
	CPropertySheet::AddPage(pPage);

	LPCDLGTEMPLATE pResource = XTPResourceManager()->LoadDialogTemplate((UINT)(UINT_PTR)pPage->m_psp.pszTemplate);

	if (pResource)
	{
		pPage->m_psp.pResource = pResource;
		pPage->m_psp.dwFlags |= PSP_DLGINDIRECT;
	}
}
Exemplo n.º 26
0
CXTPEyeDropper::CXTPEyeDropper()
: m_nPadding(2)
, m_icoSize(24,24)
, m_bPreInit(TRUE)
, m_bShowPreview(FALSE)
, m_bSetClipboard(FALSE)
, m_hIcon(NULL)
, m_hCurEyeDropper(NULL)
, m_hCurPrevious(NULL)
, m_color(COLORREF_NULL)
{
	VERIFY(RegisterEyeDropperClass());

	m_hIcon = XTPResourceManager()->LoadIcon(
		XTP_IDI_EYEDROPPER, CSize(24,24));

	m_hCurEyeDropper = XTPResourceManager()->LoadCursor(
		XTP_IDC_EYEDROPPER);

	m_color = ::GetSysColor(COLOR_3DFACE);
}
CXTPCalendarTimeScalePropertiesDlg::CXTPCalendarTimeScalePropertiesDlg(CWnd* pParent, UINT nIDTemplate)
{
	InitModalIndirect(XTPResourceManager()->LoadDialogTemplate(nIDTemplate), pParent);

	m_bShowScale2 = FALSE;

	TIME_ZONE_INFORMATION m_tziScale2;
	::ZeroMemory(&m_tziScale2, sizeof(m_tziScale2));

	VERIFY(::GetTimeZoneInformation(&m_tziScale2) != TIME_ZONE_ID_INVALID);

	m_bAutoAdjustDayLight2 = FALSE;
}
Exemplo n.º 28
0
CXTPDocumentStructurePaintManager::CXTPDocumentStructurePaintManager() {
    AFX_MANAGE_STATE(AfxGetStaticModuleState());
    if (m_pGlyphs != NULL) {
        CMDTARGET_RELEASE(m_pGlyphs);
    }

    CBitmap bmp;
    CXTPResourceManager::AssertValid(XTPResourceManager()->LoadBitmap(&bmp, XTP_IDB_REPORT_GLYPHS_INTERACTION));

    m_pGlyphs = new CXTPImageManager();
    CXTPTempColorMask mask(m_pGlyphs, RGB(255, 0, 255));
    m_pGlyphs->SetIcons(bmp, 0, 8, CSize(0, 0));
}
int CXTPSyntaxEditColorComboBox::SetUserColor(COLORREF crColor, LPCTSTR lpszUserText/*=NULL*/)
{
	CString csCustom;
	if (lpszUserText == NULL)
	{
		XTPResourceManager()->LoadString(
			&csCustom, XTP_IDS_EDIT_CUSTOM);
	}
	else
	{
		csCustom = lpszUserText;
	}

	if (crColor == COLORREF_NULL)
	{
		m_crUser = COLORREF_NULL;

		int iIndex = FindStringExact(-1, csCustom);
		if (iIndex != CB_ERR)
		{
			return DeleteString(iIndex);
		}

		return CB_ERR;
	}

	if (m_crUser == COLORREF_NULL)
	{
		int iIndex = AddString(csCustom);
		if (iIndex != CB_ERR)
		{
			m_crUser = crColor;
			SetItemData(iIndex, (DWORD)m_crUser);
			RedrawWindow();
			return iIndex;
		}
	}
	else
	{
		int iIndex = FindStringExact(-1, csCustom);
		if (iIndex != CB_ERR)
		{
			m_crUser = crColor;
			SetItemData(iIndex, (DWORD)m_crUser);
			RedrawWindow();
			return iIndex;
		}
	}

	return CB_ERR;
}
void CXTPCalendarEventRecurrenceDlg::MsgBox_WrongValueRange(UINT nCtrlID, int nMin, int nMax)
{
	if (GetDlgItem(nCtrlID))
		GetDlgItem(nCtrlID)->SetFocus();

	CString strFormat = CXTPCalendarUtils::LoadString(XTP_IDS_CALENDAR_WRONG_VALUE_RANGE);
	CString strMsg, strVal1, strVal2;
	strVal1.Format(_T("%d"), nMin);
	strVal2.Format(_T("%d"), nMax);

	strMsg.Format(strFormat, (LPCTSTR)strVal1, (LPCTSTR)strVal2);

	XTPResourceManager()->ShowMessageBox(strMsg);
}