Color newColor = Color.FromArgb(255, 0xEE, 0xEE, 0xEE);
newRect.Fill = new SolidColorBrush(newColor);
或者在new一個Rectangle時你也可以這樣做:
Color newColor = Color.FromArgb(255, 0xEE, 0xEE, 0xEE);
Rectange rect =
new Rectange() { Fill = new SolidColorBrush(newColor)};
指定Margin上、下、左、右的方式如下:
Thickness newTk = new Thickness();
newTk.Top = (double)5;
newTk.Left = (double)5;
newTk.Right = (double)5;
newTk.Bottom = (double)5;
newRect.SetValue(Rectangle.MarginProperty, newTk);
沒有留言:
張貼留言