How to change the background color in the vc6 and SDI views

Source: Internet
Author: User

Not very fashionable, still using vc6, boring to write ............

You can change the background color in the SDI view in two steps. The effect is still very good.

First, add the color to the ondraw of the cxxview class.

 

 

Void cdigimizerview: ondraw (CDC * PDC)

{

Cdigimizerdoc * pdoc = getdocument ();

Assert_valid (pdoc );

Crect rect;

Getclientrect (rect );

Colorref rcolor = getsyscolor (color_3dface); // color_btnface

PDC-> fillsolidrect (rect, rcolor );

// Todo: Add draw code for native data here

 

}

 

 

But when the window size is changed, the background color looks like a flash,

The cxxview Class responds to the wm_erasebkgnd message and comment out the generated return cview: onerasebkgnd (PDC); that is, do not call the onerasebkgnd () function of cview and return true directly. as shown below.

 

 

 

Bool cdigimizerview: onerasebkgnd (CDC */* PDC */)

{

// Return cview: onerasebkgnd (PDC );

Return true;

}

 

 

PS: the code is written in one piece.

 

Bool cdigimizerview: onerasebkgnd (CDC * PDC)
{
// Return cview: onerasebkgnd (PDC );
Crect rect;
Getclientrect (& rect );
PDC-> fillsolidrect (& rect,: getsyscolor (color_appworkspace); // color_btnface
Return true;
}

 

 

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.