Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Subclassing ActiveX control

Subclassing ActiveX control

Scheduled Pinned Locked Moved C / C++ / MFC
questioncomhelp
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alton Williams
    wrote on last edited by
    #1

    I'm Creating an ActiveX subclassing "EDIT". I would like it to be able to change the colour of the background, text or indeed both. I've added the BackColor and ForeColor as Stock implementation. I've changed below:

    BEGIN_PROPPAGEIDS(CEditTestCtrl, 1)
    	PROPPAGEID(CEditTestPropPage::guid)
    END_PROPPAGEIDS(CEditTestCtrl)
    

    to

    BEGIN_PROPPAGEIDS(CEditTestCtrl, 2)
    	PROPPAGEID(CEditTestPropPage::guid)
    	PROPPAGEID(CLSID_CColorPropPage)
    END_PROPPAGEIDS(CEditTestCtrl)
    

    I've also modified the OnDraw method to;

    void CEditTestCtrl::OnDraw(
    			CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
    {
    	DoSuperclassPaint(pdc, rcBounds);
    	//added
    	pdc->FillRect(&rcBounds, &CBrush(TranslateColor(GetBackColor())));
    }
    

    The Bakground colour changes. The problem lies when enter text in the control, the control reverts back to the orignal colour. The question is what is the correct way in achieving this?:confused::confused: -- modified at 16:03 Tuesday 14th March, 2006

    M N 2 Replies Last reply
    0
    • A Alton Williams

      I'm Creating an ActiveX subclassing "EDIT". I would like it to be able to change the colour of the background, text or indeed both. I've added the BackColor and ForeColor as Stock implementation. I've changed below:

      BEGIN_PROPPAGEIDS(CEditTestCtrl, 1)
      	PROPPAGEID(CEditTestPropPage::guid)
      END_PROPPAGEIDS(CEditTestCtrl)
      

      to

      BEGIN_PROPPAGEIDS(CEditTestCtrl, 2)
      	PROPPAGEID(CEditTestPropPage::guid)
      	PROPPAGEID(CLSID_CColorPropPage)
      END_PROPPAGEIDS(CEditTestCtrl)
      

      I've also modified the OnDraw method to;

      void CEditTestCtrl::OnDraw(
      			CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
      {
      	DoSuperclassPaint(pdc, rcBounds);
      	//added
      	pdc->FillRect(&rcBounds, &CBrush(TranslateColor(GetBackColor())));
      }
      

      The Bakground colour changes. The problem lies when enter text in the control, the control reverts back to the orignal colour. The question is what is the correct way in achieving this?:confused::confused: -- modified at 16:03 Tuesday 14th March, 2006

      M Offline
      M Offline
      Muhammad Azam
      wrote on last edited by
      #2

      Hello Alton Williams, I don't have answer to your question but i just want to know why are you doing this through ActiveX control. I mean you can change the background and text color of standard Edit control by Handling WM_CTLCOLOR Message. Is ActiveX your requirement? Muhammad Azam

      A 1 Reply Last reply
      0
      • M Muhammad Azam

        Hello Alton Williams, I don't have answer to your question but i just want to know why are you doing this through ActiveX control. I mean you can change the background and text color of standard Edit control by Handling WM_CTLCOLOR Message. Is ActiveX your requirement? Muhammad Azam

        A Offline
        A Offline
        Alton Williams
        wrote on last edited by
        #3

        Muhammad Azam wrote:

        but i just want to know why are you doing this through ActiveX control

        Answer this is a component of my result.

        Muhammad Azam wrote:

        I mean you can change the background and text color of standard Edit control by Handling WM_CTLCOLOR Message.

        I know that I want to able to have the result on VB, Delphi, VC++ ect.

        1 Reply Last reply
        0
        • A Alton Williams

          I'm Creating an ActiveX subclassing "EDIT". I would like it to be able to change the colour of the background, text or indeed both. I've added the BackColor and ForeColor as Stock implementation. I've changed below:

          BEGIN_PROPPAGEIDS(CEditTestCtrl, 1)
          	PROPPAGEID(CEditTestPropPage::guid)
          END_PROPPAGEIDS(CEditTestCtrl)
          

          to

          BEGIN_PROPPAGEIDS(CEditTestCtrl, 2)
          	PROPPAGEID(CEditTestPropPage::guid)
          	PROPPAGEID(CLSID_CColorPropPage)
          END_PROPPAGEIDS(CEditTestCtrl)
          

          I've also modified the OnDraw method to;

          void CEditTestCtrl::OnDraw(
          			CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid)
          {
          	DoSuperclassPaint(pdc, rcBounds);
          	//added
          	pdc->FillRect(&rcBounds, &CBrush(TranslateColor(GetBackColor())));
          }
          

          The Bakground colour changes. The problem lies when enter text in the control, the control reverts back to the orignal colour. The question is what is the correct way in achieving this?:confused::confused: -- modified at 16:03 Tuesday 14th March, 2006

          N Offline
          N Offline
          Nibu babu thomas
          wrote on last edited by
          #4

          Alton Williams wrote:

          void CEditTestCtrl::OnDraw(CDC* pdc, const CRect& rcBounds, const CRect& cInvalid) { DoSuperclassPaint(pdc, rcBounds); //added pdc->FillRect(&rcBounds, &CBrush(TranslateColor(GetBackColor()))); }

          Use pdc->SetBkMode(TRANSPARENT) to make text background transparent.


          Nibu thomas Software Developer

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups