Nicolas Mossmann
Nicolas Mossmann

Reputation: 75

How to disable Visual Style on tooltip C#

How can I disable the visual style only for the tooltip, not for all the application, because if I do so it will change my toolstrip visual style and it will look ugly?

What I have:

stupid tooltip

What I want:

better tooltip

For some reason it just won't work. Thanks everybody.

Upvotes: 0

Views: 568

Answers (2)

Dan Busha
Dan Busha

Reputation: 3803

If you're looking for a WPF solution you'll want to override the default template for the ToolTip. Mark Hall's answer is correct if you're looking for a WinForms solution.

Update: Posted this before the comment was added and the question was re-tagged as WinForms. I leave it here for anyone looking for a WPF solution.

XAML:

<ToolTip>
    <ToolTip.Style>
        <Style TargetType="{x:Type ToolTip}">
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border Background="LightGoldenrodYellow" BorderBrush="DimGray" BorderThickness=".5" Padding="5">
                            <TextBlock Text="This is text"/>
                        </Border>
                    </ControlTemplate>                                  
                </Setter.Value>
            </Setter>
        </Style>
    </ToolTip.Style>
</ToolTip>

Upvotes: 0

Mark Hall
Mark Hall

Reputation: 54532

I believe you are going to want to look into using the Tooltip.OwnerDraw Property. The example program in the MSDN Link has a style like what you are wanting.

Upvotes: 2

Related Questions