Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ
Tải xuống
Essential Silverlight 3- P3: Khái quát Silverlight 3 không chỉ là lấp đầy với các chi tiết kỹ thuật, ví dụ rõ ràng, và thực hiện lời khuyên rằng sẽ làm cho bất kỳ ứng dụng Silverlight tốt hơn, nhưng Ashraf cũng bao gồm những hiểu biết rằng chỉ có thể đến từ một trong những nhà phát triển dẫn của thời gian chạy Silverlight. Từ đồ họa, văn bản, để phương tiện truyền thông cuốn sách này- có tất cả các thông tin cần thiết về thời gian chạy lõi 3 Silverlight | 68 Chapter 3 Graphics One other feature of linear and radial gradients is the capability to specify the behavior when the display position maps to some position outside the range of the gradient line. The SpreadMethod property defines that behavior. The Pad mode repeats the closest point when off the line the Reflect mode mirrors to a point on the line and the Repeat mode simply takes the position modulo the length of the line as shown in Figure 3.21. Figure 3.21 SpreadMethod example Image Brushes The role of the image brush is to map a screen position to a pixel in the specified image. For example the following XAML would result in the image brush rendering shown in Figure 3.22. Figure 3.22 ImageBrush example Canvas xmlns http schemas.microsoft.com client 2007 Ellipse Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. Graphics Elements 69 Width 450 Height 450 Stroke Black StrokeThickness 10 Ellipse.Fill ImageBrush ImageSource silverlight.png Ellipse.Fill Ellipse Canvas Strokes The previous section showed how to use a brush to color the fill of a shape. You can also use a brush to add color to the outline of a shape by setting the stroke properties. For example the following XAML generates the output shown in Figure 3.23. Canvas xmlns http schemas.microsoft.com client 2007 Ellipse Stroke Black StrokeThickness 10 Canvas.Left 50 Canvas.Top 50 Width 400 Height 400 Canvas Please purchase PDF Split-Merge on www.verypdf.com to remove this watermark. 70 Chapter 3 Graphics Stroke A stroke transforms geometry to a widened form that describes the shape outline instead of the shape fill. Silverlight fills the widened geometry with exactly the same rendering rules as the main shape fill. For example Figure 3.24 shows an example of a widened ellipse. The widening process expands the original geometry by half the stroke thickness to form an outer outline. The widening process also shrinks the original geometry by half the stroke thickness to form an .