本文整理汇总了C++中CSlider::Draw方法的典型用法代码示例。如果您正苦于以下问题:C++ CSlider::Draw方法的具体用法?C++ CSlider::Draw怎么用?C++ CSlider::Draw使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CSlider
的用法示例。
在下文中一共展示了CSlider::Draw方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Draw
void CPopupMenu::Draw (HSURFACE hScreen)
{
// would a flashing cursor be visible?
LTBOOL bFlashingVisible = fmod (m_pClientDE->GetTime(), CURSORBLINKTIME) < (CURSORBLINKTIME / 2.0f);
// draw the background to the screen
m_pClientDE->DrawSurfaceToSurface (hScreen, m_hBackground, NULL, m_nLeft, m_nTop);
// create the font and color we may need for any edit controls...
HSTRING hstrFont = m_pClientDE->FormatString (IDS_INGAMEFONT);
HLTFONT hFont = m_pClientDE->CreateFont (m_pClientDE->GetStringData(hstrFont), 8, 16, LTFALSE, LTFALSE, LTFALSE);
m_pClientDE->FreeString (hstrFont);
HLTCOLOR hForeText = m_pClientDE->SetupColor1 (1.0f, 1.0f, 1.0f, LTFALSE);
// if a title exists, draw it
int nCurrentY = BORDERSIZE + m_nTopMargin;
if (m_hTitle)
{
uint32 nWidth, nHeight;
m_pClientDE->GetSurfaceDims (m_hTitle, &nWidth, &nHeight);
LTRect rcSrc;
rcSrc.left = 0;
rcSrc.top = 0;
rcSrc.right = nWidth;
rcSrc.bottom = nHeight;
if ((int)nWidth > Width() - (BORDERSIZE << 1) - m_nLeftMargin)
{
rcSrc.right -= nWidth - (Width() - (BORDERSIZE << 1) - m_nLeftMargin);
}
if (nCurrentY + (int)nHeight > Height() - BORDERSIZE)
{
rcSrc.bottom -= (nCurrentY + nHeight) - (Height() - BORDERSIZE);
}
m_pClientDE->DrawSurfaceToSurface (hScreen, m_hTitle, &rcSrc, BORDERSIZE + m_nLeftMargin + m_nLeft, BORDERSIZE + m_nTopMargin + m_nTop);
nCurrentY += (int) nHeight + m_nTopMargin;
}
// draw each item
uint32 nCurrentItem = m_nFirstItem;
while (nCurrentItem < m_nItems && nCurrentY < m_nBottom)
{
// get this item's width and clamp it if necessary
uint32 nWidth, nHeight;
m_pClientDE->GetSurfaceDims (m_itemArray[nCurrentItem].hSurface, &nWidth, &nHeight);
LTRect rcSrc;
rcSrc.left = 0;
rcSrc.top = 0;
rcSrc.right = nWidth;
rcSrc.bottom = nHeight;
if ((int)nWidth > Width() - (BORDERSIZE << 1) - m_nLeftMargin)
{
rcSrc.right -= nWidth - (Width() - (BORDERSIZE << 1) - m_nLeftMargin);
}
if (nCurrentY + m_itemArray[nCurrentItem].nHeight > Height() - BORDERSIZE)
{
rcSrc.bottom -= (nCurrentY + m_itemArray[nCurrentItem].nHeight) - (Height() - BORDERSIZE);
}
if (nCurrentItem == m_nSelection)
{
//HLTCOLOR hRed = m_pClientDE->SetupColor2 (1.0f, 0.0f, 0.0f, LTFALSE);
//m_pClientDE->DrawSurfaceSolidColor (hScreen, m_itemArray[nCurrentItem].hSurface, &rcSrc, BORDERSIZE + m_nLeftMargin + m_nLeft, nCurrentY + m_nTop, NULL, hRed);
m_pClientDE->DrawSurfaceToSurface (hScreen, m_itemArray[nCurrentItem].hSelected, &rcSrc, BORDERSIZE + m_nLeftMargin + m_nLeft, nCurrentY + m_nTop);
}
else
{
if (!m_itemArray[nCurrentItem].bEnabled)
{
//HLTCOLOR hDisabledColor = m_pClientDE->SetupColor2 (0.3f, 0.3f, 0.3f, LTFALSE);
//m_pClientDE->DrawSurfaceSolidColor (hScreen, m_itemArray[nCurrentItem].hSurface, &rcSrc, BORDERSIZE + m_nLeftMargin + m_nLeft, nCurrentY + m_nTop, NULL, hDisabledColor);
m_pClientDE->DrawSurfaceToSurface (hScreen, m_itemArray[nCurrentItem].hSurface, &rcSrc, BORDERSIZE + m_nLeftMargin + m_nLeft, nCurrentY + m_nTop);
}
else
{
m_pClientDE->DrawSurfaceToSurface (hScreen, m_itemArray[nCurrentItem].hSurface, &rcSrc, BORDERSIZE + m_nLeftMargin + m_nLeft, nCurrentY + m_nTop);
}
}
// if this item is an edit control, draw the editable string...
if (m_itemArray[nCurrentItem].nType == Edit && m_itemArray[nCurrentItem].pData)
{
char* pString = ((nCurrentItem == m_nSelection) && m_bEditing) ? m_strEdit : (char*)m_itemArray[nCurrentItem].pData;
if (strlen (pString) == 0)
{
nWidth = 0;
//.........这里部分代码省略.........