|
I have a problem with gradient. I own draw items (like extended thumbnails) and i draw text in gradient rectangles. My be situation when all items not placed in view and use a scroll. When items a scrolled new displayed items looks without gradient, instead white backgournd. I placed several screenshots (screens.rar). See screenshot 1 and 2.
This code on OnDraw():
OnDraw(CDC * pDC) { for (int i = 0; i < uSize; ++i) { // uSize number of items L_EfxDrawFrame ( pDC->GetSafeHdc(), m_border_rect[i], // calculate border_rect before drawing EFX_FRAME_ADJUST_RECT, 2, mycolor, 2, mycolor, mycolor, 2, mycolor, mycolor); CFont font;
font.CreatePointFont(100, "Arial", pDC); L_EfxGradientFillRect( pDC->GetSafeHdc(),
m_text_rect[i], // text_rect calculate before drawing too EFX_GRADIENT_LINE_T_TO_B, mycolor, mycolor, TEXT_HEIGHT ); //text height = 20 UINT flag=EFX_TEXT_HCENTER|EFX_TEXT_VCENTER; L_EfxDraw3dText(pDC->GetSafeHdc(),
(char*)m_name[i].c_str(), m_text_rect[i], flag, 0, 0, mycolor, 0, RGB(255,255,255), font, NULL); } } This code i use to ScrollBy():
BOOL CCmprView::OnScrollBy(CSize sizeScroll, BOOL bDoScroll)
{ BOOL res = CScrollView::OnScrollBy(sizeScroll, bDoScroll); SCROLL_OFFSET = GetScrollPosition().y; for (int i = 0; i < uSize; ++i) OffsetRect(i); // calculate offset of border_rect and text_rect to them redraw. // i use different rects for hold coordinats // m_..._rect - using in OnDraw function // m_..._rect2 - using in redraw functions // OffsetRect() change only m_..._rect2 arrays. return res; }
Why this happen ?
Screenshot overview:
1) After load images. Gradient is draw. All ok. 2) After scroll. New displayed items look without gradient. Why? PS. Soory for my bad english. I hope for your help and support.
|