XP style Property page - Programmer

This is a discussion on XP style Property page - Programmer ; Hi ... I wrote a dialog-based MFC C++ application with property sheet and several property pages appearing as tab pages. I'm using VS 6.0 in Windows 2000 platform. I wish to customize the property pages with XP style (white background ...

+ Reply to Thread
Results 1 to 2 of 2

Thread: XP style Property page

  1. XP style Property page

    Hi ...

    I wrote a dialog-based MFC C++ application with property sheet and
    several property pages appearing as tab pages. I'm using VS 6.0 in
    Windows 2000 platform.

    I wish to customize the property pages with XP style (white background
    and white caption bar) to be added to the property sheet. But, I could
    not find a generic way to do this. I have tried to play around with
    the OnEraseBkgnd method but I find a problem with the static control
    and caption bar whose background cannot merge with the gradient color
    that I specifed.

    Following is the code that I used in OnEraseBkgnd:

    BOOL CTuningPanel::OnEraseBkgnd(CDC* pDC)
    {
    // TODO: Add your message handler code here and/or call default
    //CPropertyPage::OnEraseBkgnd(pDC);

    static int r1 = 252, g1 = 252, b1 = 254; //Any start color
    static int r2 = 244, g2 = 243, b2 = 238; //Any stop color

    CRect rect;
    GetClientRect(&rect);

    for (int i = 0; i < rect.Height(); i++) {
    int r = r1 + (i * (r2 - r1) / rect.Height());
    int g = g1 + (i * (g2 - g1) / rect.Height());
    int b = b1 + (i * (b2 - b1) / rect.Height());
    pDC->FillSolidRect(0, i, rect.Width(), 1, RGB(r,g,b));
    }
    pDC->SetBkMode(TRANSPARENT);

    return TRUE;
    }

    Is there a easy way to convert the style of the property page? Thanks
    in advance for the earliest reply.

    Regards

    Richard J.O

  2. Re: XP style Property page

    "Richard J.O" skrev i en meddelelse
    news:192e82a8.0402142009.3fb71cfe@posting.google.c om...
    > Hi ...
    >
    > I wrote a dialog-based MFC C++ application with property sheet and
    > several property pages appearing as tab pages. I'm using VS 6.0 in
    > Windows 2000 platform.
    >
    > I wish to customize the property pages with XP style (white background
    > and white caption bar) to be added to the property sheet. But, I could
    > not find a generic way to do this. I have tried to play around with
    > the OnEraseBkgnd method but I find a problem with the static control
    > and caption bar whose background cannot merge with the gradient color
    > that I specifed.
    >
    > Following is the code that I used in OnEraseBkgnd:
    >
    > BOOL CTuningPanel::OnEraseBkgnd(CDC* pDC)
    > {
    > // TODO: Add your message handler code here and/or call default
    > //CPropertyPage::OnEraseBkgnd(pDC);
    >
    > static int r1 = 252, g1 = 252, b1 = 254; //Any start color
    > static int r2 = 244, g2 = 243, b2 = 238; //Any stop color
    >
    > CRect rect;
    > GetClientRect(&rect);
    >
    > for (int i = 0; i < rect.Height(); i++) {
    > int r = r1 + (i * (r2 - r1) / rect.Height());
    > int g = g1 + (i * (g2 - g1) / rect.Height());
    > int b = b1 + (i * (b2 - b1) / rect.Height());
    > pDC->FillSolidRect(0, i, rect.Width(), 1, RGB(r,g,b));
    > }
    > pDC->SetBkMode(TRANSPARENT);
    >
    > return TRUE;
    > }
    >
    > Is there a easy way to convert the style of the property page? Thanks
    > in advance for the earliest reply.
    >
    > Regards
    >
    > Richard J.O


    You should not handle all the drawing yourself. Look for manifest in the
    docs.
    In short, what you do is add a manifest file to your project. A manifest
    file is an XML file, which you can cut and paste from the docs. You can add
    the manifest file either as a file or as a resource. I have done it as a
    resource, and it's not very difficult.

    --
    Bjarne Nielsen



+ Reply to Thread