Acessing actual ToolWindow in TabStripRenderer

Docking/MDI for Windows Forms Forum

Posted 12 years ago by Ernesto Serrano - Software Developer, VyS Yecla S.L.
Version: 2.0.0073
Avatar
Here is mi inherited TabStripRenderer class code, but now, how can I get the actual ToolWindow object? I have my own inherited ToolWindow and I want to set a property TabColor to set this the ToolWindow tab color.

In some cases there are painting errors on my window if I have two or more tabs with different colors, but if I close the different color tabs the painting errors dissapears, is there any reason?

Thanks!

Imports ActiproSoftware.Drawing
Imports ActiproSoftware.UIStudio.TabStrip
Imports System.Drawing

Public Class RendererGrupo
    Inherits Office2003DocumentWindowTabStripRenderer

    Public Overrides Sub DrawTabStripTab(ByVal e As System.Windows.Forms.PaintEventArgs, ByVal bounds As Rectangle, ByVal tabStripTab As TabStripTab)

        Dim color1 As Color = SystemColors.ControlLight
        Dim color2 As Color = SystemColors.ControlLightLight

        If tabStripTab.TabStripPage.Text.Contains("test") Then
            color2 = Color.LightGreen
        End If

        'I wan't to access the toolwindow here, but I only have the tabStripTab.TabStripPage.Text, any other method?
        'If tabStripTab.TabStripPage.Tag IsNot Nothing Then
        '    color2 = DirectCast(tabStripTab.TabStripPage.Tag, Color)
        'End If

        DirectCast(Me.TabStripTabSelectedBackgroundFill, SolidColorBackgroundFill).Color = color2
        DirectCast(Me.TabStripTabUnselectedBackgroundFill, TwoColorLinearGradient).StartColor = color1
        DirectCast(Me.TabStripTabUnselectedBackgroundFill, TwoColorLinearGradient).EndColor = color2

        MyBase.DrawTabStripTab(e, bounds, tabStripTab)
    End Sub

End Class

[Modified at 10/25/2006 04:28 AM]

Comments (2)

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Hi Ernesto,

The ToolWindow object should be the only child of the TabStripPage and should be Dock.Fill in it.

It should be painting ok, but if you are seeing differently then could you ZIP up a small test project that shows the problem and email it over? Thanks!


Actipro Software Support

Posted 12 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar
Ok for the rendering issue, the problem is that you are setting those background fill properties. There is a feature of the renderers here that is normally desirable but is causing a problem for you in this case. Namely, when you set any of those properties, it triggers a new layout/paint on the TabStrip. So you are essentially entering an infinite recursion since your paint override is triggering another paint.

I think the easiest way to handle this is for you to simply email us and let us know which renderer you would like and we can supply you with the source code for that particular method. Then you can change it to use your custom background fill instead of the default one. That will eliminate the recursion issue.


Actipro Software Support

The latest build of this product (v2018.1 build 0341) was released 3 months ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.