void CEquationEditorWindow::DrawHighlightedRect( const CRect& controlRect, bool isSelected ) { HBRUSH highlightedHBrush = ::CreateSolidBrush( /*isSelected ? bkSelectedHighlightColorref :*/ bkUnselectedHightlightColorref ); HBRUSH oldBrush = static_cast< HBRUSH >(::SelectObject( hdc, highlightedHBrush )); ::Rectangle( hdc, controlRect.Left(), controlRect.Bottom(), controlRect.Right(), controlRect.Top() ); ::SelectObject( hdc, oldBrush ); ::DeleteObject( highlightedHBrush ); }
void CFracControlModel::PlaceChildren() { CRect newRect; int middle = (rect.Right() + rect.Left()) / 2; CRect oldRect = firstChild->GetRect( ); newRect.Top() = rect.Top(); newRect.Bottom() = rect.Top() + oldRect.GetHeight(); newRect.Left() = middle - oldRect.GetWidth() / 2; newRect.Right() = middle + oldRect.GetWidth() / 2; firstChild->SetRect( newRect ); oldRect = secondChild->GetRect( ); newRect.Bottom() = rect.Bottom(); newRect.Top() = rect.Bottom() - oldRect.GetHeight(); newRect.Left() = middle - oldRect.GetWidth() / 2; newRect.Right() = middle + oldRect.GetWidth() / 2; secondChild->SetRect( newRect ); updatePolygons(); }
void CEquationEditorWindow::DrawSelectedRect( const CRect& selectedRect ) { RECT rect; rect.bottom = selectedRect.Bottom(); rect.top = selectedRect.Top(); rect.left = selectedRect.Left(); rect.right = selectedRect.Right(); HBRUSH selectedHBrush = ::CreateSolidBrush( bkSelectedColorref ); ::FillRect( hdc, &rect, selectedHBrush ); ::DeleteObject( selectedHBrush ); }
void CSystemControlModel::PlaceChildren() { CRect newRect; int currentTop = rect.Top() + 5; for (int i = 0; i < children.size(); ++i) { CRect oldRect = children[i]->GetRect(); newRect.Top() = currentTop; currentTop += oldRect.GetHeight() + 5; newRect.Bottom() = newRect.Top() + oldRect.GetHeight(); newRect.Left() = rect.Left() + 15; newRect.Right() = newRect.Left() + oldRect.GetWidth(); children[i]->SetRect(newRect); } updatePolygons(); }
void CEquationEditorWindow::DrawString( const std::wstring& text, const CRect& textRect, bool isSelected ) { RECT rect; rect.bottom = textRect.Bottom(); rect.top = textRect.Top(); rect.left = textRect.Left(); rect.right = textRect.Right(); HFONT font = getFont( textRect.GetHeight() ); HGDIOBJ oldObject = ::SelectObject( hdc, font ); if( isSelected ) { ::SetTextColor( hdc, symbolSelectedColorref ); ::SetBkColor( hdc, bkSelectedColorref ); } else { ::SetTextColor( hdc, symbolUnselectedColorref ); ::SetBkColor( hdc, bkUnselectedColorref ); } ::DrawText( hdc, text.c_str(), text.size(), &rect, DT_LEFT ); ::SelectObject( hdc, oldObject ); }
void FormatItems(items_t::iterator_t ite, LONG space, LONG offst, CPoint& pt, LONG& w) { IGuiCtl* itm = *ite; if(!itm->IsVisible()) return; CRect rc; itm->GetRect(rc); rc.MoveTo(pt); itm->SetRect(rc); if (w < rc.Right()) w = rc.Right(); pt.x += offst; pt.y = rc.Bottom() + space; // 遍历列表项 items_t::ite_list_t ite_lst = ite->Children(); items_t::ite_list_t::iterator_t ite_ite = ite_lst.Head(); for(; ite_ite != ite_lst.Tail(); ++ite_ite) FormatItems(*ite_ite, space, offst, pt, w); pt.x -= offst; }