CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Guest

    Colored Rectangles

    Hi,

    I want to have a rectangle object within a CFormView that allows me to change its color at runtime. Which control should I use and how can I have it change its color?

    Who can help?

    Jens

    [email protected]



  2. #2
    Join Date
    May 1999
    Posts
    25

    Re: Colored Rectangles

    I would create an invisible frame and then do:
    (not proper coding but just to give you the idea)

    1. Create a brush of the color you would like.
    2. Do a GetDlgItem(IDC_FRAMENAME)->GetWindowRect(CRect variable); on that frame in the OnPaint() function.
    3. Do a ScreenToClient on that rect
    4. Do Rectangle(CRectVar.left,CRectVar.top,CRectVar.right,CRectVar.bottom)


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured