Wpf Workgroup 3

60 %
40 %
Information about Wpf Workgroup 3

Published on June 19, 2007

Author: andrei_i

Source: slideshare.net

Description

The third WPF workgroup at FCS, UAIC

Andrei Iacob Microsoft Student Partners

Agenda Intro 2D - Clasa Shape - Linii - alte forme primitive geometrice - Brushes & pens - Path , “geometrii” şi mini-limbajul său - Transform ări XAML exploitation

Intro

2D - Clasa Shape - Linii - alte forme primitive geometrice - Brushes & pens - Path , “geometrii” şi mini-limbajul său - Transform ări

XAML exploitation

Intro XAMLPad Cuvinte cheie: SVG, Media Integration Layer, FrameworkElement (UIElement), GDI+

XAMLPad

Cuvinte cheie: SVG, Media Integration Layer, FrameworkElement (UIElement), GDI+

Ierarhia UIElement - FrameworkElement - Shape (abstract) - Ellipse - Line - Path - Polygon - Polyline - Rectangle

UIElement - FrameworkElement - Shape (abstract) - Ellipse - Line - Path - Polygon - Polyline - Rectangle

Lin e Propriet ăţi: - X1, Y1, X2, Y2 – Double - Stroke - Brush

Propriet ăţi: - X1, Y1, X2, Y2 – Double

- Stroke - Brush

Rectangle Proprietăţi - Width, Height – Double - Fill, Stroke – Brush - RadiusX, RadiusY – Double

Proprietăţi - Width, Height – Double - Fill, Stroke – Brush - RadiusX, RadiusY – Double

Ellipse Proprietăţi - Width, Height – Double - Fill, Stroke – Brush

Proprietăţi - Width, Height – Double - Fill, Stroke – Brush

Polyline Proprietăţi - Points – PointCollection - Stroke, Fill – Brush Exemplu: <Polyline Stroke=&quot;Blue” Points=&quot;0,80 60,80 65,50 68,110 73,80 85,80 90,50 93,110 98,80 210,80&quot; />

Proprietăţi - Points – PointCollection - Stroke, Fill – Brush

Exemplu:

<Polyline Stroke=&quot;Blue” Points=&quot;0,80 60,80 65,50 68,110 73,80 85,80 90,50 93,110 98,80 210,80&quot; />

Polyline O spiral ă poly=new Polyline(); poly.Stroke = SystemColors.WindowTextBrush; Panza.Children.Add(poly); Point[] pts=new Point[numpts]; for (int i=0;i<numpts;i++) { double angle = i * 2 * Math.PI / (numpts/revs); double scale = 250 * ( 1 - (double)i/numpts); pts[i].X = scale * Math.Cos(angle); pts[i].Y = scale * Math.Sin(angle); } poly.Points = new PointCollection(pts);

O spiral ă poly=new Polyline(); poly.Stroke = SystemColors.WindowTextBrush;

Panza.Children.Add(poly);

Point[] pts=new Point[numpts];

for (int i=0;i<numpts;i++)

{

double angle = i * 2 * Math.PI / (numpts/revs);

double scale = 250 * ( 1 - (double)i/numpts);

pts[i].X = scale * Math.Cos(angle);

pts[i].Y = scale * Math.Sin(angle);

}

poly.Points = new PointCollection(pts);

Polygon Proprietăţi - Points – PointCollection - Stroke, Fill – Brush Exemplu: <Poly gon Stroke=&quot;Blue” Points=&quot;0,80 60,80 65,50 68,110 73,80 85,80 90,50 93,110 98,80 210,80&quot; />

Proprietăţi - Points – PointCollection - Stroke, Fill – Brush

Exemplu:

<Poly gon Stroke=&quot;Blue” Points=&quot;0,80 60,80 65,50 68,110 73,80 85,80 90,50 93,110 98,80 210,80&quot; />

Brush Culori în WPF - 4 canale: Red, Green, Blue, Alpha - 16 biţi /culoare SolidColorBrush

Culori în WPF - 4 canale: Red, Green, Blue, Alpha - 16 biţi /culoare

SolidColorBrush

Brush LinearGradientBrush <Rectangle Width=&quot;80&quot; Height=&quot;60&quot;> <Rectangle.Fill> <LinearGradientBrush StartPoint=&quot;0,0&quot; EndPoint=&quot;1,1&quot;> <LinearGradientBrush.GradientStops> <GradientStop Color=&quot;Black&quot; Offset=&quot;0&quot; /> <GradientStop Color=&quot;White&quot; Offset=&quot;1&quot; /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Rectangle.Fill> </Rectangle> 0,1 0,0 1,0 1,1

LinearGradientBrush

<Rectangle Width=&quot;80&quot; Height=&quot;60&quot;> <Rectangle.Fill> <LinearGradientBrush StartPoint=&quot;0,0&quot; EndPoint=&quot;1,1&quot;> <LinearGradientBrush.GradientStops> <GradientStop Color=&quot;Black&quot; Offset=&quot;0&quot; /> <GradientStop Color=&quot;White&quot; Offset=&quot;1&quot; /> </LinearGradientBrush.GradientStops> </LinearGradientBrush> </Rectangle.Fill> </Rectangle>

Brush RadialGradientBrush <Rectangle Width=&quot;200&quot; Height=&quot;150&quot;> <Rectangle.Fill> <RadialGradientBrush Center=&quot;0.5,0.4&quot; RadiusX=&quot;0.3” RadiusY=&quot;0.5” GradientOrigin=&quot;0.25,0.4&quot;> <RadialGradientBrush.GradientStops> <GradientStop Color=&quot;White&quot; Offset=&quot;0&quot; /> <GradientStop Color=&quot;DarkBlue&quot; Offset=&quot;1&quot; /> </RadialGradientBrush.GradientStops> </RadialGradientBrush> </Rectangle.Fill> </Rectangle>

RadialGradientBrush

<Rectangle Width=&quot;200&quot; Height=&quot;150&quot;>

<Rectangle.Fill>

<RadialGradientBrush Center=&quot;0.5,0.4&quot; RadiusX=&quot;0.3” RadiusY=&quot;0.5” GradientOrigin=&quot;0.25,0.4&quot;>

<RadialGradientBrush.GradientStops>

<GradientStop Color=&quot;White&quot; Offset=&quot;0&quot; />

<GradientStop Color=&quot;DarkBlue&quot; Offset=&quot;1&quot; />

</RadialGradientBrush.GradientStops>

</RadialGradientBrush>

</Rectangle.Fill>

</Rectangle>

Brush Alte brush-uri: - ImageBrush - DrawingBrush - VisualBrush

Alte brush-uri: - ImageBrush - DrawingBrush - VisualBrush

Pens StrokeThickness StrokeDashArray

StrokeThickness

StrokeDashArray

Path Cel mai puternic element grafic din WPF Proprietăţi: Stroke, Fill, Data (conţinutul) Are ca şi conţinut o “Geometrie”

Cel mai puternic element grafic din WPF

Proprietăţi: Stroke, Fill, Data (conţinutul)

Are ca şi conţinut o “Geometrie”

Path Geometrii: - LineGeometry - RectangleGeometry - EllipseGeometry - GeometryGroup - CombinedGeometry - PathGeometry - StreamGeometry

Geometrii: - LineGeometry - RectangleGeometry - EllipseGeometry - GeometryGroup - CombinedGeometry - PathGeometry - StreamGeometry

Geometrii LineGeometry <Path Stroke=&quot;Black&quot;> <Path.Data> <LineGeometry StartPoint=&quot;10 10&quot; EndPoint=&quot;10 100&quot; /> </Path.Data> </Path> RectangleGeometry <Path Fill=&quot;Blue&quot;> <Path.Data> <RectangleGeometry Rect=&quot;0, 0, 40, 80&quot; /> </Path.Data> </Path>

LineGeometry <Path Stroke=&quot;Black&quot;> <Path.Data>

<LineGeometry StartPoint=&quot;10 10&quot; EndPoint=&quot;10 100&quot; /> </Path.Data> </Path>

RectangleGeometry <Path Fill=&quot;Blue&quot;> <Path.Data> <RectangleGeometry Rect=&quot;0, 0, 40, 80&quot; /> </Path.Data> </Path>

Geometrii EllipseGeometry <Path Stroke=&quot;Black&quot;> <Path.Data> <EllipseGeometry Center=&quot;20, 40&quot; RadiusX=&quot;10&quot; RadiusY=&quot;30&quot; /> </Path.Data> </Path> GeometryGroup <Path Fill=&quot;Cyan&quot; Stroke=&quot;Black&quot;> <Path.Data> <GeometryGroup> <EllipseGeometry Center=&quot;20, 40&quot; RadiusX=&quot;20&quot; RadiusY=&quot;40&quot; /> <EllipseGeometry Center=&quot;20, 40&quot; RadiusX=&quot;10&quot; RadiusY=&quot;30&quot; /> </GeometryGroup> </Path.Data> </Path>

EllipseGeometry <Path Stroke=&quot;Black&quot;>

<Path.Data>

<EllipseGeometry Center=&quot;20, 40&quot; RadiusX=&quot;10&quot; RadiusY=&quot;30&quot; />

</Path.Data>

</Path>

GeometryGroup <Path Fill=&quot;Cyan&quot; Stroke=&quot;Black&quot;> <Path.Data> <GeometryGroup> <EllipseGeometry Center=&quot;20, 40&quot; RadiusX=&quot;20&quot; RadiusY=&quot;40&quot; /> <EllipseGeometry Center=&quot;20, 40&quot; RadiusX=&quot;10&quot; RadiusY=&quot;30&quot; /> </GeometryGroup> </Path.Data> </Path>

Geometrii PathGeometry <Path Fill=&quot;Cyan&quot; Stroke=&quot;Black&quot;> <Path.Data> <PathGeometry> <PathGeometry.Figures> <PathFigure> <PathFigure.Segments> <StartSegment Point=&quot;0,0&quot; /> <LineSegment Point=&quot;50,0&quot; /> <LineSegment Point=&quot;50,50&quot; /> <LineSegment Point=&quot;0,50&quot; /> <CloseSegment /> </PathFigure.Segments> </PathFigure> </PathGeometry.Figures> </PathGeometry> </Path.Data> </Path>

PathGeometry <Path Fill=&quot;Cyan&quot; Stroke=&quot;Black&quot;> <Path.Data> <PathGeometry> <PathGeometry.Figures> <PathFigure> <PathFigure.Segments> <StartSegment Point=&quot;0,0&quot; /> <LineSegment Point=&quot;50,0&quot; /> <LineSegment Point=&quot;50,50&quot; /> <LineSegment Point=&quot;0,50&quot; /> <CloseSegment /> </PathFigure.Segments> </PathFigure> </PathGeometry.Figures> </PathGeometry> </Path.Data> </Path>

Geometrii StreamGeometry <Path Fill=&quot;Cyan&quot; Stroke=&quot;Black&quot; Data=&quot;M 0,0 L 50,0 50,50 0,50 Z&quot; />

StreamGeometry <Path Fill=&quot;Cyan&quot; Stroke=&quot;Black&quot; Data=&quot;M 0,0 L 50,0 50,50 0,50 Z&quot; />

Geometrii StreamGeometry M x y Move Moveto x y L x y Line H x Horizontal line V y Vertical line A xr yr a i j x y Arc Arc pana la x y din elipsa xr yr cu a grade i:1 LargeArc j:1 Clockwise C x1 y1 x2 y2 x3 y3 Cubic Bezier Bezier pana la x3 y3, cu x1 y1 x2 y2 ca puncte de control S x2 y2 x3 y3 Smooth Bezier Q x1 y1 x2 y2 Quadratic Bezier Z Close

StreamGeometry

Transformări RenderTransform LayoutTransform Tipuri de transformări: - TranslateTransform - ScaleTransform - SkewTransform - RotateTransform - MatrixTransform - TransformGroup

RenderTransform

LayoutTransform

Tipuri de transformări: - TranslateTransform - ScaleTransform - SkewTransform - RotateTransform - MatrixTransform - TransformGroup

XAML Exploitation StringReader reader = new StringReader( this.DocumentRoot.TextBox. Text);    XmlReader xmlReader = XmlReader.Create( reader);           try    {     Control dynamicControl = (Control)XamlReader .Load(xmlReader) ;     this.DocumentRoot. Grid.Children. Add(dynamicContr ol);    }    catch (Exception ex)    {     MessageBox.Show( ex.Message) ;    }

StringReader reader = new StringReader( this.DocumentRoot.TextBox. Text);    XmlReader xmlReader = XmlReader.Create( reader);           try    {     Control dynamicControl = (Control)XamlReader .Load(xmlReader) ;     this.DocumentRoot. Grid.Children. Add(dynamicContr ol);    }    catch (Exception ex)    {     MessageBox.Show( ex.Message) ;    }

XAML Exploitation string StrXaml=“<Rectangle Width=‘100’ Height=‘100’ Stroke=‘Blue’>”; StringReader strreader = new StringReader(StrXaml); XmlTextReader xmlreader = new XmlTextReader(strreader); object obj = XamlReader.Load(xmlreader); Uri uri = new Uri(“pack://application:,,,/LoadXaml.xml”); Stream stream = Application.GetResourceStream(uri).Stream; FrameworkElement el = XamlReader.Load(stream) as FrameworkElement; Button btn = el.FindName(“Buton”) as Button

string StrXaml=“<Rectangle Width=‘100’ Height=‘100’ Stroke=‘Blue’>”; StringReader strreader = new StringReader(StrXaml); XmlTextReader xmlreader = new XmlTextReader(strreader); object obj = XamlReader.Load(xmlreader);

Uri uri = new Uri(“pack://application:,,,/LoadXaml.xml”); Stream stream = Application.GetResourceStream(uri).Stream; FrameworkElement el = XamlReader.Load(stream) as FrameworkElement; Button btn = el.FindName(“Buton”) as Button

Add a comment

Related presentations

Related pages

Resources.PrivacyRelationshipWorkgroup property (Microsoft ...

Lync 2013 WPF class libraries. Microsoft.Lync.Controls.Properties. ... Assembly: Microsoft.Lync.Controls (in Microsoft.Lync.Controls.dll) Syntax. C#. VB. Copy.
Read more

WPF Datagrid: Refresh Data Using Dispatcher without UI Freeze

Application Background: Desktop app designed in WPF and vb.net backed-up by sql server express edition 2008 for multiple users across the workgroup.
Read more

c# - How can you programmatically change the workgroup of ...

How can you programmatically change the workgroup of a machine? ... How to exit a WPF app ... user contributions licensed under cc by-sa 3.0 with ...
Read more

data binding - wpf datagrid databind with nested objects ...

I have a simple problem binding an entity to datagrid in wpf. ... and each "User" have one "Workgroup ... wpf datagrid databind with nested objects ...
Read more

How to get workGroup name - CodeProject

How to get work group name of my system. I dont want retrieve system name I need WorkGroup name Example my system name is Computer1. My work ...
Read more

How do I get list of Workgroup names on Network in C# ...

How do I get list of Workgroup names on Network in C# ... See more: C#2.0 C#3.0 C# C#3.5 C#5. In Mac OS X, you have the ability to view all the workgroup ...
Read more

Resources.PrivacyWorkgroupHeader property (Microsoft.Lync ...

Office development Skype Skype Developer Platform Desktop Apps Lync 2013 class libraries reference Lync 2013 WPF class libraries Microsoft.Lync ...
Read more