HWH....

导航

 

  Basic Brushes

1.Color in the Windows Presentation Foundation is encapsulated in the Color structure defined in the System.Windows.Media namespace.

2.The alpha channel governs the opacity of the color, where a value of 0 means that the color is entirely transparent and 255 means opaque, and values in between denote degrees of transparency.

    Color clr = new Color();

            clr.A = 255;

            clr.R = 255;

            clr.G = 0;

            clr.B = 255;         

      Color clr = Color.FromRgb(r, g, b)

          Color clr = Color.FromArgb(a, r, g, b)

3.Cathode ray tubes in common use today do not display light in a linear fashion. The light intensity (I) is related to the voltages (V) sent to the display in the following power relationship:

 

          Color clr = Color.FromScRgb(a, r, g, b);

          Color clr = Colors.PapayaWhip;

4.            Background = new SolidColorBrush(Colors.PaleGoldenrod);

you can use this:

Background = Brushes.PaleGoldenrod;

 you can not use this;

Brush brush=Brushes.PaleGoldenrod;

Background=brush;

    

5.SolidColorBrush brush = new SolidColorBrush(Colors.Black);

          with

          SolidColorBrush brush = Brushes.Black; //We can't do it like this. Because Brushes.Black object is a Feezen Object..

          SolidColorBruch brush = Brushes.Black.Clone();//Replace Upon the statement, We mey use the method "Clone()",,

6.One alternative to a solid-color brush is a gradient brush, which displays a gradually changing mix of two or more colors.

7. SolidColorBrush, GradientBrush

8.  LinearGradientBrush brush = new LinearGradientBrush(Colors.Red, Colors.Blue, new Point(0, 0), new Point(1, 1));//(0, 0) Left Top Point, (1,1)Right Buttom point

9.

brush.GradientStops.Add(new GradientStop(Colors.Red, 0));
brush.GradientStops.Add(
new GradientStop(Colors.Orange, .17));
brush.GradientStops.Add(
new GradientStop(Colors.Yellow, .33));
brush.GradientStops.Add(
new GradientStop(Colors.Green, .5));

10.RadialGradientBrush. Three of these properties define an ellipse: The Center property is a Point object of default value (0.5, 0.5), which is the center of the area that the brush covers. The RadiusX and RadiusY properties are two double values that govern the horizontal and vertical radii of the ellipse. The default values are 0.5, so both horizontally and vertically the ellipse reaches the edges of the area filled by the brush.

11.Center and GradientOrigin

 ==

 

!=

 

12.There are at least four timer classes in .NET, and three of them are named Timer. The Timer classes in System.Threading and System.Timers can't be used in this particular program because the timer events occur in a different thread, and Freezable objects must be changed in the same thread in which they're created.

13. The DispatcherTimer class located in the System.Windows.Threading namespace is the one to use in WPF programs if you need the events to occur in the application thread. You set an Interval property from a TimeSpan property, but you can't get more frequent "ticks" than once every 10 milliseconds.

DispatcherTimer不能保证会正好在时间间隔发生时执行计时器,但能够保证不会在时间间隔发生之前执行计时器。 这是因为 DispatcherTimer 操作与其他操作一样被放置到 Dispatcher 队列中。 何时执行 DispatcherTimer 操作取决于队列中的其他作业及其优先级。

如果 System.Timers.Timer 用于 WPF 应用程序,则值得注意的是 System.Timers.Timer 运行于不同于user interface (UI) 线程的其他线程上。 为了访问user interface (UI) 线程上的对象,需要使用 InvokeBeginInvoke 将操作发布到user interface (UI) 线程的 Dispatcher 上。 使用 DispatcherTimer 而不是使用 System.Timers.Timer 的原因是 DispatcherTimerDispatcher 运行于相同的线程,并且可以在 DispatcherTimer 上设置 DispatcherPriority

每当将对象方法绑定到计时器时,DispatcherTimer 都将使对象保持活动状态。

14.Border   SystemParameters.ResizeFrameVerticalBorderWidth

         SystemParameters.ResizeFrameHorizontalBorderHeight
           SystemParameters.CaptionHeight

15.Window Properties and Methods

  BorderBrush

  BorderThickness

  Foreground

16.RadialGradientBrush Properties and Methods 

RadialGradientBrush br = new RadialGradientBrush(Colors.LightSeaGreen, Colors.Red);

Center = new Point(0.5, 0.5)

GradientOrigin = new Point(0.5, 0.5)

GradientStops.Add(new GradientStop(Colors.Blue, 0.5))//parameter:Color and Offset

RadiusX = 0.5

RadiusY = 0.5

SpreadMethod=GradientSpreadMethod.Repeat;

 

 

  

  

posted on 2011-03-21 15:55  HWH....  阅读(435)  评论(0编辑  收藏  举报