Using SolidColorBrush to paint the window background : SolidColorBrush « Windows Presentation Foundation « C# / CSharp Tutorial

Home
C# / CSharp Tutorial
1.Language Basics
2.Data Type
3.Operator
4.Statement
5.String
6.struct
7.Class
8.Operator Overload
9.delegate
10.Attribute
11.Data Structure
12.Assembly
13.Date Time
14.Development
15.File Directory Stream
16.Preprocessing Directives
17.Regular Expression
18.Generic
19.Reflection
20.Thread
21.I18N Internationalization
22.LINQ
23.GUI Windows Forms
24.Windows Presentation Foundation
25.Windows Communication Foundation
26.Workflow
27.2D
28.Design Patterns
29.Windows
30.XML
31.XML LINQ
32.ADO.Net
33.Network
34.Directory Services
35.Security
36.unsafe
C# / C Sharp
C# / C Sharp by API
C# / CSharp Open Source
C# / CSharp Tutorial » Windows Presentation Foundation » SolidColorBrush 
24.96.13.Using SolidColorBrush to paint the window background
using System;
using System.Windows;
using System.Windows.Input;
using System.Windows.Media;

    public class MainClass : Window
    {
        SolidColorBrush brush = new SolidColorBrush(Colors.Black);

        [STAThread]
        public static void Main()
        {
            Application app = new Application();
            app.Run(new MainClass());
        }
        public MainClass()
        {
            Width = 400;
            Height = 400;
            Background = brush;
        }
        protected override void OnMouseMove(MouseEventArgs args)
        {
            double width = 330;
            double height = 350;

            Point ptMouse = args.GetPosition(this);
            Point ptCenter = new Point(width / 2, height / 2);
            Vector vectMouse = ptMouse - ptCenter;
            double angle = Math.Atan2(vectMouse.Y, vectMouse.X);
            Vector vectEllipse = new Vector(width / * Math.Cos(angle),height / * Math.Sin(angle));
            Byte byLevel = 123;
            Color clr = brush.Color;
            clr.R = clr.G = clr.B = byLevel;
            brush.Color = clr;
        }
    }
24.96.SolidColorBrush
24.96.1.The Color property of this rectangle's SolidColorBrush is animated.The Color property of this rectangle's SolidColorBrush is animated.
24.96.2.The Color property of the SolidColorBrush used to fill this rectangle is animatedThe Color property of the SolidColorBrush used to fill this rectangle is animated
24.96.3.The Opacity property of this rectangle's SolidColorBrush is animatedThe Opacity property of this rectangle's SolidColorBrush is animated
24.96.4.SolidColorBrush Opacity property from 1 to 0SolidColorBrush Opacity property from 1 to 0
24.96.5.SolidColorBrush objects: Brushes.Red, Brushes.MediumBlue,Brushes.Purple, and Brushes.GoldSolidColorBrush objects: Brushes.Red, Brushes.MediumBlue,Brushes.Purple, and Brushes.Gold
24.96.6.SolidColorBrush described using 3-digit hexadecimal notation: amount of red, green, and blue in the color.SolidColorBrush described using 3-digit hexadecimal notation: amount of red, green, and blue in the color.
24.96.7.SolidColorBrush described using 6-digit hexadecimal notation.SolidColorBrush described using 6-digit hexadecimal notation.
24.96.8.SolidColorBrush described using 8-digit hexadecimal notation.SolidColorBrush described using 8-digit hexadecimal notation.
24.96.9.SolidColorBrush's Color property is specified using one of the predefined colors defined by the System.Windows.Media.Colors classSolidColorBrush's Color property is specified using one of the predefined colors defined by the System.Windows.Media.Colors class
24.96.10.SolidColorBrush's color is specified using 3-digit hexadecimal notation.SolidColorBrush's color is specified using 3-digit hexadecimal notation.
24.96.11.SolidColorBrush's color is specified using 6-digit hexadecimal notation.SolidColorBrush's color is specified using 6-digit hexadecimal notation.
24.96.12.SolidColorBrush's color is specified using 8-digit hexadecimal notation.SolidColorBrush's color is specified using 8-digit hexadecimal notation.
24.96.13.Using SolidColorBrush to paint the window background
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.