• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ GetText函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中GetText函数的典型用法代码示例。如果您正苦于以下问题:C++ GetText函数的具体用法?C++ GetText怎么用?C++ GetText使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: BeginScan

void
CBCSharpStyler::Scan
	(
	istream&			input,
	const TokenExtra&	initData
	)
{
	BeginScan(input);

	const JString& text = GetText();

	Token token;
	JFontStyle style;
	do
		{
		token = NextToken();
		if (token.type == kEOF)
			{
			break;
			}

		// save token starts

		if (token.type == kID                 ||
			token.type == kReservedCKeyword   ||
			token.type == kBuiltInDataType    ||
			token.type == kString             ||
			token.type == kComment            ||
			token.type == kDocComment)
			{
			SaveTokenStart(TokenExtra());
			}

		// set the style

		const JIndex typeIndex = token.type - kWhitespace;
		if (token.type == kWhitespace)
			{
			style = GetDefaultFontStyle();
			}
		else if (token.type == kComment    ||
				 token.type == kDocComment ||
				 token.type == kString)
			{
			style = GetTypeStyle(typeIndex);
			}
		else if (token.type == kPPDirective && SlurpPPComment(&(token.range)))
			{
			token.type = kComment;
			style      = GetTypeStyle(kComment - kWhitespace);
			}
		else if (token.type == kPPDirective)
			{
			style = GetStyle(typeIndex, text.GetSubstring(GetPPNameRange()));
			}
		else if (token.type < kWhitespace)
			{
			style = GetTypeStyle(kError - kWhitespace);
			}
		else if (token.type > kError)	// misc
			{
			if (!GetWordStyle(text.GetSubstring(token.range), &style))
				{
				style = GetDefaultFontStyle();
				}
			}
		else
			{
			style = GetStyle(typeIndex, text.GetSubstring(token.range));
			}
		}
		while (SetStyle(token.range, style));
}
开发者ID:raorn,项目名称:jx_application_framework,代码行数:73,代码来源:CBCSharpStyler.cpp


示例2: IsOn

bool CPrefsDialog::OKClicked()
{
	font_family defFamily;
	font_style defStyle;

	be_plain_font->GetFamilyAndStyle(&defFamily, &defStyle);
	gPrefs->SetPrefString("defdoc font family", fNewFontFamily);
	gPrefs->SetPrefString("defdoc font style", defStyle);
	gPrefs->SetPrefDouble("defdoc font size", fNewFontSize);

	be_bold_font->GetFamilyAndStyle(&defFamily, &defStyle);
	gPrefs->SetPrefString("border font family", fNewBFontFamily);
	gPrefs->SetPrefString("border font style", defStyle);
	gPrefs->SetPrefDouble("border font size", fNewBFontSize);

	gPrefs->SetPrefInt("decimal point", *GetText("decsep"));
	gPrefs->SetPrefInt("thousands separator", *GetText("thoussep"));
	gPrefs->SetPrefInt("list separator", *GetText("listsep"));
	gPrefs->SetPrefInt("date separator", *GetText("datesep"));
	gPrefs->SetPrefInt("time separator", *GetText("timesep"));
	gPrefs->SetPrefString("date order", fDMY->FindMarked()->Label());	
	gPrefs->SetPrefInt("24 hours", IsOn("24 hours"));
	gPrefs->SetPrefInt("Excel keys", IsOn("excel"));
	gPrefs->SetPrefInt("Select Gray", IsOn("grayselect"));
	gPrefs->SetPrefInt("start with new", IsOn("donew"));
	gWithEqualSign = IsOn("formula starts with equal");
	gPrefs->SetPrefInt("formula starts with equal", gWithEqualSign);
	gPrefs->SetPrefInt("dark gridlines", 	IsOn("dark gridlines"));
	if (gPrefs->GetPrefInt("dark gridlines", 0))
		gGridColor = 10;
	else
		gGridColor = 6;

	gPrefs->SetPrefString("c_symbol", GetText("c_symbol"));
	gPrefs->SetPrefInt("c_before", IsOn("c_before"));
	gPrefs->SetPrefInt("c_neg_par", IsOn("c_neg_par"));
	gPrefs->SetPrefInt("c_digits", atoi(GetText("c_digits")));

	if (fPageSetup)
	{
		char *ps = Bin2Hex(fPageSetup, fPageSetupSize);
		gPrefs->SetPrefString("default page setup", ps);
		FREE(ps);
	}

	BMessage msg(msg_WindowOptions);

	msg.AddString("docfamily", fDocFontFamily);
	msg.AddString("docstyle", "Roman");
	msg.AddFloat("docsize", fDocFontSize);
	msg.AddString("borderfamily", fDocBFontFamily);
	msg.AddString("borderstyle", "Bold");
	msg.AddFloat("bordersize", fDocBFontSize);
	msg.AddBool("autorecalc", IsOn("autorecalc"));
	msg.AddBool("displayzero", IsOn("displayzero"));
	msg.AddBool("dispgrid", IsOn("dispgrid"));
	msg.AddBool("disphead", IsOn("disphead"));
	msg.AddBool("prgrid", IsOn("prgrid"));
	msg.AddBool("prhead", IsOn("prhead"));
	
	fOwner->PostMessage(&msg, fOwner->GetCellView());

	BButton *b;
	b = (BButton *)FindView("ok");
	b->SetEnabled(false);
	b = (BButton *)FindView("cancel");
	b->SetEnabled(false);

	InitFormatter();

	return false;
} /* CPrefsDialog::OKClicked */
开发者ID:ModeenF,项目名称:OpenSumIt,代码行数:72,代码来源:PrefsDialog.cpp


示例3: GetText

void CListBoxEx::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
	m_pwndSBV->MoveWindow(m_rcSBV);

	if ((int)lpDrawItemStruct->itemID < 0)
		return; 

	CString text;
	GetText(lpDrawItemStruct->itemID, text);
	CRect rect = lpDrawItemStruct->rcItem;

	int cntItem = GetCount();
	int numShow = m_rcSBV.Height() / m_nItemHeight;
	// 스크롤바가 생성되면 List Box의 드로우 영역을 줄인다.
	if (cntItem > numShow)
		rect.right -= 20;

	CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC);
	Graphics mainG (lpDrawItemStruct->hDC);

	Color clrText = m_clrTextNom;
	// 선택된 Item 영역 그리는 부분.
	if ((lpDrawItemStruct->itemState & ODS_SELECTED) && (lpDrawItemStruct->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
	{
		DrawItem(&mainG,rect,m_clrItemHot);
		clrText = m_clrTextHot;
		DrawText(&mainG,rect,text,clrText);
	}

	// 기본 Item 영역 그리는 부분.
	if (!(lpDrawItemStruct->itemState & ODS_SELECTED) && (lpDrawItemStruct->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
	{
		if (m_bModeOneColor == true)
		{
			DrawItem(&mainG,rect,m_clrItemNom1);
		}
		else
		{
			Color clr;
			lpDrawItemStruct->itemID%2 ? clr = m_clrItemNom1 : clr = m_clrItemNom2;
			DrawItem(&mainG,rect,clr);
		}
		DrawText(&mainG,rect,text,clrText);
	}

	// 선택 -> 미선택 Item 영역 그리는 부분.
	if (!(lpDrawItemStruct->itemState & ODS_SELECTED) && (lpDrawItemStruct->itemAction & ODA_SELECT))
	{
		if (m_bModeOneColor == true)
		{
			DrawItem(&mainG,rect,m_clrItemNom1);
		}
		else
		{
			Color clr;
			lpDrawItemStruct->itemID%2 ? clr = m_clrItemNom1 : clr = m_clrItemNom2;
			DrawItem(&mainG,rect,clr);
		}
		DrawText(&mainG,rect,text,clrText);
	}

}
开发者ID:luckygg,项目名称:ListBoxEx,代码行数:62,代码来源:ListBoxEx.cpp


示例4: GetText

CString FORMULA_Formula::GetText(byte mode)
{
	int layer = 0;
	return GetText(mode, layer);
}
开发者ID:slawer,项目名称:krs_kal,代码行数:5,代码来源:FORMULA.cpp


示例5: GetText

			WString GuiBindableListView::ItemSource::GetTextValue(vint itemIndex)
			{
				return GetText(itemIndex);
			}
开发者ID:vczh-libraries,项目名称:GacUI,代码行数:4,代码来源:GuiBindableListControls.cpp


示例6: GetText

 const char32_t* LineEditData::GetViewText() const {
     return GetText().c_str() + scroll;
 }
开发者ID:Foe-of-Eternity,项目名称:Unvanquished,代码行数:3,代码来源:LineEditData.cpp


示例7: GetText

std::string CGUITextBox::GetDescription() const
{
  return GetText();
}
开发者ID:has12,项目名称:xbmc,代码行数:4,代码来源:GUITextBox.cpp


示例8: BeginScan

void
CBTCLStyler::Scan
	(
	std::istream&			input,
	const TokenExtra&	initData
	)
{
	BeginScan(input);

	const JString& text = GetText();

	JBoolean keepGoing;
	Token token;
	JFontStyle style;
	do
		{
		token = NextToken();
		if (token.type == kEOF)
			{
			break;
			}

		// save token starts

		if (token.type == kPredefinedWord ||
			token.type == kOtherWord ||
			token.type == kVariable ||
			token.type == kString ||
			token.type == kComment)
			{
			SaveTokenStart(TokenExtra());
			}

		// handle special cases

		if (token.type == kString ||
			token.type == kUnterminatedString)
			{
			ExtendCheckRangeForString(token.range);
			}

		// set the style

		const JIndex typeIndex = token.type - kWhitespace;
		if (token.type == kWhitespace)
			{
			style = GetDefaultFont().GetStyle();
			}
		else if (token.type == kComment       ||
				 token.type == kString        ||
				 token.type == kBrace         ||
				 token.type == kSquareBracket ||
				 token.type == kParenthesis)
			{
			style = GetTypeStyle(typeIndex);
			}
		else if (token.type < kWhitespace)
			{
			style = GetTypeStyle(kError - kWhitespace);
			}
		else
			{
			style = GetStyle(typeIndex, text.GetSubstring(token.range));
			}

		keepGoing = SetStyle(token.range, style);

		if (token.type == kString)
			{
			StyleEmbeddedVariables(token);
			}
		}
		while (keepGoing);
}
开发者ID:jafl,项目名称:jx_application_framework,代码行数:74,代码来源:CBTCLStyler.cpp


示例9: SaveOptStringValue

void CUIEditBox::SaveValue(){
	CUIOptionsItem::SaveValue();
	SaveOptStringValue(GetText());
}
开发者ID:2asoft,项目名称:xray,代码行数:4,代码来源:UIEditBox.cpp


示例10: SelectAll

/**
 * Convenience for {@link Selection#selectAll}.
 */
ECode EditText::SelectAll()
{
    Selection::SelectAll(ISpannable::Probe(GetText().Get()));
    return NOERROR;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:8,代码来源:EditText.cpp


示例11: ExtendSelection

/**
 * Convenience for {@link Selection#extendSelection}.
 */
ECode EditText::ExtendSelection(
    /* [in] */ Int32 index)
{
    Selection::ExtendSelection(ISpannable::Probe(GetText().Get()), index);
    return NOERROR;
}
开发者ID:TheTypoMaster,项目名称:ElastosRDK5_0,代码行数:9,代码来源:EditText.cpp


示例12: GetText

    void Field::AutoComplete() {
        //We want to complete in the middle of a command text with potentially multiple commands

        //Add slash prefix and get command text up to cursor
        if (GetText().empty() || (GetText()[0] != '/' && GetText()[0] != '\\')) {
            GetText().insert(GetText().begin(), '/');
            SetCursor(GetCursorPos() + 1);
        }
        std::string commandText = Str::UTF32To8(GetText().substr(1, GetCursorPos() - 1));

        //Split the command text and find the command to complete
        const char* commandStart = commandText.data();
        const char* commandEnd = commandText.data() + commandText.size();
        while (true) {
            const char* next = Cmd::SplitCommand(commandStart, commandEnd);
            if (next != commandEnd)
                commandStart = next;
            else
                break;
        }

        //Parse the arguments and get the list of candidates
        Cmd::Args args(std::string(commandStart, commandEnd));
        int argNum = args.Argc() - 1;
        std::string prefix;
        if (!args.Argc() || Str::cisspace(GetText()[GetCursorPos() - 1])) {
            argNum++;
        } else {
            prefix = args.Argv(argNum);
        }

        Cmd::CompletionResult candidates = Cmd::CompleteArgument(args, argNum);
        if (candidates.empty()) {
            return;
        }
        std::sort(candidates.begin(), candidates.end());
        candidates.erase(std::unique(candidates.begin(), candidates.end()), candidates.end());

        //Compute the longest common prefix of all the results
        int prefixSize = candidates[0].first.size();
        size_t maxCandidateLength = 0;
        for (auto& candidate : candidates) {
            prefixSize = std::min(prefixSize, Str::LongestIPrefixSize(candidate.first, candidates[0].first));
            maxCandidateLength = std::max(maxCandidateLength, candidate.first.length());
        }

        std::string completedArg(candidates[0].first, 0, prefixSize);

        //Help the user bash the TAB key, but not when completing paths
        if (candidates.size() == 1 && !Str::cisspace(GetText()[GetCursorPos()]) && !Str::IsSuffix("/", completedArg)) {
            completedArg += " ";
        }

        //Insert the completed arg
        std::u32string toInsert = Str::UTF8To32(completedArg);
        DeletePrev(prefix.size());
        GetText().insert(GetCursorPos(), toInsert);
        SetCursor(GetCursorPos() + toInsert.size());

        //Print the matches if it is ambiguous
        if (candidates.size() >= 2) {
            Com_Printf(S_COLOR_YELLOW "-> " S_COLOR_WHITE "%s\n", Str::UTF32To8(GetText()).c_str());
            for (const auto& candidate : candidates) {
                std::string filler(maxCandidateLength - candidate.first.length(), ' ');
                Com_Printf("   %s%s %s\n", candidate.first.c_str(), filler.c_str(), candidate.second.c_str());
            }
        }
    }
开发者ID:JacksonTech,项目名称:Unvanquished,代码行数:68,代码来源:ConsoleField.cpp


示例13: HistoryNext

 void Field::HistoryNext() {
     std::string current = Str::UTF32To8(GetText());
     NextLine(hist, current);
     SetText(Str::UTF8To32(current));
 }
开发者ID:JacksonTech,项目名称:Unvanquished,代码行数:5,代码来源:ConsoleField.cpp


示例14: ASSERT

void CListBox::GetText(int nIndex, CString& rString) const
{
	ASSERT(::IsWindow(m_hWnd));
	GetText(nIndex, rString.GetBufferSetLength(GetTextLen(nIndex)));
	rString.ReleaseBuffer();
}
开发者ID:rickerliang,项目名称:OpenNT,代码行数:6,代码来源:winctrl1.cpp


示例15: GetText

/*
 * Return true if the two tokens are equivalent in a 
 * Speech recognition way.
 */
bool Token::IsEquivalentTo(Token* token)
{
    string tok1;
    string tok2;
    
    if (segment->PerformCaseSensitiveAlignment()) //case sensitive
    {
        tok1 = GetText();
        tok2 = token->GetText();
    }
    else
    {
        tok1 = GetTextInLowerCase();
        tok2 = token->GetTextInLowerCase();
    }
	
	if (segment->AreFragmentsCorrect()) 
    {
		int otherFrag = token->GetFragmentStatus();
		
		if(fragment == NOT_FRAGMENT) 
        {
			if(otherFrag == NOT_FRAGMENT) 
            {
				return tok1 == tok2;
			}
            else if (otherFrag == BEGIN_FRAGMENT) 
            {
                return (tok1.find(tok2, 0) == 0);
			} 
            else 
            {
				return (tok1.find(tok2, tok1.size()-tok2.size()) != string::npos);					
			}
		}
        else if (fragment == BEGIN_FRAGMENT)
        {			
			if(otherFrag == NOT_FRAGMENT) 
            {
				return (tok2.find(tok1, 0) == 0);
			} 
            else if (otherFrag == BEGIN_FRAGMENT) 
            {
				 return ((tok1.find(tok2, 0) != string::npos) || (tok2.find(tok1, 0) != string::npos));
			}
            else 
            {
				return false;
			}
			
		} 
        else 
        { // fragment == END_FRAGMENT
			if(otherFrag == NOT_FRAGMENT)
            {
				return (tok2.find(tok1, tok2.size()-tok1.size()) != string::npos);
			} 
            else if (otherFrag == BEGIN_FRAGMENT) 
            {
				return false;
			} 
            else 
            {
				uint s1 = tok1.size();
				uint s2 = tok2.size();
				return (tok1.find(tok2, s1 - s2) != string::npos) || (tok2.find(tok1, s2 - s1) != string::npos);
			}
		}
	} 
    else 
    {
        return tok1 == tok2;
    }
}
开发者ID:AIDman,项目名称:Kaldi,代码行数:78,代码来源:token.cpp


示例16: xr_strcmp

bool CUIEditBox::IsChanged(){
	return 0 != xr_strcmp(GetOptStringValue(),GetText());
}
开发者ID:2asoft,项目名称:xray,代码行数:3,代码来源:UIEditBox.cpp


示例17: GetText

void ScriptEditCtrl::GetWindowText(CString& text)
{
	text = GetText();
}
开发者ID:mikekov,项目名称:ExifPro,代码行数:4,代码来源:ScriptEditCtrl.cpp


示例18: GetGame

//! 进行制作
BOOL GoodsTailorSystem::MakeGoods(const tagMakeInfo& MakeInfo)
{
	CPlayer *pPlayer = GetGame()->FindPlayer(MakeInfo.PlayerGuid);
	if(NULL == pPlayer)
		return FALSE;

	//! 验证合法性
	switch(MakeInfo.lType)
	{
	case eMT_FORM_GOODS:
		{
			CGoods *pGoods = pPlayer->FindGoodsByGuidInPack(MakeInfo.GoodsGuid);
			if(NULL == pGoods)
				return FALSE;
		}
		break;
	case eMT_FROM_NPC:
		{
			//! 地图判断
			if(MakeInfo.RegionGuid != pPlayer->GetRegionGUID())
				return FALSE;
			//! 距离判断
			if(MakeInfo.lRadius < abs(LONG(pPlayer->GetPosX() - MakeInfo.fPosX)) || MakeInfo.lRadius <  abs((LONG)(pPlayer->GetPosY() - MakeInfo.fPosY)))
				return FALSE;
		}
	    break;
	default:
	    return FALSE;
	}

	//! 开始制作
	if(NULL == MakeInfo.pGsOneMakeTable)
	{
		assert(NULL != MakeInfo.pGsOneMakeTable);
		Log4c::Error(ROOT_MODULE,"%-18s %s",__FUNCTION__,GetText("GS_GOODS_83"));//发生不该出现的错误,物品制作配方对象为空!
		return FALSE;
	}
	DWORD dwResult = MakeInfo.pGsOneMakeTable->MakeGoods(pPlayer);

	//! 处理结果
	if(eGTC_Succeed == dwResult)
	{
		switch(MakeInfo.lType)
		{
		case eMT_FORM_GOODS:
			{
				if(MakeInfo.bDelGoodsWhenFinish)
				{
					if(!pPlayer->DelGoods(MakeInfo.GoodsGuid, 1))
					{
                        //发生严重错误,物品制作已经完成,但消耗物品没有被删除成功,还有一种可能就是配置的消耗物中包含了触发制作的物品!
						Log4c::Error(ROOT_MODULE,"%-18s %s",__FUNCTION__,GetText("GS_GOODS_84"));
					}
				}
			}
			break;
		}
	}
	else
	{
		CMessage msg(MSG_S2C_MAKE_RESULT);
		msg.Add((BYTE)FALSE);
		msg.Add(dwResult);
		msg.SendToPlayer(pPlayer->GetExID(), false);
	}

	return (eGTC_Succeed == dwResult);
}
开发者ID:xiongshaogang,项目名称:mmo-resourse,代码行数:69,代码来源:GoodsTailorSystem.cpp


示例19: GetDlgItem

void Dlg_AchievementsReporter::OnOK(HWND hwnd)
{

	m_hProblem2 = GetDlgItem(hwnd, IDC_RA_PROBLEMTYPE2);





	const auto bProblem1Sel{ Button_GetCheck(m_hProblem1) };
	const auto bProblem2Sel{ Button_GetCheck(m_hProblem2) };

	if ((bProblem1Sel == false) && (bProblem2Sel == false))
	{
		MessageBox(nullptr, TEXT("Please select a problem type."),
			TEXT("Warning"), MB_ICONWARNING);
		return;
	}
	// 0==?
	auto nProblemType{ bProblem1Sel ? 1 : bProblem2Sel ? 2 : 0 };
	auto sProblemTypeNice{ PROBLEM_STR.at(to_unsigned(nProblemType)) };

	std::string sBuggedIDs;
	sBuggedIDs.reserve(1024);

	int nReportCount = 0;

	const size_t nListSize = to_unsigned(ListView_GetItemCount(m_hList));
	for (size_t i = 0; i < nListSize; ++i)
	{
		if (ListView_GetCheckState(m_hList, i) != 0)
		{
			//	NASTY big assumption here...
			auto buffer{
				tfm::format("%d,",
				g_pActiveAchievements->GetAchievement(i).ID())
			};
			sBuggedIDs+=buffer;

			//ListView_GetItem( hList );	
			nReportCount++;
		}
	}

	// Needs another check
	if (sBuggedIDs == "")
	{
		// even with this it might be strange, there has to be a better way to do this...
		// The close button will still close it even though this warning will show up
		MessageBox(GetActiveWindow(),
			_T("You need to to select at least one achievement"),
			_T("Warning"), MB_OK);
		return;
	}

	if (nReportCount > 5)
	{
		if (MessageBox(nullptr,
			TEXT("You have over 5 achievements selected. Is this OK?"),
			TEXT("Warning"), MB_YESNO) == IDNO)
			return;
	}


	m_hComment = GetDlgItem(hwnd, IDC_RA_BROKENACHIEVEMENTREPORTCOMMENT);

	// Now I remember
	auto len{ GetTextLength(m_hComment)};
	std::string sBugReportComment;

	// This ones is extremly important or the capacity will change
	sBugReportComment.reserve(static_cast<std::size_t>(len));
	GetText(m_hComment, len, sBugReportComment.data());


	//	Intentionally MBCS
	auto sBugReportInFull{ tfm::format(
		"--New Bug Report--\n"
		"\n"
		"Game: %s\n"
		"Achievement IDs: %s\n"
		"Problem: %s\n"
		"Reporter: %s\n"
		"ROM Checksum: %s\n"
		"\n"
		"Comment: %s\n"
		"\n"
		"Is this OK?",
		g_pCurrentGameData->GameTitle(),
		sBuggedIDs,
		sProblemTypeNice,
		username(),
		g_sCurrentROMMD5,
		sBugReportComment.c_str()) // strange, it won't show itself as a regular string
	};

	if (MessageBox(nullptr, NativeStr(sBugReportInFull).c_str(),
		TEXT("Summary"), MB_YESNO) == IDNO)
		return;

//.........这里部分代码省略.........
开发者ID:SyrianBallaS,项目名称:RASuite,代码行数:101,代码来源:RA_Dlg_AchievementsReporter.cpp


示例20: ASSERT_KINDOF

void COptionListBox::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
    COptionListBoxItem *item;

    item = (COptionListBoxItem *)lpDrawItemStruct->itemData;
    ASSERT_KINDOF(COptionListBoxItem, item);

    CDC* pDC    = CDC::FromHandle(lpDrawItemStruct->hDC);

    if ((int)lpDrawItemStruct->itemID < 0)
    {
        // If there are no elements in the List Box
        // based on whether the list box has Focus or not
        // draw the Focus Rect or Erase it,
        if ((lpDrawItemStruct->itemAction & ODA_FOCUS) &&
                (lpDrawItemStruct->itemState & ODS_FOCUS))
        {
            pDC->DrawFocusRect(&lpDrawItemStruct->rcItem);
        }
        else if ((lpDrawItemStruct->itemAction & ODA_FOCUS) &&
                 !(lpDrawItemStruct->itemState & ODS_FOCUS))
        {
            pDC->DrawFocusRect(&lpDrawItemStruct->rcItem);
        }
        return;
    }

    CRect  rcItem(lpDrawItemStruct->rcItem); // To draw the focus rect.
    CRect  rClient(rcItem); // Rect to highlight the Item
    CRect  rText(rcItem); // Rect To display the Text
    CPoint Pt( rcItem.left , rcItem.top ); // Point To draw the Image

    if(-1 != item->m_ImgIdx) {
        // if the page has an icon, adjust for it
        rText.left += 18;
    }

    if(FALSE == item->isGroup) {
        Pt.x += 16;
        rcItem.left += 16;
        rClient.left += 16;
        rText.left += 16;
    }

    rText.top += 2;

    COLORREF crText;
    CString strText;

    // Image information in the item data.
    int iImg = (int)lpDrawItemStruct->itemData;

    // If item selected, draw the highlight rectangle.
    // Or if item deselected, draw the rectangle using the window color.
    if ((lpDrawItemStruct->itemState & ODS_SELECTED) &&
            (lpDrawItemStruct->itemAction & (ODA_SELECT | ODA_DRAWENTIRE)))
    {
        CBrush br(::GetSysColor(COLOR_HIGHLIGHT));
        pDC->FillRect(&rClient, &br);
    }
    else if (!(lpDrawItemStruct->itemState & ODS_SELECTED) &&
             (lpDrawItemStruct->itemAction & ODA_SELECT))
    {
        CBrush br(::GetSysColor(COLOR_WINDOW));
        pDC->FillRect(&rClient, &br);
    }

    // If the item has focus, draw the focus rect.
    // If the item does not have focus, erase the focus rect.
    if ((lpDrawItemStruct->itemAction & ODA_FOCUS) &&
            (lpDrawItemStruct->itemState & ODS_FOCUS))
    {
        pDC->DrawFocusRect(&rcItem);
    }
    else if ((lpDrawItemStruct->itemAction & ODA_FOCUS) &&
             !(lpDrawItemStruct->itemState & ODS_FOCUS))
    {
        pDC->DrawFocusRect(&rcItem);
    }

    // To draw the Text set the background mode to Transparent.
    int iBkMode = pDC->SetBkMode(TRANSPARENT);

    if (lpDrawItemStruct->itemState & ODS_SELECTED)
        crText = pDC->SetTextColor(::GetSysColor(COLOR_HIGHLIGHTTEXT));
    else if (lpDrawItemStruct->itemState & ODS_DISABLED)
        crText = pDC->SetTextColor(::GetSysColor(COLOR_GRAYTEXT));
    else
        crText = pDC->SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));

    // Get the item text.
    GetText(lpDrawItemStruct->itemID, strText);

    // Setup the text format.
    UINT nFormat = DT_LEFT | DT_SINGLELINE | DT_VCENTER;
    if (GetStyle() & LBS_USETABSTOPS)
        nFormat |= DT_EXPANDTABS;


    // if the ImageList is Existing and there is an associated Image
//.........这里部分代码省略.........
开发者ID:mimura1133,项目名称:mm_STEP_M,代码行数:101,代码来源:OptionListBox.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ GetTextColor函数代码示例发布时间:2022-05-30
下一篇:
C++ GetTemplate函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap