CFormView Class with Custom Background Color

CColorFormView is derived from CFormView with custom background color.

How to use CColorFormView class in your project?

1)Derive your form view class from CColorFormView class. For example:
class CMyFormView : public CColorFormView
2)Change form view background color: You can specify background color in your form view's OnInitialUpdate():

void CMyFormViewView::OnInitialUpdate() 
{
 SetWindowText(_T("This is my formview"));

 CColorFormView::OnInitialUpdate();

 // set color to your form view
 SetBackgroundColor(RGB(0, 128, 0));	

 // make the parent frame fit the form template
 GetParentFrame()->RecalcLayout();
 ResizeParentToFit();
}
I hope you enjoy this little class.

Download demo project - 31 KB

Download source - 2 KB



Comments

  • monster beats hodetelefoner utmerket kvalitet som oversteg

    Posted by mantouhmmm on 06/04/2013 05:29pm

    [url=http://www.beatsbydrestudio.moonfruit.com/]beats by dre norge[/url] and what not. That way you can target your marketing to the specific people that are interested in hiphop music. I'm not saying it's the only way of course, there are a lot of forums out there waiting for you to sign up to.Forums are a good place to promote yourself but you have to do it exactly right so people won't confuse you to a spammer. Don't sign up to forum just because you want more fans. Do it to stay up-to-date on everything that is happening in the industry and in the side you might get some more listeners, fans and even friends. Build connections and it will serve you well for a long time. Connections are the main thing in the music industry.So go and join forums, be active. When you have build an foundation then start promoting your underground beats, hiphop beats and whatever you do.Though the past few years the internet world has changed rapidly. Internet speeds have increased and the audience and market is increasing like crazy. [url=http://www.beatshodetelefoner.webstarts.com/]beats by dre studio[/url] Once du har lastet ned flere beats, og du er fornøyd med beats som du har lastet ned. Da er det tid kompilere og polere opp på beats når beats er godt arrangert, og lyden er god, og du har spilt den om og om igjen, og du er fornøyd med det endelige produktet så er du god til å go.Once dine beats er klar så er det på tide å dele dine sluttprodukter med venner og familie. Det er også anledning til å lansere deg som en rap artist gjennom å tilby gratis rap beats og selge rap musikk på nettet. Dette gjelder også andre sjangere av musikk som du oppretter gjennom gratis online beats nedlasting. [url=http://www.monsternobeats.350.com/]monster beats[/url] Beats by Dre justbeats er virkelig en ny spiller i kampanjen, men dette er ikke en hodetelefon ekspert. Alle andre produkter set-top-boks media player, bærbar harddisk, og kan være tilbehør. Tapte de to første fasene av designprosessen, med de fleste av de viktigste designelementer fra å slå billig beats utløp Zorro on-ear hodetelefoner. Posisjonering og eleganse av puten, har Matt og glatt hybrid belegg, klappemekanismen, bredden fra de flyttbare kabler og skaut gjenværende Dr. Dre-merket i hodetelefonene. Implementering av Beats by Dre justbeats

    Reply
  • Jordan shoes mentioned Gene to go for the manufacturer, a disunion of Nike

    Posted by TaddyGaffic on 04/24/2013 01:58pm

    Where did that get us? A bunch of banks writing loans that they didnt care if poeple would be able to pay for because they were conforming [url=http://markwarren.org.uk/property-waet.cfm]nike air max 90[/url] loans and Fannie and Freddie would back them. And their $150+ billion losses show that they are just as unable to predict or control the market as the rest of us. It won't work because it doesn't reward investors for taking the risks involved. In order to set a good example of following your dreams, you may wish to consider strictly limiting, or eliminating TV from your life. When people are involved in pursuing their dreams they often find that they do not have the time to watch TV. TV just gets in the way of pursuing other dreams.. Take a limousine ride with Aerosmith on one of the fastest rollercoaster you have to face. Live shows throughout the day from Beauty and the Beast [url=http://markwarren.org.uk/property-waet.cfm]air max 90 uk[/url] will bring memories flooding back for young and old. You can get closer to the action and feel that he wanted to be in the spotlight. Other technology advancements are the midsole. It has a compression molded EVA for lasting impact protection. A Vibrakill shock-absorber in the heel provides a lot of [url=http://markwarren.org.uk/property-waet.cfm]air max 90[/url] comfort, and the Exact Pro technology combines a pebax plate and a Dynamic camflex in the forefoot for improved energy return on every step. Meindl Borneo Lady Pro - This shoe is just one of my wifes most popular hiking boots. It is appropriate for lengthy outdoor hikes and you can actually do a tiny stretch of hill hiking whilst sporting them. This product also includes memory foam

    Reply
  • New one

    Posted by snareenactina on 11/10/2012 06:17pm

    freehttp PRINCETON, NJ -- The Gallup Economic Confidence Index was negative in all 50 states in the first half of 2012, but positive in the District of Columbia. West Virginia was by far the most negative, at -44. Minnesota edged out South Dakota and Maryland as the least negative state in the U.S., with an index score of -6, while the residents of the District of Columbia were solidly positive, at +29. I disagree with him about the “family unification” thing but I do, also, respect that from a position of humanity. UNFORTUNATELy, it’s a process that is widely abused by both legal and illegal immigrants because they bring in dependent young, old and affirmed otherwise and the taxpayers again get higher dependency roles because of that. In some jurisdictions, collectors may legally keep antique weapons made incapable of being readily restored to a firing condition. santo Some record to run on which is why he runs from it and why so many want govt to rein in spending because this nation can only afford so much and the path that Obama has us on will result in far more destruction. materialist Finance has long reigned supreme in business school, but sales is starting to gain ground abil With the health care tab for last year coming to $2.5 trillion, health care spending now represents 17.3 percent of the nation’s gross domestic product — a 1.1 percent bigger portion of the nation’s economy than in 2008. minks Chart range: archivists And how horrible a situation it is, to have so many of our lives dependent on the very system that is poisoning our bodies and destroying our homes. What can we do, when many of us have as our only life support jobs that depend on, and make possible, this destruction? absorbent Copyright 2012 Dow Jones & Company, Inc. All Rights Reserved tracksran We can help you produce materials to make your business grow. Signs, banners, and more attract customers' attention and communicate your message effectively.

    Reply
  • Maximize form

    Posted by Legacy on 07/16/2002 12:00am

    Originally posted by: alenbabu

    How can I maximize the size of a CFormView in order to it takes all the place of the parent frame.
    
    I have used

    CColorFormView::OnInitialUpdate();
    SetBackgroundColor(RGB(256, 0, 255));
    GetParentFrame()->RecalcLayout();
    ResizeParentToFit();

    But that didn't help

    Also I want to change the background color of my
    already existing application which is basically
    View class with two formViews on it.
    But I get error message

    error C2065: 'IDD_MANAGEMENT_FORM' : didn't
    declared
    error C2057: A constant expression expected
    error C2065: 'IDD_PROCESSCONTROL_FORM' : didn't
    declared
    error C2057: A constant expression expected
    What is wrong. I have added the header file of each form
    in the ColorFormView.cpp file

    Can you please help me

    Reply
  • How can I paint the bgcolor in WIN CE 3.0?

    Posted by Legacy on 01/18/2002 12:00am

    Originally posted by: kang ilkoo

    In win ce 3.0 MFC , there is no SetBackgroundColor method...

    Reply
  • Bestway to paint the background colo

    Posted by Legacy on 11/12/2001 12:00am

    Originally posted by: Pat Tharmarajah

    Do
    
    

    the following in your MFC CFormView class

    HBRUSH CFormView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
    HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
    // you can choose any color
    return(::CreateSolidBrush(RGB(77,0,77)));


    }

    • Danger code

      Posted by zjkg on 03/23/2014 02:14am

      The code, return(::CreateSolidBrush(RGB(77,0,77))); is critically dangerous. RESOURCE LEAK will be occured and your application will crash after many repaintings. ::DeleteObject() must be called but can't be called.

      Reply
    Reply
  • Bestway to paint the background colo

    Posted by Legacy on 11/12/2001 12:00am

    Originally posted by: Pat Tharmarajah

    Do

    the following in your MFC CFormView class

    HBRUSH CFormView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {
    HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
    // you can choos any color
    return(::CreateSolidBrush(RGB(77,0,77)));

    // TODO: Return a different brush if the default is not desired
    return hbr;
    }

    Reply
  • Simple Formview BG Color

    Posted by Legacy on 08/14/2001 12:00am

    Originally posted by: Mark Clouden

    How about....
    
    

    Works for me, no painting, no erasebackground, nothing else to it.

    HBRUSH
    xMyFormView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
    {

    pDC->SetTextColor(::GetSysColor(COLOR_WINDOWTEXT));
    return(::GetSysColorBrush(COLOR_WINDOW));
    }

    Reply
  • how to do the First step??I dun get it....

    Posted by Legacy on 03/25/2001 12:00am

    Originally posted by: stephen

    is that actually put "class CMyFormView : public CColorFormView" in the View header file or what..

    i dun know how to derive my form view class from CColorFormView class!!~~thank you

    Reply
  • Problem with EditView

    Posted by Legacy on 01/28/2001 12:00am

    Originally posted by: Rajasekhar

    Hello!

    I am developing an application in eVC 3.0 using document/view architecture.My main view is CView.It's working fine.I have one more screen with base calss as CEditView.It's working fine to write something and to save.But when i tried to open a file, after selecting the file name, this view getting disappeared and the main view is coming up.How to keep the CEditView as the top view until i want.I am not implementing the Open Dialog functionality.

    I have a from with CFormView as the base class.I don't want the default scroll bars.How to remove them.

    When i implemented the Open Dialog functionality it's not showing the files available in a directory.What might be the problem?

    Please help me in this regard.

    Please send mail to chavasekhar@rediffmail.com

    Thanking you,

    Rajasekhar

    Reply
  • Loading, Please Wait ...

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • On-demand Event Event Date: September 10, 2014 Modern mobile applications connect systems-of-engagement (mobile apps) with systems-of-record (traditional IT) to deliver new and innovative business value. But the lifecycle for development of mobile apps is also new and different. Emerging trends in mobile development call for faster delivery of incremental features, coupled with feedback from the users of the app "in the wild." This loop of continuous delivery and continuous feedback is how the best mobile …

  • Packaged application development teams frequently operate with limited testing environments due to time and labor constraints. By virtualizing the entire application stack, packaged application development teams can deliver business results faster, at higher quality, and with lower risk.

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds