views:

1023

answers:

6

I have a WPF control, that has a list of "Investors", and in the right column of the list, a "Delete" button.

I could either waste some time making an image of an "x" in photoshop. Or, I could just use Wingdings font and set the content to "Õ" (which makes a cool looking delete button).

Is this appropriate? My thinking is... while not every font family is on every computer, I'm pretty sure that it's safe to say that if you're running my WPF Windows Forms program, then you have Wingdings.

What do you think? Please try to give statistics (not just feelings) on the matter. Should I worry about font size? etc.

+8  A: 

Honestly, if you're using WPF, it's probably just as easy to use a path to make an 'x' shape:

    <Style x:Key="DeleteButtonStyle" TargetType="{x:Type Button}">
        <Setter Property="HorizontalAlignment" Value="Stretch"/>
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalAlignment" Value="Stretch"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
        <Setter Property="Cursor" Value="Hand"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type Button}">
                    <Grid HorizontalAlignment="Center" VerticalAlignment="Center">
                        <Path Name="Circle" Data="F1 M 0 7.5 A 7.5 7.5 0 1 1 15 7.5 A 7.5 7.5 0 1 1 0 7.5"/>
                        <Path Fill="White" Data="F1 M 7.5 6 L 10.5,3 12,4.5 9,7.5 12,10.5 10.5,12 7.5,9 4.5,12 3,10.5 6,7.5 3,4.5 4.5,3 Z"/>
                    </Grid>
                    <ControlTemplate.Triggers>
                        <Trigger Property="IsMouseOver" Value="True">
                            <Setter Property="Fill" TargetName="Circle" Value="SlateGray"/>
                        </Trigger>
                        <Trigger Property="IsMouseOver" Value="False">
                            <Setter Property="Fill" TargetName="Circle" Value="DarkGray"/>
                        </Trigger>
                        <DataTrigger Binding="{Binding}" Value="{x:Null}">
                            <Setter Property="Visibility" Value="Hidden"/>
                        </DataTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ToolTip" Value="Delete This Item"/>
    </Style>

Just apply this style to a button, and you get an instant "delete" button!

Bob King
Good point that WPF allows some very cool vector stuff... but there are so many possible things in Wingdings that someone might want. Do you think that this is the way to go for all of them?(nice answer btw).
Timothy Khouri
You +up nice answers. Like I did.
Will
I really do like to do a lot in Vector graphics in WPF. It lends it self to producing clean, scalable, graphics. Fonts may or may not scale well depending on resolution, this will.
Bob King
@Bob King: TrueType fonts are specifically designed to scale well at different resolutions
Richard Ev
+2  A: 

Assuming you can display Unicode, there are plenty of glyphs in many fonts for what you're trying to do.

For example, this is a unicode character in (probably) Arial: ✖

I took the character reference from http://www1.tip.nl/~t876506/UnicodeDisplay.html but I'm sure there are better places to find out than this

Gareth
Of course, then you have to hope each client has the font, or get into font deploying (which I personally don't enjoy).
MusiGenesis
That that character shows as a little box with '2716' in it for me.
Blorgbeard
+3  A: 

Sorry, but I can't think of anything that makes an application look more amateurish than the use of wingding characters for controls.

MusiGenesis
+2  A: 

I think you should be fine, especially with WPF. I don't know if Wingdings font in particular is on every Windows machine (probably yes), but I do know characters from Marlett font are used in Win XP UI.

dbkk
Excellent answer, thank you for the point about Marlett (I didn't know that).
Timothy Khouri
A: 

I think that nice solution would be taking the glyphs you like from Wingdings, and converting them to WPF shapes, as resources of your app. This will add just a few kB to your app and you won't be dependent on Wingdings.

Tomáš Kafka
For the record, how would you go about doing that?
Mal Ross
I thought that Blend did it, according to some blog posts I read, but now that I looked, it works like this: http://msdn.microsoft.com/en-us/library/cc296385.aspx - you can embed a whole font, or just a subset that you use
Tomáš Kafka
A: 

Most of the problem is forgotting the byte size. In C# (Winform) I use: static Font wingdings2 = new Font("Wingdings 2", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(2)));

So I can :

myTextBoxt.Font = wingdings2;

imam kuncoro