本文整理汇总了C++中ListView::HotRow方法的典型用法代码示例。如果您正苦于以下问题:C++ ListView::HotRow方法的具体用法?C++ ListView::HotRow怎么用?C++ ListView::HotRow使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ListView
的用法示例。
在下文中一共展示了ListView::HotRow方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
void SourcesListModel::ItemCellRenderer::Render(const ListView& listView, ListView::RenderParams& renderParams)
{
static const int gutterWidth = 6;
bool isSelected = false;
bool isHot = (listView.HotRow() == renderParams.rowIndex);
Color gutterColor = Color::SystemColor(COLOR_BTNFACE);
FontRef font = Font::Create();
// selected
if (renderParams.rowIndex == owner.activeItemIndex)
{
isSelected = true;
renderParams.foreColor = Color::SystemColor(COLOR_HIGHLIGHTTEXT);
renderParams.backColor = Color::SystemColor(COLOR_HIGHLIGHT);
gutterColor = Color::SystemColor(COLOR_ACTIVECAPTION);
font->SetBold();
}
else
{
renderParams.backColor = Color::Lighten(Color::SystemColor(COLOR_BTNFACE), 15);
renderParams.foreColor = Color::SystemColor(COLOR_BTNTEXT);
}
// fill the background
if (isHot)
{
renderParams.backColor = Color::Lighten(renderParams.backColor, 15);
}
//
HBRUSH backBrush = ::CreateSolidBrush(renderParams.backColor);
::FillRect(renderParams.hdc, &(RECT) renderParams.rect, backBrush);
::DeleteObject(backBrush);
// fill the gutter
RECT gutterRect = renderParams.rect;
gutterRect.right = gutterRect.left + gutterWidth;
backBrush = ::CreateSolidBrush(gutterColor);
::FillRect(renderParams.hdc, &gutterRect, backBrush);
::DeleteObject(backBrush);
// draw the caption
::SetTextColor(renderParams.hdc, renderParams.foreColor);
::SetBkMode(renderParams.hdc, TRANSPARENT);
//
renderParams.rect.location.x += gutterWidth + 4;
//
font->DrawToHDC(renderParams.hdc, renderParams.rect, this->textValue);
}