|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Reversing text in TreeView nodesI 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. 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. -- Show quoteHide quoteBob 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. "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. > 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. > Learn something new every day....
-- Show quoteHide quoteBob 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. >> > > 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. > >> > > > > > > > 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. > > > > 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. > > > > > > > > >
Other interesting topics
Reading Text datatype into a byte Array
Strange behaviour with .NET apps with Framework 2.0 Deserialization constructor Exception with HttpWebRequest.GetResponse Writing a windows service with a socket interface. Dynamicly refrence a .NET DLL State of Objects... limits for filestreams (C#) Command to terminate execution Getting things into an array of bytes |
|||||||||||||||||||||||