a problem in mirrored listview

I've faced a strange problem in the ListView control when I mirror it to support the right-to-left layout. I am talking about .NET 1.1. When a ListView control is mirrored, ListViewItems do the mirroring, but ClomnHeader controls do not, i.e. it keeps to display as left-to-right.
Here is an example of what I've described,

http://www.elc4sa.com/mr.gif

Any ideas 


Answer this question

a problem in mirrored listview

  • Mike Fang

    i implimented a mirrored listview below (note the commented text):

    -------------------------------------------------------------------------------

        Public Class MirroredListView
            Inherits System.Windows.Forms.ListView

            Protected Overrides ReadOnly Property CreateParams() As System.Windows.Forms.CreateParams
                Get
                    Const WS_EX_LAYOUTRTL As Integer = &H400000
                    'Const WS_EX_NOINHERITLAYOUT As Integer = &H100000
                    Dim cp As CreateParams = MyBase.CreateParams

                    If Me.RightToLeft = RightToLeft.Yes Then cp.ExStyle += WS_EX_LAYOUTRTL 'Or WS_EX_NOINHERITLAYOUT

                    Return cp
                End Get
            End Property

            Protected Overrides Sub OnRightToLeftChanged(ByVal e As System.EventArgs)
                MyBase.OnRightToLeftChanged(EventArgs.Empty)
                MyBase.UpdateStyles()
            End Sub
        End Class

    -------------------------------------------------------------------------------

    The only problem with that code is that only the 1st column is right aligned. Notice that the property is actually HorizontalAlignment.Left, but with RightToLeft set to Yes left becomes right.
    A workaround for this problem is to change the other columns' alignment in the Load event. Maybe you will come up with a nicer solution...

    Good luck!

  • Chin Tian

    I've searched through the web for such a problem but I've found nothing. It seems I am making a mistake, if so, I am awaiting for anyone telling me what I might be doing wrong.

    I've tried mirroring the ColumnHeader but it didn't work.

    I am really appreciating any effort.

  • a problem in mirrored listview