mercredi 22 juin 2016

Error in changing of direction of listcntrl in mfc


I have a problem that I have a form which includes three pages (or forms), two pages are Persian in RTL direction and one of them is LTR. I set my parent form in RTL mode like this:

if (Create( CWnd::FromHandle(hWndParent),
        WS_SYSMENU | WS_POPUP | WS_CAPTION | DS_MODALFRAME | WS_VISIBLE    | DS_CONTEXTHELP ,
        WS_EX_LAYOUTRTL | WS_EX_CONTROLPARENT | WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME ) == 0 )
        return IDCANCEL;

And all of my pages turn into the RTL mode. In that English page I have a listcntrl that have to be in LTR mode, so I write this code in the English page class:

LONG lStyle = ::GetWindowLong(GetDlgItem(IDC_LST_ITEMS)->m_hWnd,GWL_EXSTYLE);
lStyle &= ~WS_EX_LAYOUTRTL;
::SetWindowLong(GetDlgItem(IDC_LST_ITEMS)->m_hWnd, GWL_EXSTYLE, lStyle);

Actually all the items included in my list control change to LTR, but my header and column are RTL.

How can I fix this problem?

Enter image description here


Aucun commentaire:

Enregistrer un commentaire