一:为grid设置背景图片
<Grid x:Name="LayoutRoot" Width="900" Height="600">
<Grid.Background>
<ImageBrush ImageSource="Image/game-ddz_bg.png" Stretch="Fill"></ImageBrush>
</Grid.Background>
</Grid>
二:后台设置控件的margin
image.Margin = new Thickness(0, 90, 0, 0);
三:后台添加图片子控件
ImageSource imageSource = new BitmapImage(new Uri("Image/faceDown.png", UriKind.RelativeOrAbsolute));
image.Source = imageSource;
_sp.Children.Add(image);
四:后台为grid设置背景图片
LayoutRoot.Background = new ImageBrush() { Stretch = Stretch.Fill, ImageSource = new BitmapImage(new Uri("Image/game-ddz_bg.png", UriKind.RelativeOrAbsolute)) };五:后台设置颜色
tb.Foreground = new SolidColorBrush(Colors.Red);
tb.Background = new SolidColorBrush(Color.FromArgb(0xff, 0x5e, 0x83, 0xad));颜色是16进制的数如果用的是红绿蓝的前边一个就写0xff
六:分层思想主页面去引用其他的siverlight库文件编译成的dll
七:On time task
use DispatcherTimer
本文介绍了如何使用WPF进行界面美化,包括为Grid设置背景图片、动态调整控件边距、添加图片子控件等实用技巧,并展示了如何通过代码实现这些效果。
929

被折叠的 条评论
为什么被折叠?



