Spread control repaint issue

Posted by: vikasbhutani on 4 May 2020, 5:28 pm EST

  • Posted 4 May 2020, 5:28 pm EST

    Hi Experts,

    I am using Spread control(Active x control) in my MFC (VC++) MDI application.

    In the CMyFormView:: OnInitialUpdate()
    {

    m_Spread.SetMaxCols(3);
    m_Spread.SetText(0,0,CComVariant(_T("Sr No"));
    m_Spread.SetText(1,0,CComVariant(_T("Name"));
    m_Spread.SetText(2,0,CComVariant(_T("Department"));
    m_Spread.SetText(3,0,CComVariant(_T("Salary"));
    }

    When the specified form display the contents are not align properly, but if I minimize the Form and restore it, the contents display properly.
    So I guess , it is related to some repaint o resize issue?

    I had tried the following:-
    Inavalidate()
    Refresh()
    etc , but the issue is not resolved.
  • Replied 4 May 2020, 7:23 pm EST

    Hi,

    Try with "SetReDraw" function calls :

    m_Spread.SetReDraw(FALSE);
    m_Spread.SetMaxCols(3);
    m_Spread.SetText(0,0,CComVariant(_T("Sr No"));
    m_Spread.SetText(1,0,CComVariant(_T("Name"));
    m_Spread.SetText(2,0,CComVariant(_T("Department"));
    m_Spread.SetText(3,0,CComVariant(_T("Salary"));
    m_Spread.SetReDraw(TRUE);
  • Replied 4 May 2020, 11:38 pm EST

    Hi ylaroye,

    Thanks for the quick reply, but I am still seeing no change in the behaviour?

    what is missing from my side, when I used the CListCtrl (MFC), there is no problem.

    So when I replaced the CListCtrl with Spread control, the problem is started.

    So there is something wrong while using Spread control and I am trying to rectify the same?
  • Replied 5 May 2020, 7:27 pm EST

    Hi,

    And with "SetTypeVAlign" and "SetTypeHAlign" calls?

    m_Spread.SetReDraw(FALSE);
    m_Spread.SetTypeVAlign(SS_CELL_V_ALIGN_VCENTER);
    m_Spread.SetTypeHAlign(SS_CELL_H_ALIGN_LEFT);
    m_Spread.SetMaxCols(3);
    m_Spread.SetText(0,0,CComVariant(_T("Sr No"));
    m_Spread.SetText(1,0,CComVariant(_T("Name"));
    m_Spread.SetText(2,0,CComVariant(_T("Department"));
    m_Spread.SetText(3,0,CComVariant(_T("Salary"));
    m_Spread.SetReDraw(TRUE);
  • Replied 5 May 2020, 7:59 pm EST

    Hi ylaroye,

    I felt the issue is related to Repaint the control, but you are suggesting the method for aligment of data in the spread control.

    Because when I minimize the screen and restore it , everything is coming perfect.
    So it seems the issue is not related with mis alignment of data.Because the methods suggested by you earlier i.e SetRedraw()( refresh the data),SetTypeVAlign(vertical alignement) and SetTypeHAlign(horizontal alignment) in a control.

    So, please suggest me the approach by which I can repaint the spread control, because I tried already
    Inavalidate()
    Refresh()

    But those methods won't solve my issue either.

  • Replied 6 May 2020, 9:32 pm EST

    Hi Vikas,

    I hope you are using Spread 8.0. Can you please share a small stripped down application demonstrating the problem? It would help me in forwarding the issue to the developers, if needed.

    Thanks,
    Pragati
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels