Welcome to LEAD Support Forum Login | Register | Faq  

    LEAD Support Forum
  Resource to find answers and post technical questions about LEAD products.
Search    
   

Re: Scrolling and drawing gradient.
Started by red dy at 03-30-2006 23:23. Topic has 1 replies.

Print Search Next Thread »
  03-30-2006, 23:23
red dy is not online. Last active: 2/6/2007 9:15:07 PM red dy

Top 500 Posts
Joined on 03-04-2006
Posts 7
Scrolling and drawing gradient.

Attachment: screens.rar
Reply Quote

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.


   Report 
  03-31-2006, 7:28
red dy is not online. Last active: 2/6/2007 9:15:07 PM red dy

Top 500 Posts
Joined on 03-04-2006
Posts 7
Re: Scrolling and drawing gradient.
Reply Quote
I solve a problem.

I create HBITMAP with gradient and text. Then i use BitBlt() function to copy from memoryDC to CDC. And now gradient drawing always.
   Report 
Post
LEAD Support Fo... » Developer » Special Effects » Re: Scrolling and drawing gradient.

Powered by Community Server, by Telligent Systems