How to create a trackbar without background or with a transparent background?

37 views Asked by At

I have create my trackbar.Although it blinks when moving the thumb,it barely can be used.Now the problem is I don't know how to change the background color of trackbar.it follows its parent's color but I want it be transparent so that I can see the picture below it.

I know why it blinks because I don't know how to tell system I expanded my thumb rect,I can just redraw the component after moving the thumb.

here is my code to draw the thumb.

if(lpDraw->dwItemSpec == TBCD_THUMB)
{
    if(Orientation != trVertical)
    {
        drct.Left += -5;
        drct.Right += 5;
        ::Graphics::TBitmap *bmp = new ::Graphics::TBitmap;
        bmp->Transparent = true;
        //bmp->LoadFromFile("UI\\slider2.bmp");
        bmp->LoadFromFile(buff + "\\UI\\slider2.bmp");
        m_pCanvas->CopyRect(drct,bmp->Canvas, TRect(0,0,bmp->Width,bmp->Height));
        delete bmp;
        Invalidate();
    }
    else
    {
        drct.bottom += 5;
        drct.top += -5;
        ::Graphics::TBitmap *bmp= new ::Graphics::TBitmap;
        bmp->Transparent = true;
        //bmp->LoadFromFile("UI\\slider.bmp");
        bmp->LoadFromFile(buff + "\\UI\\slider.bmp");
        m_pCanvas->CopyRect(drct, bmp->Canvas, TRect(0,0,bmp->Width,bmp->Height));
        delete bmp;
        Invalidate();
    }

}

the more important problem is the background.it will block the image under it

I want to know how or when to draw the background.In which DrawStage?or which ItemSpec?

0

There are 0 answers