1.Button控件介绍
Button —ContentControl
Content
Background 背景色/图片
Foreground 前景色 文本字体 大小
2.具体案例
<Button Name="btnLogin" Content="登录" Foreground="Green" FontStretch="ExtraExpanded" BorderBrush="Red" BorderThickness="5" HorizontalAlignment="Left" Margin="61,115,0,0" VerticalAlignment="Top" Width="71" Click="BtnLogin_Click" >
<Button.Background>
<ImageBrush ImageSource="imgs/btn_bg.png" Stretch="Fill"></ImageBrush>
</Button.Background>
</Button>
private void BtnLogin_Click(object sender, RoutedEventArgs e)
{
string name = txtUName.Text.Trim();
string pwd = txtUPwd.Password.Trim();
//登录过程 。。。
MessageBox.Show("登录成功", "登录提示", MessageBoxButton.OK,MessageBoxImage.Information);
}