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. OnDrawItem / OnPaint problem...

OnDrawItem / OnPaint problem...

Scheduled Pinned Locked Moved C / C++ / MFC
helpcomlearning
1 Posts 1 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.
  • C Offline
    C Offline
    Catherine
    wrote on last edited by
    #1

    Hi, I've been able to create an activeX control and to change its background color and font using OnDrawItem. Now my problem is that everytime I put this activeX in a composite control and then use this composite control as an ActiveX over the Internet, I can see everything being drawn and disappear... First I just implemented the OnPaint function in the composite control with just 'return 0' in it -> my activeX control shows up, the onSize function works great, but of course, if I switch from a window to another one, the activeX control disappears and is not refreshed... Here is some code: From the activeX: BEGIN_MSG_MAP(CSRAxControl) MESSAGE_HANDLER(WM_CREATE, OnCreate) MESSAGE_HANDLER(WM_SETFOCUS, OnSetFocus) MESSAGE_HANDLER(WM_DRAWITEM, OnDrawItem) CHAIN_MSG_MAP(CComControl) ALT_MSG_MAP(1) END_MSG_MAP() From the composite control: LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { _axViewControl.SetFocus(); return 0; } LRESULT CIdefixView::OnInitDialog(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled){ HRESULT hresult=0; CLSID clsid; CWindow hwndParent = NULL; hwndParent = GetParent(); CComPtr myIDispatchView; CComBSTR progID = OLESTR("Ctrls.SRAxControl"); hresult = CLSIDFromProgID(progID, &clsid) ; if (SUCCEEDED(hresult)){ hresult = CoCreateInstance(clsid, 0, CLSCTX_ALL, IID_IDispatch, (void**)&myIDispatchView); if(SUCCEEDED(hresult)) { _axViewControl.Attach(GetDlgItem(IDC_VIEW)); _axViewControl.ModifyStyle( NULL, WS_CLIPSIBLINGS, SWP_SHOWWINDOW ); hresult=_axViewControl.AttachControl(myIDispatchView, NULL); _pViewControl = myIDispatchView; RECT rc; hwndParent.GetClientRect(&rc); _axViewControl.MoveWindow( 0, 0, rc.right - rc.left, 26, TRUE ); } } return S_OK; } Please Help !! Thanks, Catherine.

    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