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


C++ GetMetrics函数代码示例

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


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

示例1: rc

void CXTPSkinObjectTab::DrawTab(CDC* pDC, int iItem)
{
	CXTPClientRect rc(this);
	CTabCtrl* pTabCtrl = (CTabCtrl*)this;

	// Get the current tab selection.
	int iCurSel = pTabCtrl->GetCurSel();

	// Get the tab item size.
	CRect rcItem;
	pTabCtrl->GetItemRect(iItem, &rcItem);

	if (!CRect().IntersectRect(rcItem, rc))
		return;

	CRect rcItemFocus(rcItem);

	// Draw the tab item.
	BOOL bSelected = (iItem == iCurSel);
	FillTabFace(pDC, rcItem, iItem, pTabCtrl->GetItemCount(), bSelected);
	DrawTabIcon(pDC, rcItem, iItem);
	DrawTabText(pDC, rcItem, iItem, iItem, bSelected);

	// draw the focus rect
	if (bSelected && ::GetFocus() == m_hWnd && (SendMessage(WM_QUERYUISTATE) & UISF_HIDEFOCUS) == 0)
	{
		rcItemFocus.DeflateRect(GetMetrics()->m_cxEdge / 2, GetMetrics()->m_cyEdge / 2);
		pDC->DrawFocusRect(&rcItemFocus);
	}
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:30,代码来源:XTPSkinObjectTab.cpp

示例2: ROUND_TO_TWIPS

NS_IMETHODIMP
nsThebesFontMetrics::GetStrikeout(nscoord& aOffset, nscoord& aSize)
{
    aOffset = ROUND_TO_TWIPS(GetMetrics().strikeoutOffset);
    aSize = ROUND_TO_TWIPS(GetMetrics().strikeoutSize);
    return NS_OK;
}
开发者ID:PolyMtl,项目名称:crash-inducing,代码行数:7,代码来源:00148b3ae7d11b330a1f77f1e7520fcb2a396881.cpp

示例3: GetColor

BOOL CXTPSkinObjectFrame::OnHookDefWindowProc(UINT nMessage, WPARAM& wParam, LPARAM& lParam, LRESULT& lResult)
{
    if (nMessage == WM_CTLCOLORBTN || nMessage == WM_CTLCOLORDLG ||
            nMessage == WM_CTLCOLORSTATIC || nMessage == WM_CTLCOLOREDIT || nMessage == WM_CTLCOLORLISTBOX)
    {
        if (m_strClassName == _T("COMBOBOX"))
            return FALSE;

        if (nMessage == WM_CTLCOLOREDIT || nMessage == WM_CTLCOLORLISTBOX)
        {
            ::SetBkColor((HDC)wParam, GetColor(COLOR_WINDOW));
            ::SetTextColor((HDC)wParam, GetColor(COLOR_WINDOWTEXT));
            lResult = (LRESULT)GetMetrics()->m_brushWindow;
            return TRUE;
        }

        if (CWnd::GrayCtlColor((HDC)wParam, (HWND)lParam,
                               (UINT)(nMessage - WM_CTLCOLORMSGBOX),
                               GetMetrics()->m_brushDialog, 0))
        {
            lResult = (LRESULT)GetClientBrush((HDC)wParam, (HWND)lParam, (UINT)(nMessage - WM_CTLCOLORMSGBOX));
            return TRUE;
        }
    }

    return CXTPSkinObject::OnHookDefWindowProc(nMessage, wParam, lParam, lResult);
}
开发者ID:ylyking,项目名称:ThisIsASoftRenderer,代码行数:27,代码来源:XTPSkinObjectFrame.cpp

示例4: rcChild

BOOL CXTPSkinObjectFrame::IsSizeBox()
{
    HWND hWnd = m_hWnd;
    CXTPWindowRect rcChild(hWnd);

    int cxEdge = GetMetrics()->m_cxEdge;
    int cyEdge = GetMetrics()->m_cyEdge;

    while (hWnd)
    {
        if (GetWindowLong(hWnd, GWL_STYLE) & WS_SIZEBOX)
        {
            if ((GetWindowLong(hWnd, GWL_STYLE) & WS_MAXIMIZE))
                return FALSE;

            CPoint ptParent = CXTPClientRect(hWnd).BottomRight();
            ::ClientToScreen(hWnd, &ptParent);

            if ((rcChild.right + cxEdge < ptParent.x) ||
                    (rcChild.bottom + cyEdge < ptParent.y))
            {
                return FALSE;
            }

            return hWnd ? TRUE : FALSE;
        }

        if (((GetWindowLong(hWnd, GWL_STYLE) & WS_CHILD) == 0) || ((GetWindowLong(hWnd, GWL_STYLE) & WS_CAPTION) == WS_CAPTION))
            break;

        hWnd = ::GetParent(hWnd);
    }

    return FALSE;
}
开发者ID:ylyking,项目名称:ThisIsASoftRenderer,代码行数:35,代码来源:XTPSkinObjectFrame.cpp

示例5: CEIL_TO_TWIPS

NS_IMETHODIMP
nsThebesFontMetrics::GetMaxHeight(nscoord &aHeight)
{
    aHeight = CEIL_TO_TWIPS(ComputeMaxAscent(GetMetrics())) +
        CEIL_TO_TWIPS(ComputeMaxDescent(GetMetrics(), mFontGroup));
    return NS_OK;
}
开发者ID:PolyMtl,项目名称:crash-inducing,代码行数:7,代码来源:00148b3ae7d11b330a1f77f1e7520fcb2a396881.cpp

示例6: GetMetrics

int CZipBitmap::GetWidth()
{
    if (!m_iWidth)
        GetMetrics();

    return m_iWidth;
}
开发者ID:cgestes,项目名称:multifxvst,代码行数:7,代码来源:ZipBitmap.cpp

示例7: GetMetrics

void LabelElement::Render() {
	auto m = GetMetrics();
	auto gui = GUI::Get();
	auto textProgram = ShaderRegistry::GetProgram("text");

	textProgram->Use();
	gui->camera->SetUniforms(textProgram.get());
	
	glUniform4f(textProgram->GetUniform("color"), 1,1,1, 1);

	auto size = m->topRight - m->bottomLeft;

	auto scalexy = size/textMesh->size;
	auto scale = std::min(scalexy.x, scalexy.y);
	auto tmbl = m->bottomLeft + vec2{0, textMesh->size.y * scalexy.y};

	Debug::PointUI(m->topRight);
	Debug::PointUI(m->bottomLeft);
	Debug::PointUI(m->bottomLeft + vec2{0, textMesh->size.y * scale}, vec3{1,1,0});

	Debug::PointUI(tmbl, vec3{1,0,0});
	Debug::PointUI(tmbl + textMesh->size * vec2{1,-1} * scale, vec3{0,1,0});
	Debug::PointUI(tmbl + textMesh->size * vec2{1,-1} * scale * .5f, vec3{0,0,1});

	textMesh->modelMatrix = 
		glm::translate(vec3{tmbl, 0}) *
		glm::scale(vec3{scale});

	textMesh->Render();
}
开发者ID:manpat,项目名称:vox,代码行数:30,代码来源:label.cpp

示例8: GetMetrics

HBRUSH CXTPSkinObjectFrame::FillBackground(CDC* pDC, LPCRECT lprc, int nMessage /*= WM_CTLCOLORSTATIC*/)
{
    HBRUSH hBrush = ::GetParent(m_hWnd) ? (HBRUSH)::SendMessage(::GetParent(m_hWnd), nMessage, (WPARAM)pDC->GetSafeHdc(), (LRESULT)m_hWnd) : NULL;
    if (hBrush)
    {
        if ((DWORD_PTR)hBrush < XTP_SKINMETRICS_COLORTABLESIZE)
        {
            hBrush = GetMetrics()->m_brTheme[(DWORD_PTR)hBrush - 1];
        }
        ::FillRect(pDC->GetSafeHdc(), lprc, hBrush);
        return hBrush;
    }

    pDC->FillSolidRect(lprc, GetColor(COLOR_3DFACE));
    return GetMetrics()->m_brTheme[COLOR_3DFACE];
}
开发者ID:ylyking,项目名称:ThisIsASoftRenderer,代码行数:16,代码来源:XTPSkinObjectFrame.cpp

示例9: GetClientRect

CRect CXTPSkinObjectTab::GetHeaderRect()
{
	CRect rcHeader;
	GetClientRect(&rcHeader);

	CTabCtrl* pTabCtrl = (CTabCtrl*)this;

	// get the selected tab item rect.
	CRect rcItem;
	pTabCtrl->GetItemRect(pTabCtrl->GetCurSel(), &rcItem);

	DWORD dwStyle = GetStyle();

	if (IsRight(dwStyle))
	{
		rcHeader.left = rcItem.left;
	}
	else if (IsLeft(dwStyle))
	{
		rcHeader.right = rcItem.right;
	}
	else if (IsBottom(dwStyle))
	{
		rcHeader.top = rcItem.top;
	}
	else
	{
		rcHeader.bottom = (rcHeader.top + rcItem.Height()) * pTabCtrl->GetRowCount() + GetMetrics()->m_cyEdge;
	}
	return rcHeader;
}
开发者ID:killbug2004,项目名称:ghost2013,代码行数:31,代码来源:XTPSkinObjectTab.cpp

示例10: GetMetrics

BOOL CXTPSkinObjectToolBar::OnEraseBkgnd(CDC* pDC)
{
	if (GetStyle() & (TBSTYLE_TRANSPARENT | TBSTYLE_CUSTOMERASE))
	{
		return CXTPSkinObjectFrame::OnEraseBkgnd(pDC);
	}

	HBRUSH hbr = (HBRUSH)(DWORD_PTR)GetClassLongPtr(m_hWnd, GCLP_HBRBACKGROUND);
	BOOL bChanged = FALSE;

	if (hbr > 0 && (ULONG_PTR)hbr < (ULONG_PTR)XTP_SKINMETRICS_COLORTABLESIZE)
	{
		HBRUSH hbrTheme = GetMetrics()->m_brTheme[(ULONG_PTR)hbr - 1];
		SetClassLongPtr(m_hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)hbrTheme);
		bChanged = TRUE;
	}

	BOOL bResult =  (BOOL)::DefWindowProc(m_hWnd, WM_ERASEBKGND, (WPARAM)pDC->GetSafeHdc(), 0);

	if (bChanged)
	{
		SetClassLongPtr(m_hWnd, GCLP_HBRBACKGROUND, (LONG_PTR)hbr);
	}
	return bResult;
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:25,代码来源:XTPSkinObjectToolBar.cpp

示例11: GetMetrics

void ButtonElement::Update() {
	auto gui = GUI::Get();
	auto b = &gui->builder;
	auto m = GetMetrics();

	b->depth = m->depth;
	b->Add9Slice(m->bottomLeft, m->topRight, slice, buttonSize, 3.f);
}
开发者ID:manpat,项目名称:vox,代码行数:8,代码来源:button.cpp

示例12: GetMetrics

int32_t
nsFontMetrics::GetMaxStringLength()
{
    const gfxFont::Metrics& m = GetMetrics();
    const double x = 32767.0 / m.maxAdvance;
    int32_t len = (int32_t)floor(x);
    return std::max(1, len);
}
开发者ID:logicoftekk,项目名称:cyberfox,代码行数:8,代码来源:nsFontMetrics.cpp

示例13: NS_ASSERTION

// Get the glyphID of a space
PRUint32
gfxFT2FontBase::GetSpaceGlyph()
{
    NS_ASSERTION(GetStyle()->size != 0,
                 "forgot to short-circuit a text run with zero-sized font?");
    GetMetrics();
    return mSpaceGlyph;
}
开发者ID:typ4rk,项目名称:mozilla-history,代码行数:9,代码来源:gfxFT2FontBase.cpp

示例14: calcBaselineAscent

float RenderDevice::calcBaselineAscent(const std::wstring& key)
{
	auto pFont = this->getStockedFont(key);
	if (pFont == nullptr) return 0;

	DWRITE_FONT_METRICS metrics;
	pFont->GetMetrics(&metrics);
	return metrics.ascent;
}
开发者ID:Pctg-x8,项目名称:ChartForge,代码行数:9,代码来源:renderDevice.cpp

示例15: GetMetrics

void TelegrafSocket::SendMetrics()
{
	ServerInstance->Logs->Log("TELEGRAF", DEBUG, "Sending Telegraf Metrics..");
	TelegrafLine line = GetMetrics();
	creator->metrics.loopTimes.clear();
	creator->metrics.loopTimes.reserve(10);
	std::string out(line.format());
	WriteData(out);
	ServerInstance->Logs->Log("TELEGRAF", DEBUG, "Sent Telegraf metrics: %s", out.c_str());
}
开发者ID:snoonetIRC,项目名称:inspircd-modules,代码行数:10,代码来源:m_telegraf.cpp


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