PDA

View Full Version : Foreground



j_naroogha@yahoo.com
یک شنبه 20 آذر 1390, 19:33 عصر
سلام
توی Wpf چکونه میشه Foreground یه label رو عوض کرد.(با کد نویسی)؟
ظاهرا باید یه Brush تعریف کرد.
تعریف Brush چه جوریه؟
ممنون میشم اگه پاسخ بدین.

rt3073
یک شنبه 20 آذر 1390, 20:18 عصر
label1. Foreground = Brushes.Blue;
وقتی .Brushes را میزنی لیستی از رنگ ها باز میشه که هر کدام را بخواهی انتخاب می کنی. منظورتون همین بود؟

سوداگر
یک شنبه 20 آذر 1390, 20:27 عصر
اینم Brush سفارشی:

Point startpt = new Point(0.5, 0);
Point endpt = new Point(0.5, 1);
GradientStop gs = new GradientStop(Colors.Red, 0);
LinearGradientBrush lgb = new LinearGradientBrush(Colors.Black,Colors.Yellow,sta rtpt,endpt);
lblcolor.Foreground = lgb;