Home All Groups Group Topic Archive Search About

Reversing text in TreeView nodes

Author
18 Feb 2005 12:29 PM
Allen Anderson
I haven't received an answer to my question of a few days ago regarding a
flipped treeview control posted in the dotnet.framework.windowsforms.control
newsgroup, so I thought I'd ask it again.  Sorry about the cross-posting,
but I'm getting desperate as the drop-dead date, the 25th of this month, on
my project approaches.

I'm attempting to create a TreeView similar to the one on the right-hand
side of the BizTalk Mapper screen. I'm able to create a mirror image of a
normal TreeView with everything swapped left-for-right, kind of like looking
at the reflection of the tree in a mirror; unfortunately, that everything
also includes the text for each node. Is there a way of creating a bitmap of
each visible node and performing a
Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on it prior to performing
a Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on the bitmap of the
entire tree?  Is there another way of accomplishing the same thing?

Any help would be greatly appreciated.

Author
18 Feb 2005 1:51 PM
Bob Powell [MVP]
The only way you can do this is to custom draw the whole treeview. I assume
that you're capturing an image and then flipping that. This method will
never allow you to separate the text from the graphic and selectively flip
or move depending on positions in the bitmap.

Treeviews are common controls underneath. You should be able to use the
WM_NOTIFY based custom draw messages to draw the nodes in a right-to-left
cascade.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





Show quoteHide quote
"Allen Anderson" <albr***@comcast.net> wrote in message
news:SYadnUwKFs0BQojfRVn-3Q@comcast.com...
>I haven't received an answer to my question of a few days ago regarding a
>flipped treeview control posted in the
>dotnet.framework.windowsforms.control newsgroup, so I thought I'd ask it
>again.  Sorry about the cross-posting, but I'm getting desperate as the
>drop-dead date, the 25th of this month, on my project approaches.
>
> I'm attempting to create a TreeView similar to the one on the right-hand
> side of the BizTalk Mapper screen. I'm able to create a mirror image of a
> normal TreeView with everything swapped left-for-right, kind of like
> looking at the reflection of the tree in a mirror; unfortunately, that
> everything also includes the text for each node. Is there a way of
> creating a bitmap of each visible node and performing a
> Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on it prior to
> performing a Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on the
> bitmap of the entire tree?  Is there another way of accomplishing the same
> thing?
>
> Any help would be greatly appreciated.
>
Are all your drivers up to date? click for free checkup

Author
18 Feb 2005 3:12 PM
Mick Doherty
Quick hack in VB.Net

Inherit from Treeview and add the following code:
\\\
Protected Overrides ReadOnly Property CreateParams() As CreateParams
    Get
        Dim cp As CreateParams = MyBase.CreateParams
        Const WS_EX_LAYOUTRTL As Integer = &H400000
        Const WS_EX_NOINHERITLAYOUT As Integer = &H100000
        If Me.Mirror Then
            cp.ExStyle += WS_EX_LAYOUTRTL Or WS_EX_NOINHERITLAYOUT
        End If
        Return cp
    End Get
End Property

Private m_Mirror As Boolean = False

<DefaultValue(False)> _
Public Property Mirror() As Boolean
    Get
        Return m_Mirror
    End Get
    Set(ByVal Value As Boolean)
        If m_Mirror = Value Then Return
        m_Mirror = Value
        MyBase.UpdateStyles()
    End Set
End Property
///

Show quoteHide quote
"Allen Anderson" <albr***@comcast.net> wrote in message
news:SYadnUwKFs0BQojfRVn-3Q@comcast.com...
>I haven't received an answer to my question of a few days ago regarding a
>flipped treeview control posted in the
>dotnet.framework.windowsforms.control newsgroup, so I thought I'd ask it
>again.  Sorry about the cross-posting, but I'm getting desperate as the
>drop-dead date, the 25th of this month, on my project approaches.
>
> I'm attempting to create a TreeView similar to the one on the right-hand
> side of the BizTalk Mapper screen. I'm able to create a mirror image of a
> normal TreeView with everything swapped left-for-right, kind of like
> looking at the reflection of the tree in a mirror; unfortunately, that
> everything also includes the text for each node. Is there a way of
> creating a bitmap of each visible node and performing a
> Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on it prior to
> performing a Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on the
> bitmap of the entire tree?  Is there another way of accomplishing the same
> thing?
>
> Any help would be greatly appreciated.
>
Author
18 Feb 2005 3:37 PM
Bob Powell [MVP]
Learn something new every day....

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Mick Doherty"
<EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
Show quoteHide quote
message news:%23EsrNxcFFHA.2828@TK2MSFTNGP09.phx.gbl...
> Quick hack in VB.Net
>
> Inherit from Treeview and add the following code:
> \\\
> Protected Overrides ReadOnly Property CreateParams() As CreateParams
>    Get
>        Dim cp As CreateParams = MyBase.CreateParams
>        Const WS_EX_LAYOUTRTL As Integer = &H400000
>        Const WS_EX_NOINHERITLAYOUT As Integer = &H100000
>        If Me.Mirror Then
>            cp.ExStyle += WS_EX_LAYOUTRTL Or WS_EX_NOINHERITLAYOUT
>        End If
>        Return cp
>    End Get
> End Property
>
> Private m_Mirror As Boolean = False
>
> <DefaultValue(False)> _
> Public Property Mirror() As Boolean
>    Get
>        Return m_Mirror
>    End Get
>    Set(ByVal Value As Boolean)
>        If m_Mirror = Value Then Return
>        m_Mirror = Value
>        MyBase.UpdateStyles()
>    End Set
> End Property
> ///
>
> --
> Mick Doherty
> http://dotnetrix.co.uk/nothing.html
>
>
> "Allen Anderson" <albr***@comcast.net> wrote in message
> news:SYadnUwKFs0BQojfRVn-3Q@comcast.com...
>>I haven't received an answer to my question of a few days ago regarding a
>>flipped treeview control posted in the
>>dotnet.framework.windowsforms.control newsgroup, so I thought I'd ask it
>>again.  Sorry about the cross-posting, but I'm getting desperate as the
>>drop-dead date, the 25th of this month, on my project approaches.
>>
>> I'm attempting to create a TreeView similar to the one on the right-hand
>> side of the BizTalk Mapper screen. I'm able to create a mirror image of a
>> normal TreeView with everything swapped left-for-right, kind of like
>> looking at the reflection of the tree in a mirror; unfortunately, that
>> everything also includes the text for each node. Is there a way of
>> creating a bitmap of each visible node and performing a
>> Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on it prior to
>> performing a Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on the
>> bitmap of the entire tree?  Is there another way of accomplishing the
>> same thing?
>>
>> Any help would be greatly appreciated.
>>
>
>
Author
18 Feb 2005 4:01 PM
AlBruAn
Mick and Bob,

      Both of you guys are great!  This is exactly what I needed!

Show quoteHide quote
"Bob Powell [MVP]" wrote:

> Learn something new every day....
>
> --
> Bob Powell [MVP]
> Visual C#, System.Drawing
>
> Find great Windows Forms articles in Windows Forms Tips and Tricks
> http://www.bobpowell.net/tipstricks.htm
>
> Answer those GDI+ questions with the GDI+ FAQ
> http://www.bobpowell.net/faqmain.htm
>
> All new articles provide code in C# and VB.NET.
> Subscribe to the RSS feeds provided and never miss a new article.
>
>
>
>
>
> "Mick Doherty"
> <EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> wrote in
> message news:%23EsrNxcFFHA.2828@TK2MSFTNGP09.phx.gbl...
> > Quick hack in VB.Net
> >
> > Inherit from Treeview and add the following code:
> > \\\
> > Protected Overrides ReadOnly Property CreateParams() As CreateParams
> >    Get
> >        Dim cp As CreateParams = MyBase.CreateParams
> >        Const WS_EX_LAYOUTRTL As Integer = &H400000
> >        Const WS_EX_NOINHERITLAYOUT As Integer = &H100000
> >        If Me.Mirror Then
> >            cp.ExStyle += WS_EX_LAYOUTRTL Or WS_EX_NOINHERITLAYOUT
> >        End If
> >        Return cp
> >    End Get
> > End Property
> >
> > Private m_Mirror As Boolean = False
> >
> > <DefaultValue(False)> _
> > Public Property Mirror() As Boolean
> >    Get
> >        Return m_Mirror
> >    End Get
> >    Set(ByVal Value As Boolean)
> >        If m_Mirror = Value Then Return
> >        m_Mirror = Value
> >        MyBase.UpdateStyles()
> >    End Set
> > End Property
> > ///
> >
> > --
> > Mick Doherty
> > http://dotnetrix.co.uk/nothing.html
> >
> >
> > "Allen Anderson" <albr***@comcast.net> wrote in message
> > news:SYadnUwKFs0BQojfRVn-3Q@comcast.com...
> >>I haven't received an answer to my question of a few days ago regarding a
> >>flipped treeview control posted in the
> >>dotnet.framework.windowsforms.control newsgroup, so I thought I'd ask it
> >>again.  Sorry about the cross-posting, but I'm getting desperate as the
> >>drop-dead date, the 25th of this month, on my project approaches.
> >>
> >> I'm attempting to create a TreeView similar to the one on the right-hand
> >> side of the BizTalk Mapper screen. I'm able to create a mirror image of a
> >> normal TreeView with everything swapped left-for-right, kind of like
> >> looking at the reflection of the tree in a mirror; unfortunately, that
> >> everything also includes the text for each node. Is there a way of
> >> creating a bitmap of each visible node and performing a
> >> Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on it prior to
> >> performing a Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on the
> >> bitmap of the entire tree?  Is there another way of accomplishing the
> >> same thing?
> >>
> >> Any help would be greatly appreciated.
> >>
> >
> >
>
>
>
Author
18 Feb 2005 5:57 PM
VBen
That's the cleanest, most direct and most elegant solution I've EVER seen
for a problem this potentially complicated....
Wow!!
VBen.

"Mick Doherty"
<EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]> escribió
Show quoteHide quote
en el mensaje news:#EsrNxcFFHA.2828@TK2MSFTNGP09.phx.gbl...
> Quick hack in VB.Net
>
> Inherit from Treeview and add the following code:
> \\\
> Protected Overrides ReadOnly Property CreateParams() As CreateParams
>     Get
>         Dim cp As CreateParams = MyBase.CreateParams
>         Const WS_EX_LAYOUTRTL As Integer = &H400000
>         Const WS_EX_NOINHERITLAYOUT As Integer = &H100000
>         If Me.Mirror Then
>             cp.ExStyle += WS_EX_LAYOUTRTL Or WS_EX_NOINHERITLAYOUT
>         End If
>         Return cp
>     End Get
> End Property
>
> Private m_Mirror As Boolean = False
>
> <DefaultValue(False)> _
> Public Property Mirror() As Boolean
>     Get
>         Return m_Mirror
>     End Get
>     Set(ByVal Value As Boolean)
>         If m_Mirror = Value Then Return
>         m_Mirror = Value
>         MyBase.UpdateStyles()
>     End Set
> End Property
> ///
>
> --
> Mick Doherty
> http://dotnetrix.co.uk/nothing.html
>
>
> "Allen Anderson" <albr***@comcast.net> wrote in message
> news:SYadnUwKFs0BQojfRVn-3Q@comcast.com...
> >I haven't received an answer to my question of a few days ago regarding a
> >flipped treeview control posted in the
> >dotnet.framework.windowsforms.control newsgroup, so I thought I'd ask it
> >again.  Sorry about the cross-posting, but I'm getting desperate as the
> >drop-dead date, the 25th of this month, on my project approaches.
> >
> > I'm attempting to create a TreeView similar to the one on the right-hand
> > side of the BizTalk Mapper screen. I'm able to create a mirror image of
a
> > normal TreeView with everything swapped left-for-right, kind of like
> > looking at the reflection of the tree in a mirror; unfortunately, that
> > everything also includes the text for each node. Is there a way of
> > creating a bitmap of each visible node and performing a
> > Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on it prior to
> > performing a Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on the
> > bitmap of the entire tree?  Is there another way of accomplishing the
same
> > thing?
> >
> > Any help would be greatly appreciated.
> >
>
>
Author
19 Feb 2005 10:19 PM
VBen
If anyone is interested, I tried this solution.
It's great, since it does exactly that: Draw the nodes cascade in a right to
left cascade... There's just one problem: Wether you establish
"WS_EX_NOINHERITLAYOUT" or not, the images in the treeview are drawn
mirrored, and the text is drawn correctly (I tried establishing also
WS_EX_RTLREADING with the same results).
The solution is as simple as mirroring images before loading them into the
ImageList control, but if anyone has the correct solution for that
particular problem, I'd like to know about it (just curious)...
Regards,
VBen.

Show quoteHide quote
"VBen" <bmora***@compucaremexico.com> escribió en el mensaje
news:u7UnLNeFFHA.2508@TK2MSFTNGP10.phx.gbl...
> That's the cleanest, most direct and most elegant solution I've EVER seen
> for a problem this potentially complicated....
> Wow!!
> VBen.
>
> "Mick Doherty"
> <EXCHANGE#WITH@AND.REMOVE.SQUAREBRACKETS.[mdaudi100#ntlworld.com]>
escribió
> en el mensaje news:#EsrNxcFFHA.2828@TK2MSFTNGP09.phx.gbl...
> > Quick hack in VB.Net
> >
> > Inherit from Treeview and add the following code:
> > \\\
> > Protected Overrides ReadOnly Property CreateParams() As CreateParams
> >     Get
> >         Dim cp As CreateParams = MyBase.CreateParams
> >         Const WS_EX_LAYOUTRTL As Integer = &H400000
> >         Const WS_EX_NOINHERITLAYOUT As Integer = &H100000
> >         If Me.Mirror Then
> >             cp.ExStyle += WS_EX_LAYOUTRTL Or WS_EX_NOINHERITLAYOUT
> >         End If
> >         Return cp
> >     End Get
> > End Property
> >
> > Private m_Mirror As Boolean = False
> >
> > <DefaultValue(False)> _
> > Public Property Mirror() As Boolean
> >     Get
> >         Return m_Mirror
> >     End Get
> >     Set(ByVal Value As Boolean)
> >         If m_Mirror = Value Then Return
> >         m_Mirror = Value
> >         MyBase.UpdateStyles()
> >     End Set
> > End Property
> > ///
> >
> > --
> > Mick Doherty
> > http://dotnetrix.co.uk/nothing.html
> >
> >
> > "Allen Anderson" <albr***@comcast.net> wrote in message
> > news:SYadnUwKFs0BQojfRVn-3Q@comcast.com...
> > >I haven't received an answer to my question of a few days ago regarding
a
> > >flipped treeview control posted in the
> > >dotnet.framework.windowsforms.control newsgroup, so I thought I'd ask
it
> > >again.  Sorry about the cross-posting, but I'm getting desperate as the
> > >drop-dead date, the 25th of this month, on my project approaches.
> > >
> > > I'm attempting to create a TreeView similar to the one on the
right-hand
> > > side of the BizTalk Mapper screen. I'm able to create a mirror image
of
> a
> > > normal TreeView with everything swapped left-for-right, kind of like
> > > looking at the reflection of the tree in a mirror; unfortunately, that
> > > everything also includes the text for each node. Is there a way of
> > > creating a bitmap of each visible node and performing a
> > > Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on it prior to
> > > performing a Bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX) on the
> > > bitmap of the entire tree?  Is there another way of accomplishing the
> same
> > > thing?
> > >
> > > Any help would be greatly appreciated.
> > >
> >
> >
>
>

Bookmark and Share