Initial WPF content migrated (#17)
* Reset branch for WPF changes * Convert BMP to PNG; fix link-out-of-scope err * Add snippets for WPF... 6794 files!!!! * Add missing snippets * update file updated between migration * Fix paths to include * update breadcrumb and toc * fix index links * fix index links * fix index links * fix markdown
@@ -0,0 +1,72 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<!-- MSBUILD Project File -->
|
||||
<PropertyGroup>
|
||||
<DefaultClrNameSpace>SDKSamples</DefaultClrNameSpace>
|
||||
<AssemblyName>ImagingSnippetGallery</AssemblyName>
|
||||
<TargetType>winexe</TargetType>
|
||||
<Configuration>Release</Configuration>
|
||||
<BuildSystem>MSBuild</BuildSystem>
|
||||
<HostInBrowser>False</HostInBrowser>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{99E90579-62FC-4898-B168-24F7DBD3A34D}</ProjectGuid>
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<!--Import the target file that contains all the common targets -->
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="MyApp.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="SampleViewer.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MyApp.xaml.vb">
|
||||
<DependentUpon>MyApp.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="SampleViewer.xaml.vb">
|
||||
<DependentUpon>SampleViewer.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Basic3DShapeExample.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Misc3DOperationsExample.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Viewport3DVisualExample.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="EmissiveMaterialExample.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MultipleTransformationsExample.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,131 @@
|
||||
' <SnippetBasic3DShapeCodeExampleWholePage>
|
||||
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Media3D
|
||||
|
||||
Namespace SDKSample
|
||||
Partial Public Class Basic3DShapeExample
|
||||
Inherits Page
|
||||
Public Sub New()
|
||||
|
||||
' Declare scene objects.
|
||||
Dim myViewport3D As New Viewport3D()
|
||||
Dim myModel3DGroup As New Model3DGroup()
|
||||
Dim myGeometryModel As New GeometryModel3D()
|
||||
Dim myModelVisual3D As New ModelVisual3D()
|
||||
' <SnippetBasic3DShapeCodeExampleInline1>
|
||||
' Defines the camera used to view the 3D object. In order to view the 3D object,
|
||||
' the camera must be positioned and pointed such that the object is within view
|
||||
' of the camera.
|
||||
Dim myPCamera As New PerspectiveCamera()
|
||||
|
||||
' Specify where in the 3D scene the camera is.
|
||||
myPCamera.Position = New Point3D(0, 0, 2)
|
||||
|
||||
' Specify the direction that the camera is pointing.
|
||||
myPCamera.LookDirection = New Vector3D(0, 0, -1)
|
||||
|
||||
' Define camera's horizontal field of view in degrees.
|
||||
myPCamera.FieldOfView = 60
|
||||
|
||||
' Asign the camera to the viewport
|
||||
myViewport3D.Camera = myPCamera
|
||||
' </SnippetBasic3DShapeCodeExampleInline1>
|
||||
' Define the lights cast in the scene. Without light, the 3D object cannot
|
||||
' be seen. Note: to illuminate an object from additional directions, create
|
||||
' additional lights.
|
||||
Dim myDirectionalLight As New DirectionalLight()
|
||||
myDirectionalLight.Color = Colors.White
|
||||
myDirectionalLight.Direction = New Vector3D(-0.61, -0.5, -0.61)
|
||||
|
||||
myModel3DGroup.Children.Add(myDirectionalLight)
|
||||
|
||||
' The geometry specifes the shape of the 3D plane. In this sample, a flat sheet
|
||||
' is created.
|
||||
Dim myMeshGeometry3D As New MeshGeometry3D()
|
||||
|
||||
' Create a collection of normal vectors for the MeshGeometry3D.
|
||||
Dim myNormalCollection As New Vector3DCollection()
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myMeshGeometry3D.Normals = myNormalCollection
|
||||
|
||||
' Create a collection of vertex positions for the MeshGeometry3D.
|
||||
Dim myPositionCollection As New Point3DCollection()
|
||||
myPositionCollection.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, -0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(-0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
myMeshGeometry3D.Positions = myPositionCollection
|
||||
|
||||
' Create a collection of texture coordinates for the MeshGeometry3D.
|
||||
Dim myTextureCoordinatesCollection As New PointCollection()
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 0))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 0))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 0))
|
||||
myMeshGeometry3D.TextureCoordinates = myTextureCoordinatesCollection
|
||||
|
||||
' Create a collection of triangle indices for the MeshGeometry3D.
|
||||
Dim myTriangleIndicesCollection As New Int32Collection()
|
||||
myTriangleIndicesCollection.Add(0)
|
||||
myTriangleIndicesCollection.Add(1)
|
||||
myTriangleIndicesCollection.Add(2)
|
||||
myTriangleIndicesCollection.Add(3)
|
||||
myTriangleIndicesCollection.Add(4)
|
||||
myTriangleIndicesCollection.Add(5)
|
||||
myMeshGeometry3D.TriangleIndices = myTriangleIndicesCollection
|
||||
|
||||
' Apply the mesh to the geometry model.
|
||||
myGeometryModel.Geometry = myMeshGeometry3D
|
||||
|
||||
' The material specifies the material applied to the 3D object. In this sample a
|
||||
' linear gradient covers the surface of the 3D object.
|
||||
|
||||
' Create a horizontal linear gradient with four stops.
|
||||
Dim myHorizontalGradient As New LinearGradientBrush()
|
||||
myHorizontalGradient.StartPoint = New Point(0, 0.5)
|
||||
myHorizontalGradient.EndPoint = New Point(1, 0.5)
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Yellow, 0.0))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Red, 0.25))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Blue, 0.75))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.LimeGreen, 1.0))
|
||||
|
||||
' Define material and apply to the mesh geometries.
|
||||
Dim myMaterial As New DiffuseMaterial(myHorizontalGradient)
|
||||
myGeometryModel.Material = myMaterial
|
||||
|
||||
' Apply a transform to the object. In this sample, a rotation transform is applied,
|
||||
' rendering the 3D object rotated.
|
||||
Dim myRotateTransform3D As New RotateTransform3D()
|
||||
Dim myAxisAngleRotation3d As New AxisAngleRotation3D()
|
||||
myAxisAngleRotation3d.Axis = New Vector3D(0,3,0)
|
||||
myAxisAngleRotation3d.Angle = 40
|
||||
myRotateTransform3D.Rotation = myAxisAngleRotation3d
|
||||
myGeometryModel.Transform = myRotateTransform3D
|
||||
|
||||
' Add the geometry model to the model group.
|
||||
myModel3DGroup.Children.Add(myGeometryModel)
|
||||
|
||||
' Add the group of models to the ModelVisual3d.
|
||||
myModelVisual3D.Content = myModel3DGroup
|
||||
|
||||
'
|
||||
myViewport3D.Children.Add(myModelVisual3D)
|
||||
|
||||
' Apply the viewport to the page so it will be rendered.
|
||||
Me.Content = myViewport3D
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
' </SnippetBasic3DShapeCodeExampleWholePage>
|
||||
@@ -0,0 +1,149 @@
|
||||
' <SnippetEmissiveMaterialCodeExampleWholePage>
|
||||
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Media3D
|
||||
|
||||
Namespace SDKSample
|
||||
Partial Public Class EmissiveMaterialExample
|
||||
Inherits Page
|
||||
Public Sub New()
|
||||
|
||||
' Declare scene objects.
|
||||
Dim myViewport3D As New Viewport3D()
|
||||
Dim myModel3DGroup As New Model3DGroup()
|
||||
Dim myGeometryModel As New GeometryModel3D()
|
||||
Dim myModelVisual3D As New ModelVisual3D()
|
||||
|
||||
' Defines the camera used to view the 3D object. In order to view the 3D object,
|
||||
' the camera must be positioned and pointed such that the object is within view
|
||||
' of the camera.
|
||||
Dim myPCamera As New PerspectiveCamera()
|
||||
|
||||
' Specify where in the 3D scene the camera is.
|
||||
myPCamera.Position = New Point3D(0, 0, 2)
|
||||
|
||||
' Specify the direction that the camera is pointing.
|
||||
myPCamera.LookDirection = New Vector3D(0, 0, -1)
|
||||
|
||||
' Define camera's horizontal field of view in degrees.
|
||||
myPCamera.FieldOfView = 60
|
||||
|
||||
' Asign the camera to the viewport
|
||||
myViewport3D.Camera = myPCamera
|
||||
|
||||
' Define the lights cast in the scene. Without light, the 3D object cannot
|
||||
' be seen. Note: to illuminate an object from additional directions, create
|
||||
' additional lights.
|
||||
Dim myDirectionalLight As New DirectionalLight()
|
||||
myDirectionalLight.Color = Colors.White
|
||||
myDirectionalLight.Direction = New Vector3D(-0.61, -0.5, -0.61)
|
||||
|
||||
myModel3DGroup.Children.Add(myDirectionalLight)
|
||||
|
||||
' The geometry specifes the shape of the 3D plane. In this sample, a flat sheet
|
||||
' is created.
|
||||
Dim myMeshGeometry3D As New MeshGeometry3D()
|
||||
|
||||
' Create a collection of normal vectors for the MeshGeometry3D.
|
||||
Dim myNormalCollection As New Vector3DCollection()
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myMeshGeometry3D.Normals = myNormalCollection
|
||||
|
||||
' Create a collection of vertex positions for the MeshGeometry3D.
|
||||
Dim myPositionCollection As New Point3DCollection()
|
||||
myPositionCollection.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, -0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(-0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
myMeshGeometry3D.Positions = myPositionCollection
|
||||
|
||||
' Create a collection of texture coordinates for the MeshGeometry3D.
|
||||
Dim myTextureCoordinatesCollection As New PointCollection()
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 0))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 0))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 0))
|
||||
myMeshGeometry3D.TextureCoordinates = myTextureCoordinatesCollection
|
||||
|
||||
' Create a collection of triangle indices for the MeshGeometry3D.
|
||||
Dim myTriangleIndicesCollection As New Int32Collection()
|
||||
myTriangleIndicesCollection.Add(0)
|
||||
myTriangleIndicesCollection.Add(1)
|
||||
myTriangleIndicesCollection.Add(2)
|
||||
myTriangleIndicesCollection.Add(3)
|
||||
myTriangleIndicesCollection.Add(4)
|
||||
myTriangleIndicesCollection.Add(5)
|
||||
myMeshGeometry3D.TriangleIndices = myTriangleIndicesCollection
|
||||
|
||||
' Apply the mesh to the geometry model.
|
||||
myGeometryModel.Geometry = myMeshGeometry3D
|
||||
' <SnippetEmissiveMaterialCodeExampleInline1>
|
||||
' The material property of GeometryModel3D specifies the material applied to the 3D object.
|
||||
' In this sample the material applied to the 3D object is made up of two materials layered
|
||||
' on top of each other - a DiffuseMaterial (gradient brush) with an EmissiveMaterial
|
||||
' layered on top (blue SolidColorBrush). The EmmisiveMaterial alters the appearance of
|
||||
' the gradient toward blue.
|
||||
|
||||
' Create a horizontal linear gradient with four stops.
|
||||
Dim myHorizontalGradient As New LinearGradientBrush()
|
||||
myHorizontalGradient.StartPoint = New Point(0, 0.5)
|
||||
myHorizontalGradient.EndPoint = New Point(1, 0.5)
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Yellow, 0.0))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Red, 0.25))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Blue, 0.75))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.LimeGreen, 1.0))
|
||||
|
||||
' Define material that will use the gradient.
|
||||
Dim myDiffuseMaterial As New DiffuseMaterial(myHorizontalGradient)
|
||||
|
||||
' Add this gradient to a MaterialGroup.
|
||||
Dim myMaterialGroup As New MaterialGroup()
|
||||
myMaterialGroup.Children.Add(myDiffuseMaterial)
|
||||
|
||||
' Define an Emissive Material with a blue brush.
|
||||
Dim c As New Color()
|
||||
c.ScA = 1
|
||||
c.ScB = 255
|
||||
c.ScR = 0
|
||||
c.ScG = 0
|
||||
Dim myEmissiveMaterial As New EmissiveMaterial(New SolidColorBrush(c))
|
||||
|
||||
' Add the Emmisive Material to the Material Group.
|
||||
myMaterialGroup.Children.Add(myEmissiveMaterial)
|
||||
|
||||
' Add the composite material to the 3D model.
|
||||
myGeometryModel.Material = myMaterialGroup
|
||||
' </SnippetEmissiveMaterialCodeExampleInline1>
|
||||
' Apply a transform to the object. In this sample, a rotation transform is applied,
|
||||
' rendering the 3D object rotated.
|
||||
Dim myRotateTransform3D As New RotateTransform3D()
|
||||
Dim myAxisAngleRotation3d As New AxisAngleRotation3D()
|
||||
myAxisAngleRotation3d.Axis = New Vector3D(0,3,0)
|
||||
myAxisAngleRotation3d.Angle = 40
|
||||
myRotateTransform3D.Rotation = myAxisAngleRotation3d
|
||||
myGeometryModel.Transform = myRotateTransform3D
|
||||
|
||||
' Add the geometry model to the model group.
|
||||
myModel3DGroup.Children.Add(myGeometryModel)
|
||||
|
||||
' Add the group of models to the ModelVisual3d.
|
||||
myModelVisual3D.Content = myModel3DGroup
|
||||
myViewport3D.Children.Add(myModelVisual3D)
|
||||
|
||||
' Apply the viewport to the page so it will be rendered.
|
||||
Me.Content = myViewport3D
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
' </SnippetEmissiveMaterialCodeExampleWholePage>
|
||||
@@ -0,0 +1,177 @@
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Media3D
|
||||
|
||||
Namespace SDKSample
|
||||
|
||||
Public Class Misc3DOperationsExample
|
||||
Inherits Page
|
||||
|
||||
|
||||
Public Sub New()
|
||||
|
||||
Dim mainPanel As New StackPanel()
|
||||
|
||||
|
||||
Dim subtract3DPointsExampleText As New TextBlock()
|
||||
subtract3DPointsExampleText.Text = "subtract3DPointsExample: " & subtract3DPointsExample()
|
||||
mainPanel.Children.Add(subtract3DPointsExampleText)
|
||||
|
||||
Dim subtract3DVectorsExampleText As New TextBlock()
|
||||
subtract3DVectorsExampleText.Text = "subtract3DVectorsExample: " & subtract3DVectorsExample()
|
||||
mainPanel.Children.Add(subtract3DVectorsExampleText)
|
||||
|
||||
Dim point4DEqualityExampleText As New TextBlock()
|
||||
point4DEqualityExampleText.Text = "point4DEqualityExample: " & point4DEqualityExample()
|
||||
mainPanel.Children.Add(point4DEqualityExampleText)
|
||||
|
||||
Dim size3DEqualityExampleText As New TextBlock()
|
||||
size3DEqualityExampleText.Text = "size3DEqualityExample: " & size3DEqualityExample().ToString()
|
||||
mainPanel.Children.Add(size3DEqualityExampleText)
|
||||
|
||||
Me.Content = mainPanel
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
|
||||
Private Function subtract3DPointsExample() As String
|
||||
' <SnippetSubtract3DPointsExample>
|
||||
' instantiate variables
|
||||
Dim point1 As New Point3D()
|
||||
Dim point2 As New Point3D(15, 40, 60)
|
||||
Dim vector1 As New Vector3D(20, 30, 40)
|
||||
Dim pointResult1 As New Point3D()
|
||||
Dim pointResult2 As New Point3D()
|
||||
Dim vectorResult1 As New Vector3D()
|
||||
Dim vectorResult2 As New Vector3D()
|
||||
|
||||
' defining x,y,z of point1
|
||||
point1.X = 10
|
||||
point1.Y = 5
|
||||
point1.Z = 1
|
||||
|
||||
vectorResult1 = Point3D.Subtract(point1, point2)
|
||||
' vectorResult1 is equal to (-5, -35, -59)
|
||||
|
||||
vectorResult2 = point2 - point1
|
||||
' vectorResult2 is equal to (5, 35, 59)
|
||||
|
||||
pointResult1 = Point3D.Subtract(point1, vector1)
|
||||
' pointResult1 is equal to (-10, -25, -39)
|
||||
|
||||
pointResult2 = vector1 - point1
|
||||
' pointResult2 is equal to (10, 25, 39)
|
||||
' </SnippetSubtract3DPointsExample>
|
||||
|
||||
Dim stringResults As String = "pointResult1: " & pointResult1.ToString()
|
||||
stringResults = stringResults & " pointResult2: " & pointResult2.ToString()
|
||||
stringResults = stringResults & " vectorResult1: " & vectorResult1.ToString()
|
||||
stringResults = stringResults & " vectorResult2: " & vectorResult2.ToString()
|
||||
Return stringResults
|
||||
|
||||
End Function
|
||||
|
||||
Private Function subtract3DVectorsExample() As String
|
||||
' <SnippetSubtract3DVectorsExample>
|
||||
' Subtracts two 3-D Vectors using the Subtract method and -
|
||||
|
||||
' Declaring vector1 and initializing x,y,z values
|
||||
Dim vector1 As New Vector3D(20, 30, 40)
|
||||
|
||||
' Declaring vector2 without initializing x,y,z values
|
||||
Dim vector2 As New Vector3D()
|
||||
|
||||
' Assigning values to vector2
|
||||
vector2.X = 45
|
||||
vector2.Y = 70
|
||||
vector2.Z = 80
|
||||
|
||||
' Subtracting vectors using overload - operator
|
||||
Dim vectorResult1 As New Vector3D()
|
||||
vectorResult1 = vector1 - vector2
|
||||
' vectorResult1 is equal to (-25, -40, -40)
|
||||
|
||||
' Subtracting vectors using static Subtract method
|
||||
Dim vectorResult2 As New Vector3D()
|
||||
vectorResult2 = Vector3D.Subtract(vector1, vector2)
|
||||
' vector2 is equal to (-25, -40, -40)
|
||||
' </SnippetSubtract3DVectorsExample>
|
||||
|
||||
Dim stringResults As String = "vectorResult1: " & vectorResult1.ToString()
|
||||
stringResults = stringResults & " vectorResult2: " & vectorResult2.ToString()
|
||||
Return stringResults
|
||||
|
||||
End Function
|
||||
|
||||
Private Function point4DEqualityExample() As String
|
||||
' <SnippetPoint4DEqualityExample>
|
||||
' instantiate Points
|
||||
Dim point4D1 As New Point4D()
|
||||
Dim point4D2 As New Point4D(15, 40, 60, 75)
|
||||
Dim point3D1 As New Point3D(15, 40, 60)
|
||||
|
||||
' result variables
|
||||
Dim areEqual As Boolean
|
||||
Dim areNotEqual As Boolean
|
||||
Dim stringResult As String
|
||||
|
||||
' defining x,y,z,w of point1
|
||||
point4D1.X = 10
|
||||
point4D1.Y = 5
|
||||
point4D1.Z = 1
|
||||
point4D1.W = 4
|
||||
|
||||
' checking if Points are equal
|
||||
areEqual = point4D1 = point4D2
|
||||
|
||||
' areEqual is False
|
||||
|
||||
' checking if Points are not equal
|
||||
areNotEqual = point4D1 <> point4D2
|
||||
' areNotEqual is True
|
||||
|
||||
If Point4D.Equals(point4D1, point3D1) Then
|
||||
' the if condition is not true, so this block will not execute
|
||||
stringResult = "Both objects are Point4D structures and they are equal"
|
||||
|
||||
Else
|
||||
' the if condition is false, so this branch will execute
|
||||
stringResult = "Parameters are not both Point4D strucutres, or they are but are not equal"
|
||||
End If
|
||||
' </SnippetPoint4DEqualityExample>
|
||||
|
||||
Return stringResult
|
||||
|
||||
End Function
|
||||
' <SnippetSize3DEqualityExample>
|
||||
Private Function size3DEqualityExample() As Boolean
|
||||
|
||||
' Checks if two Size3D structures are equal using the static Equals method.
|
||||
' Returns a Boolean.
|
||||
|
||||
' Declaring Size3D structure without initializing x,y,z values
|
||||
Dim size1 As New Size3D()
|
||||
|
||||
' Delcaring Size3D structure and initializing x,y,z values
|
||||
Dim size2 As New Size3D(5, 10, 15)
|
||||
Dim areEqual As Boolean
|
||||
|
||||
' Assigning values to size1
|
||||
size1.X = 2
|
||||
size1.Y = 4
|
||||
size1.Z = 6
|
||||
|
||||
' checking for equality
|
||||
areEqual = Size3D.Equals(size1, size2)
|
||||
|
||||
' areEqual is False
|
||||
Return areEqual
|
||||
|
||||
End Function
|
||||
' </SnippetSize3DEqualityExample>
|
||||
|
||||
End Class
|
||||
|
||||
End Namespace
|
||||
@@ -0,0 +1,149 @@
|
||||
' <SnippetMultiple3DTransformationsCodeExampleWholePage>
|
||||
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Media3D
|
||||
|
||||
Namespace SDKSample
|
||||
Partial Public Class MultipleTransformationsExample
|
||||
Inherits Page
|
||||
Public Sub New()
|
||||
|
||||
' Declare scene objects.
|
||||
Dim myViewport3D As New Viewport3D()
|
||||
Dim myModel3DGroup As New Model3DGroup()
|
||||
Dim myGeometryModel As New GeometryModel3D()
|
||||
Dim myModelVisual3D As New ModelVisual3D()
|
||||
|
||||
' Defines the camera used to view the 3D object. In order to view the 3D object,
|
||||
' the camera must be positioned and pointed such that the object is within view
|
||||
' of the camera.
|
||||
Dim myPCamera As New PerspectiveCamera()
|
||||
|
||||
' Specify where in the 3D scene the camera is.
|
||||
myPCamera.Position = New Point3D(0, 0, 2)
|
||||
|
||||
' Specify the direction that the camera is pointing.
|
||||
myPCamera.LookDirection = New Vector3D(0, 0, -1)
|
||||
|
||||
' Define camera's horizontal field of view in degrees.
|
||||
myPCamera.FieldOfView = 60
|
||||
|
||||
' Asign the camera to the viewport
|
||||
myViewport3D.Camera = myPCamera
|
||||
|
||||
' Define the lights cast in the scene. Without light, the 3D object cannot
|
||||
' be seen. Note: to illuminate an object from additional directions, create
|
||||
' additional lights.
|
||||
Dim myDirectionalLight As New DirectionalLight()
|
||||
myDirectionalLight.Color = Colors.White
|
||||
myDirectionalLight.Direction = New Vector3D(-0.61, -0.5, -0.61)
|
||||
|
||||
myModel3DGroup.Children.Add(myDirectionalLight)
|
||||
|
||||
' The geometry specifes the shape of the 3D plane. In this sample, a flat sheet
|
||||
' is created.
|
||||
Dim myMeshGeometry3D As New MeshGeometry3D()
|
||||
|
||||
' Create a collection of normal vectors for the MeshGeometry3D.
|
||||
Dim myNormalCollection As New Vector3DCollection()
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myNormalCollection.Add(New Vector3D(0,0,1))
|
||||
myMeshGeometry3D.Normals = myNormalCollection
|
||||
|
||||
' Create a collection of vertex positions for the MeshGeometry3D.
|
||||
Dim myPositionCollection As New Point3DCollection()
|
||||
myPositionCollection.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, -0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(-0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
myMeshGeometry3D.Positions = myPositionCollection
|
||||
|
||||
' Create a collection of texture coordinates for the MeshGeometry3D.
|
||||
Dim myTextureCoordinatesCollection As New PointCollection()
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 0))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 0))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 0))
|
||||
myMeshGeometry3D.TextureCoordinates = myTextureCoordinatesCollection
|
||||
|
||||
' Create a collection of triangle indices for the MeshGeometry3D.
|
||||
Dim myTriangleIndicesCollection As New Int32Collection()
|
||||
myTriangleIndicesCollection.Add(0)
|
||||
myTriangleIndicesCollection.Add(1)
|
||||
myTriangleIndicesCollection.Add(2)
|
||||
myTriangleIndicesCollection.Add(3)
|
||||
myTriangleIndicesCollection.Add(4)
|
||||
myTriangleIndicesCollection.Add(5)
|
||||
myMeshGeometry3D.TriangleIndices = myTriangleIndicesCollection
|
||||
|
||||
' Apply the mesh to the geometry model.
|
||||
myGeometryModel.Geometry = myMeshGeometry3D
|
||||
|
||||
' The material specifies the material applied to the 3D object. In this sample a
|
||||
' linear gradient covers the surface of the 3D object.
|
||||
|
||||
' Create a horizontal linear gradient with four stops.
|
||||
Dim myHorizontalGradient As New LinearGradientBrush()
|
||||
myHorizontalGradient.StartPoint = New Point(0, 0.5)
|
||||
myHorizontalGradient.EndPoint = New Point(1, 0.5)
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Yellow, 0.0))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Red, 0.25))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Blue, 0.75))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.LimeGreen, 1.0))
|
||||
|
||||
' Define material and apply to the mesh geometries.
|
||||
Dim myMaterial As New DiffuseMaterial(myHorizontalGradient)
|
||||
myGeometryModel.Material = myMaterial
|
||||
' <SnippetMultiple3DTransformationsCodeExampleInline1>
|
||||
' Apply multiple transformations to the object. In this sample, a rotation and scale
|
||||
' transform is applied.
|
||||
|
||||
' Create and apply a transformation that rotates the object.
|
||||
Dim myRotateTransform3D As New RotateTransform3D()
|
||||
Dim myAxisAngleRotation3d As New AxisAngleRotation3D()
|
||||
myAxisAngleRotation3d.Axis = New Vector3D(0,3,0)
|
||||
myAxisAngleRotation3d.Angle = 40
|
||||
myRotateTransform3D.Rotation = myAxisAngleRotation3d
|
||||
|
||||
' Add the rotation transform to a Transform3DGroup
|
||||
Dim myTransform3DGroup As New Transform3DGroup()
|
||||
myTransform3DGroup.Children.Add(myRotateTransform3D)
|
||||
|
||||
' Create and apply a scale transformation that stretches the object along the local x-axis
|
||||
' by 200 percent and shrinks it along the local y-axis by 50 percent.
|
||||
Dim myScaleTransform3D As New ScaleTransform3D()
|
||||
myScaleTransform3D.ScaleX = 2
|
||||
myScaleTransform3D.ScaleY = 0.5
|
||||
myScaleTransform3D.ScaleZ = 1
|
||||
|
||||
' Add the scale transform to the Transform3DGroup.
|
||||
myTransform3DGroup.Children.Add(myScaleTransform3D)
|
||||
|
||||
' Set the Transform property of the GeometryModel to the Transform3DGroup which includes
|
||||
' both transformations. The 3D object now has two Transformations applied to it.
|
||||
myGeometryModel.Transform = myTransform3DGroup
|
||||
' </SnippetMultiple3DTransformationsCodeExampleInline1>
|
||||
' Add the geometry model to the model group.
|
||||
myModel3DGroup.Children.Add(myGeometryModel)
|
||||
|
||||
' Add the group of models to the ModelVisual3d.
|
||||
myModelVisual3D.Content = myModel3DGroup
|
||||
|
||||
myViewport3D.Children.Add(myModelVisual3D)
|
||||
|
||||
' Apply the viewport to the page so it will be rendered.
|
||||
Me.Content = myViewport3D
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
' </SnippetMultiple3DTransformationsCodeExampleWholePage>
|
||||
@@ -0,0 +1,7 @@
|
||||
<Application xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:my="clr-namespace:SDKSample"
|
||||
x:Class="SDKSample.MyApp"
|
||||
xmlns:SampleControls="SampleControls"
|
||||
Startup="myAppStartup">
|
||||
</Application>
|
||||
@@ -0,0 +1,37 @@
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Navigation
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Animation
|
||||
Imports System.IO
|
||||
|
||||
|
||||
Namespace SDKSample
|
||||
Partial Public Class MyApp
|
||||
Inherits Application
|
||||
|
||||
|
||||
Public Sub New()
|
||||
AddHandler AppDomain.CurrentDomain.UnhandledException, AddressOf CurrentDomain_UnhandledException
|
||||
End Sub
|
||||
|
||||
Private Sub myAppStartup(ByVal sender As Object, ByVal e As StartupEventArgs)
|
||||
Dim myWindow As New Window()
|
||||
myWindow.Content = New SampleViewer()
|
||||
MainWindow = myWindow
|
||||
myWindow.Show()
|
||||
End Sub
|
||||
|
||||
Private Sub CurrentDomain_UnhandledException(ByVal sender As Object, ByVal args As UnhandledExceptionEventArgs)
|
||||
Try
|
||||
Dim wr As New StreamWriter("error.txt")
|
||||
wr.Write(args.ExceptionObject.ToString())
|
||||
wr.Close()
|
||||
|
||||
Catch e As Exception
|
||||
Throw e
|
||||
End Try
|
||||
MessageBox.Show("Unhandled exception: " & args.ExceptionObject.ToString())
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 63 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 129 KiB |
|
After Width: | Height: | Size: 6.5 KiB |
|
After Width: | Height: | Size: 87 KiB |
@@ -0,0 +1,28 @@
|
||||
<Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.SampleViewer"
|
||||
xmlns:Examples="clr-namespace:SDKSample" >
|
||||
<DockPanel Background="White">
|
||||
<TabControl Name="sampleSelector">
|
||||
|
||||
<TabItem Header="Multiple Transformations Example">
|
||||
<Frame Name="MyMultipleTransformationsExampleFrame" Background="White" />
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="EmissiveMaterial Example">
|
||||
<Frame Name="MyEmissiveMaterialExampleFrame" Background="White" />
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Viewport3DVisual Example">
|
||||
<Frame Name="MyViewport3DVisualExampleFrame" Background="White" />
|
||||
</TabItem>
|
||||
|
||||
<TabItem Header="Basic 3D Shape Example">
|
||||
<Frame Name="MyBasic3DShapeExampleFrame" Background="White" />
|
||||
</TabItem>
|
||||
<TabItem Header="Miscellaneous 3D Operations Example">
|
||||
<Frame Name="MyMisc3DOperationsExampleFrame" Background="White" />
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</Page>
|
||||
@@ -0,0 +1,24 @@
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Animation
|
||||
Imports System.Windows.Navigation
|
||||
|
||||
|
||||
Namespace SDKSample
|
||||
Partial Public Class SampleViewer
|
||||
Inherits Page
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
|
||||
MyBasic3DShapeExampleFrame.Content = New Basic3DShapeExample()
|
||||
MyMisc3DOperationsExampleFrame.Content = New Misc3DOperationsExample()
|
||||
MyViewport3DVisualExampleFrame.Content = New Viewport3dVisualExample()
|
||||
MyEmissiveMaterialExampleFrame.Content = New EmissiveMaterialExample()
|
||||
MyMultipleTransformationsExampleFrame.Content = New MultipleTransformationsExample()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
End Namespace
|
||||
|
After Width: | Height: | Size: 4.5 KiB |
@@ -0,0 +1,198 @@
|
||||
' <SnippetViewport3DVisualExampleWholePage>
|
||||
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Media3D
|
||||
|
||||
Namespace SDKSample
|
||||
Public Class Viewport3dVisualExample
|
||||
Inherits Page
|
||||
Public Sub New()
|
||||
' Instantiate the host visual that hosts the 3D object.
|
||||
Dim vh As New MyVisualHost()
|
||||
Dim mainPanel As New StackPanel()
|
||||
|
||||
' Add the drawing (3D object) to the page.
|
||||
mainPanel.Children.Add(vh)
|
||||
Me.Content = mainPanel
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
' Create a host visual derived from the FrameworkElement class.
|
||||
' This class provides layout, event handling, and container support for
|
||||
' the child visual objects.
|
||||
Public Class MyVisualHost
|
||||
Inherits FrameworkElement
|
||||
' Create a collection of child visual objects.
|
||||
Private _children As VisualCollection
|
||||
|
||||
Public Sub New()
|
||||
_children = New VisualCollection(Me)
|
||||
|
||||
' Add the DrawingVisual that represents the 3D object to the collection.
|
||||
_children.Add(Create3DVisualObject())
|
||||
End Sub
|
||||
|
||||
' Create a DrawingVisual that contains a 3D object.
|
||||
Private Function Create3DVisualObject() As DrawingVisual
|
||||
|
||||
' Declare scene objects.
|
||||
|
||||
' The Viewport3DVisual is used instead of the Viewport3D object because this 3D
|
||||
' object is drawn directly to the WPF visual layer. Using Viepwor3dVisual can provide
|
||||
' performance benefits over using Viewport3D although it does not support many of the
|
||||
' features that Viewport3D does.
|
||||
Dim myViewport3D As New Viewport3DVisual()
|
||||
Dim myModel3DGroup As New Model3DGroup()
|
||||
Dim myGeometryModel As New GeometryModel3D()
|
||||
Dim myModelVisual3D As New ModelVisual3D()
|
||||
|
||||
' Defines the camera used to view the 3D object. In order to view the 3D object,
|
||||
' the camera must be positioned and pointed such that the object is within view
|
||||
' of the camera.
|
||||
Dim myPCamera As New PerspectiveCamera()
|
||||
|
||||
' Specify where in the 3D scene the camera is.
|
||||
myPCamera.Position = New Point3D(0, 0, 2)
|
||||
|
||||
' Specify the direction that the camera is pointing.
|
||||
myPCamera.LookDirection = New Vector3D(0, 0, -1)
|
||||
|
||||
' Define camera's horizontal field of view in degrees.
|
||||
myPCamera.FieldOfView = 60
|
||||
|
||||
' Asign the camera to the viewport
|
||||
myViewport3D.Camera = myPCamera
|
||||
|
||||
' Define the lights cast in the scene. Without light, the 3D object cannot
|
||||
' be seen. Note: to illuminate an object from additional directions, create
|
||||
' additional lights.
|
||||
Dim myDirectionalLight As New DirectionalLight()
|
||||
myDirectionalLight.Color = Colors.White
|
||||
myDirectionalLight.Direction = New Vector3D(-0.61, -0.5, -0.61)
|
||||
|
||||
myModel3DGroup.Children.Add(myDirectionalLight)
|
||||
|
||||
' The geometry specifes the shape of the 3D plane. In this sample, a flat sheet
|
||||
' is created.
|
||||
Dim myMeshGeometry3D As New MeshGeometry3D()
|
||||
|
||||
' Create a collection of normal vectors for the MeshGeometry3D.
|
||||
Dim myNormalCollection As New Vector3DCollection()
|
||||
myNormalCollection.Add(New Vector3D(0, 0, 1))
|
||||
myNormalCollection.Add(New Vector3D(0, 0, 1))
|
||||
myNormalCollection.Add(New Vector3D(0, 0, 1))
|
||||
myNormalCollection.Add(New Vector3D(0, 0, 1))
|
||||
myNormalCollection.Add(New Vector3D(0, 0, 1))
|
||||
myNormalCollection.Add(New Vector3D(0, 0, 1))
|
||||
myMeshGeometry3D.Normals = myNormalCollection
|
||||
|
||||
' Create a collection of vertex positions for the MeshGeometry3D.
|
||||
Dim myPositionCollection As New Point3DCollection()
|
||||
myPositionCollection.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, -0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(-0.5, 0.5, 0.5))
|
||||
myPositionCollection.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
myMeshGeometry3D.Positions = myPositionCollection
|
||||
|
||||
' Create a collection of texture coordinates for the MeshGeometry3D.
|
||||
Dim myTextureCoordinatesCollection As New PointCollection()
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 0))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 0))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(1, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 1))
|
||||
myTextureCoordinatesCollection.Add(New Point(0, 0))
|
||||
myMeshGeometry3D.TextureCoordinates = myTextureCoordinatesCollection
|
||||
|
||||
' Create a collection of triangle indices for the MeshGeometry3D.
|
||||
Dim myTriangleIndicesCollection As New Int32Collection()
|
||||
myTriangleIndicesCollection.Add(0)
|
||||
myTriangleIndicesCollection.Add(1)
|
||||
myTriangleIndicesCollection.Add(2)
|
||||
myTriangleIndicesCollection.Add(3)
|
||||
myTriangleIndicesCollection.Add(4)
|
||||
myTriangleIndicesCollection.Add(5)
|
||||
myMeshGeometry3D.TriangleIndices = myTriangleIndicesCollection
|
||||
|
||||
' Apply the mesh to the geometry model.
|
||||
myGeometryModel.Geometry = myMeshGeometry3D
|
||||
|
||||
' The material specifies the material applied to the 3D object. In this sample a
|
||||
' linear gradient covers the surface of the 3D object.
|
||||
|
||||
' Create a horizontal linear gradient with four stops.
|
||||
Dim myHorizontalGradient As New LinearGradientBrush()
|
||||
myHorizontalGradient.StartPoint = New Point(0, 0.5)
|
||||
myHorizontalGradient.EndPoint = New Point(1, 0.5)
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Yellow, 0.0))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Red, 0.25))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.Blue, 0.75))
|
||||
myHorizontalGradient.GradientStops.Add(New GradientStop(Colors.LimeGreen, 1.0))
|
||||
|
||||
' Define material and apply to the mesh geometries.
|
||||
Dim myMaterial As New DiffuseMaterial(myHorizontalGradient)
|
||||
myGeometryModel.Material = myMaterial
|
||||
|
||||
' Apply a transform to the object. In this sample, a rotation transform is applied,
|
||||
' rendering the 3D object rotated.
|
||||
Dim myRotateTransform3D As New RotateTransform3D()
|
||||
Dim myAxisAngleRotation3d As New AxisAngleRotation3D()
|
||||
myAxisAngleRotation3d.Axis = New Vector3D(0, 3, 0)
|
||||
myAxisAngleRotation3d.Angle = 40
|
||||
myRotateTransform3D.Rotation = myAxisAngleRotation3d
|
||||
myGeometryModel.Transform = myRotateTransform3D
|
||||
|
||||
' Add the geometry model to the model group.
|
||||
myModel3DGroup.Children.Add(myGeometryModel)
|
||||
|
||||
' Add the group of models to the ModelVisual3d.
|
||||
myModelVisual3D.Content = myModel3DGroup
|
||||
|
||||
' Create a rectangle to view the 3D object in.
|
||||
Dim myRectangle As New Rect()
|
||||
myRectangle.Location = New Point(10, 5)
|
||||
myRectangle.Size = New Size(900, 900)
|
||||
|
||||
myViewport3D.Children.Add(myModelVisual3D)
|
||||
myViewport3D.Viewport = myRectangle
|
||||
|
||||
Dim dv As New DrawingVisual()
|
||||
dv.Children.Add(myViewport3D)
|
||||
Return dv
|
||||
End Function
|
||||
|
||||
' Provide a required override for the VisualChildCount property.
|
||||
Protected Overrides ReadOnly Property VisualChildrenCount() As Integer
|
||||
Get
|
||||
Return _children.Count
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Provide a required override for the GetVisualChild method.
|
||||
Protected Overrides Function GetVisualChild(ByVal index As Integer) As Visual
|
||||
If index < 0 OrElse index > _children.Count Then
|
||||
Throw New ArgumentOutOfRangeException()
|
||||
End If
|
||||
|
||||
Return CType(_children(index), Visual)
|
||||
End Function
|
||||
|
||||
' Provide a required override for the MeasureOverride method.
|
||||
Protected Overrides Function MeasureOverride(ByVal availableSize As Size) As Size
|
||||
' Return the value of the parameter.
|
||||
Return MyBase.MeasureOverride(availableSize)
|
||||
End Function
|
||||
|
||||
' Provide a required override for the ArrangeOverride method.
|
||||
Protected Overrides Function ArrangeOverride(ByVal finalSize As Size) As Size
|
||||
' Return the value of the parameter.
|
||||
Return MyBase.ArrangeOverride(finalSize)
|
||||
End Function
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
' </SnippetViewport3DVisualExampleWholePage>
|
||||
@@ -0,0 +1,44 @@
|
||||
<Application x:Class="create_cube.app"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Startup="AppStartingUp"
|
||||
>
|
||||
<Application.Resources>
|
||||
|
||||
<SolidColorBrush x:Key="blueBrush" Color="Blue" Opacity="1.0" />
|
||||
<SolidColorBrush x:Key="orangeBrush" Color="Orange" Opacity="1.0" />
|
||||
<SolidColorBrush x:Key="yellowBrush" Color="Yellow" Opacity="1.0" />
|
||||
<SolidColorBrush x:Key="redBrush" Color="Red" Opacity="1.0" />
|
||||
<SolidColorBrush x:Key="purpleBrush" Color="Purple" Opacity="1.0" />
|
||||
<SolidColorBrush x:Key="cyanBrush" Color="Cyan" Opacity="1.0" />
|
||||
|
||||
<DrawingBrush x:Key="patternBrush" Viewport="0,0,0.1,0.1" TileMode="Tile">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing Geometry="M0,0.1 L0.1,0 1,0.9, 0.9,1z"
|
||||
Brush="Gray" />
|
||||
<GeometryDrawing Geometry="M0.9,0 L1,0.1 0.1,1 0,0.9z"
|
||||
Brush="Gray" />
|
||||
<GeometryDrawing Geometry="M0.25,0.25 L0.5,0.125 0.75,0.25 0.5,0.5z"
|
||||
Brush="#FFFF00" />
|
||||
<GeometryDrawing Geometry="M0.25,0.75 L0.5,0.875 0.75,0.75 0.5,0.5z"
|
||||
Brush="Black" />
|
||||
<GeometryDrawing Geometry="M0.25,0.75 L0.125,0.5 0.25,0.25 0.5,0.5z"
|
||||
Brush="#FF0000" />
|
||||
<GeometryDrawing Geometry="M0.75,0.25 L0.875,0.5 0.75,0.75 0.5,0.5z"
|
||||
Brush="MediumBlue" />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
<LinearGradientBrush x:Key="gradientBrush" SpreadMethod="Repeat">
|
||||
<LinearGradientBrush.GradientStops>
|
||||
<GradientStop Color="Green" Offset="0" />
|
||||
<GradientStop Color="Blue" Offset="1" />
|
||||
</LinearGradientBrush.GradientStops>
|
||||
</LinearGradientBrush>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,19 @@
|
||||
Imports System.Windows
|
||||
Imports System.Data
|
||||
Imports System.Xml
|
||||
Imports System.Configuration
|
||||
|
||||
Namespace create_cube
|
||||
''' <summary>
|
||||
''' Interaction logic for app.xaml
|
||||
''' </summary>
|
||||
|
||||
Partial Public Class app
|
||||
Inherits Application
|
||||
Private Sub AppStartingUp(ByVal sender As Object, ByVal e As StartupEventArgs)
|
||||
Dim mainWindow As New Window1()
|
||||
mainWindow.Show()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,84 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{80C83525-676F-4A42-AE1D-41B6FE3293F6}</ProjectGuid>
|
||||
<RootNamespace></RootNamespace>
|
||||
<AssemblyName>create_cube</AssemblyName>
|
||||
<OutputType>winexe</OutputType>
|
||||
<ApplicationVersion>1.0.0.*</ApplicationVersion>
|
||||
<!-- Most people will use Publish dialog in Visual Studio to increment this -->
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>.\bin\Debug\</OutputPath>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>.\bin\Release\</OutputPath>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="WindowsFormsIntegration" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="app.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="Window1.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="app.xaml.vb">
|
||||
<DependentUpon>app.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
</EmbeddedResource>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Window1.xaml.vb" />
|
||||
<AppDesigner Include="My Project\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,36 @@
|
||||
#Region "Using directives"
|
||||
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.CompilerServices
|
||||
|
||||
#End Region
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
<Assembly: AssemblyTitle("create_cube")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyConfiguration("")>
|
||||
<Assembly: AssemblyCompany("Microsoft")>
|
||||
<Assembly: AssemblyProduct("create_cube")>
|
||||
<Assembly: AssemblyCopyright("Copyright @ Microsoft 2005")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: AssemblyCulture("")>
|
||||
|
||||
'In order to begin building localizable applications, set <UICulture>CultureYouAreCodingWith</UICulture> in your
|
||||
'.vbproj file inside a <PropertyGroup>. For example, if you are using US english in your source files, set the
|
||||
'<UICulture> to en-US. Then uncomment the NeutralResourceLanguage attribute below.
|
||||
'Update the "en-US" in the line below to match the UICulture setting in the project file.
|
||||
'[assembly: NeutralResourcesLanguage("en-US", UltimateFallbackResourceLocation.Satellite)]
|
||||
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Revision and Build Numbers
|
||||
' by using the '*' as shown below:
|
||||
<Assembly: AssemblyVersion("1.0.*")>
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,27 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:4.0.21008.0
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Namespace My
|
||||
|
||||
|
||||
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")>
|
||||
Friend NotInheritable Partial Class Settings
|
||||
Inherits System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared defaultInstance As Settings = (CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New Settings()), Settings))
|
||||
|
||||
Public Shared ReadOnly Property [Default]() As Settings
|
||||
Get
|
||||
Return defaultInstance
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='iso-8859-1'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,9 @@
|
||||
<Window x:Class="create_cube.Window1"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="create_cube"
|
||||
Loaded="WindowLoaded"
|
||||
Name="mainWindow"
|
||||
>
|
||||
|
||||
</Window>
|
||||
@@ -0,0 +1,371 @@
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Documents
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Media3D
|
||||
Imports System.Windows.Media.Animation
|
||||
Imports System.Windows.Shapes
|
||||
|
||||
|
||||
Namespace create_cube
|
||||
''' <summary>
|
||||
''' Interaction logic for Window1.xaml
|
||||
''' </summary>
|
||||
|
||||
Partial Public Class Window1
|
||||
Inherits Window
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
'<Snippet3DOverview3DN18>
|
||||
'some scene objects
|
||||
Private myViewport As New Viewport3D()
|
||||
'</Snippet3DOverview3DN18>
|
||||
Private side1 As New GeometryModel3D()
|
||||
Private side2 As New GeometryModel3D()
|
||||
Private side3 As New GeometryModel3D()
|
||||
Private side4 As New GeometryModel3D()
|
||||
Private side5 As New GeometryModel3D()
|
||||
Private side6 As New GeometryModel3D()
|
||||
Private myPCamera As New PerspectiveCamera()
|
||||
Private myDLight As New DirectionalLight()
|
||||
Private myAmbLight As New AmbientLight()
|
||||
Private myMaterials As New MaterialGroup()
|
||||
Private cube1TransformGroup As New Transform3DGroup()
|
||||
Private cube2TransformGroup As New Transform3DGroup()
|
||||
Private cube3TransformGroup As New Transform3DGroup()
|
||||
Private allModelsTransformGroup As New Transform3DGroup()
|
||||
Private allModels As New Model3DGroup()
|
||||
Private cubeModel_1 As New Model3DGroup()
|
||||
Private cubeModel_2 As New Model3DGroup()
|
||||
Private cubeModel_3 As New Model3DGroup()
|
||||
'<Snippet3DOverview3DN6>
|
||||
Private side1Plane As New MeshGeometry3D()
|
||||
'</Snippet3DOverview3DN6>
|
||||
Private side2Plane As New MeshGeometry3D()
|
||||
Private side3Plane As New MeshGeometry3D()
|
||||
Private side4Plane As New MeshGeometry3D()
|
||||
Private side5Plane As New MeshGeometry3D()
|
||||
Private side6Plane As New MeshGeometry3D()
|
||||
Private side1Material As New DiffuseMaterial()
|
||||
Private side2Material As New DiffuseMaterial()
|
||||
Private side3Material As New DiffuseMaterial()
|
||||
Private side4Material As New DiffuseMaterial()
|
||||
Private side5Material As New DiffuseMaterial()
|
||||
Private side6Material As New DiffuseMaterial()
|
||||
|
||||
|
||||
Private Sub WindowLoaded(ByVal sender As Object, ByVal e As EventArgs)
|
||||
DrawMeshes()
|
||||
DrawSomeModels()
|
||||
End Sub
|
||||
|
||||
Private Sub DrawSomeModels()
|
||||
myViewport.Name = "myViewport"
|
||||
Dim myModelVisual As New ModelVisual3D()
|
||||
|
||||
'Define lights and cameras
|
||||
myPCamera.FarPlaneDistance = 20
|
||||
myPCamera.NearPlaneDistance = 0
|
||||
myPCamera.FieldOfView = 50
|
||||
myPCamera.Position = New Point3D(-5, 2, 3)
|
||||
myPCamera.LookDirection = New Vector3D(5, -2, -3)
|
||||
myPCamera.UpDirection = New Vector3D(0, 1, 0)
|
||||
|
||||
myDLight.Color = Colors.White
|
||||
myDLight.Direction = New Vector3D(-3, -4, -5)
|
||||
|
||||
myAmbLight.Color = Colors.White
|
||||
|
||||
'set Geometry property of MeshGeometry3D
|
||||
side2.Geometry = side2Plane
|
||||
side6.Geometry = side6Plane
|
||||
side1.Geometry = side1Plane
|
||||
side3.Geometry = side3Plane
|
||||
side4.Geometry = side4Plane
|
||||
side5.Geometry = side5Plane
|
||||
|
||||
'create translations
|
||||
'<Snippet3DOverview3DN19>
|
||||
Dim cube2Translation As New TranslateTransform3D(New Vector3D(2, 0, 0))
|
||||
'</Snippet3DOverview3DN19>
|
||||
Dim cube3Translation As New TranslateTransform3D(New Vector3D(4, 0, 0))
|
||||
'<Snippet3DOverview3DN1>
|
||||
'Define a rotation
|
||||
Dim myRotateTransform As New RotateTransform3D(New AxisAngleRotation3D(New Vector3D(0, 1, 0), 1))
|
||||
'</Snippet3DOverview3DN1>
|
||||
'<Snippet3DOverview3DN2>
|
||||
'Define an animation for the rotation
|
||||
Dim myAnimation As New DoubleAnimation()
|
||||
myAnimation.From = 1
|
||||
myAnimation.To = 361
|
||||
myAnimation.Duration = New Duration(TimeSpan.FromMilliseconds(5000))
|
||||
myAnimation.RepeatBehavior = RepeatBehavior.Forever
|
||||
'</Snippet3DOverview3DN2>
|
||||
|
||||
'Define another animation
|
||||
'<Snippet3DOverview3DN3>
|
||||
Dim myVectorAnimation As New Vector3DAnimation(New Vector3D(-1, -1, -1), New Duration(TimeSpan.FromMilliseconds(5000)))
|
||||
myVectorAnimation.RepeatBehavior = RepeatBehavior.Forever
|
||||
'</Snippet3DOverview3DN3>
|
||||
|
||||
|
||||
myRotateTransform.Rotation.BeginAnimation(AxisAngleRotation3D.AngleProperty, myAnimation)
|
||||
'<Snippet3DOverview3DN4>
|
||||
myRotateTransform.Rotation.BeginAnimation(AxisAngleRotation3D.AxisProperty, myVectorAnimation)
|
||||
'</Snippet3DOverview3DN4>
|
||||
'<Snippet3DOverview3DN5>
|
||||
'Add transformation to the model
|
||||
cube1TransformGroup.Children.Add(myRotateTransform)
|
||||
'</Snippet3DOverview3DN5>
|
||||
|
||||
cube2TransformGroup.Children.Add(myRotateTransform)
|
||||
cube2TransformGroup.Children.Add(cube2Translation)
|
||||
|
||||
cube3TransformGroup.Children.Add(myRotateTransform)
|
||||
cube3TransformGroup.Children.Add(cube3Translation)
|
||||
|
||||
allModelsTransformGroup.Children.Add(myRotateTransform)
|
||||
|
||||
cubeModel_1.Children.Add(side1)
|
||||
cubeModel_1.Children.Add(side2)
|
||||
cubeModel_1.Children.Add(side3)
|
||||
cubeModel_1.Children.Add(side4)
|
||||
cubeModel_1.Children.Add(side5)
|
||||
cubeModel_1.Children.Add(side6)
|
||||
cubeModel_1.Transform = cube1TransformGroup
|
||||
|
||||
cubeModel_2.Children.Add(side1)
|
||||
cubeModel_2.Children.Add(side2)
|
||||
cubeModel_2.Children.Add(side3)
|
||||
cubeModel_2.Children.Add(side4)
|
||||
cubeModel_2.Children.Add(side5)
|
||||
cubeModel_2.Children.Add(side6)
|
||||
cubeModel_2.Transform = cube2TransformGroup
|
||||
|
||||
cubeModel_3.Children.Add(side1)
|
||||
cubeModel_3.Children.Add(side2)
|
||||
cubeModel_3.Children.Add(side3)
|
||||
cubeModel_3.Children.Add(side4)
|
||||
cubeModel_3.Children.Add(side5)
|
||||
cubeModel_3.Children.Add(side6)
|
||||
cubeModel_3.Transform = cube3TransformGroup
|
||||
|
||||
allModels.Transform = allModelsTransformGroup
|
||||
allModels.Children.Add(cubeModel_3)
|
||||
allModels.Children.Add(cubeModel_2)
|
||||
allModels.Children.Add(cubeModel_1)
|
||||
|
||||
allModels.Children.Add(myAmbLight)
|
||||
|
||||
myViewport.Camera = myPCamera
|
||||
myModelVisual.Content = allModels
|
||||
myViewport.Children.Add(myModelVisual)
|
||||
|
||||
mainWindow.Content = myViewport
|
||||
End Sub
|
||||
|
||||
Private Sub DrawMeshes()
|
||||
'side1-------------------------------------------------
|
||||
'<Snippet3DOverview3DN7>
|
||||
side1Plane.Positions.Add(New Point3D(-0.5, -0.5, -0.5))
|
||||
side1Plane.Positions.Add(New Point3D(-0.5, 0.5, -0.5))
|
||||
side1Plane.Positions.Add(New Point3D(0.5, 0.5, -0.5))
|
||||
side1Plane.Positions.Add(New Point3D(0.5, 0.5, -0.5))
|
||||
side1Plane.Positions.Add(New Point3D(0.5, -0.5, -0.5))
|
||||
side1Plane.Positions.Add(New Point3D(-0.5, -0.5, -0.5))
|
||||
|
||||
side1Plane.TriangleIndices.Add(0)
|
||||
side1Plane.TriangleIndices.Add(1)
|
||||
side1Plane.TriangleIndices.Add(2)
|
||||
side1Plane.TriangleIndices.Add(3)
|
||||
side1Plane.TriangleIndices.Add(4)
|
||||
side1Plane.TriangleIndices.Add(5)
|
||||
|
||||
side1Plane.Normals.Add(New Vector3D(0, 0, -1))
|
||||
side1Plane.Normals.Add(New Vector3D(0, 0, -1))
|
||||
side1Plane.Normals.Add(New Vector3D(0, 0, -1))
|
||||
side1Plane.Normals.Add(New Vector3D(0, 0, -1))
|
||||
side1Plane.Normals.Add(New Vector3D(0, 0, -1))
|
||||
side1Plane.Normals.Add(New Vector3D(0, 0, -1))
|
||||
|
||||
side1Plane.TextureCoordinates.Add(New Point(1, 0))
|
||||
side1Plane.TextureCoordinates.Add(New Point(1, 1))
|
||||
side1Plane.TextureCoordinates.Add(New Point(0, 1))
|
||||
side1Plane.TextureCoordinates.Add(New Point(0, 1))
|
||||
side1Plane.TextureCoordinates.Add(New Point(0, 0))
|
||||
side1Plane.TextureCoordinates.Add(New Point(1, 0))
|
||||
'</Snippet3DOverview3DN7>
|
||||
|
||||
'side2-------------------------------------------------
|
||||
side2Plane.Positions.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
side2Plane.Positions.Add(New Point3D(0.5, -0.5, 0.5))
|
||||
side2Plane.Positions.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
side2Plane.Positions.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
side2Plane.Positions.Add(New Point3D(-0.5, 0.5, 0.5))
|
||||
side2Plane.Positions.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
|
||||
side2Plane.TriangleIndices.Add(0)
|
||||
side2Plane.TriangleIndices.Add(1)
|
||||
side2Plane.TriangleIndices.Add(2)
|
||||
side2Plane.TriangleIndices.Add(3)
|
||||
side2Plane.TriangleIndices.Add(4)
|
||||
side2Plane.TriangleIndices.Add(5)
|
||||
|
||||
side2Plane.Normals.Add(New Vector3D(0, 0, 1))
|
||||
side2Plane.Normals.Add(New Vector3D(0, 0, 1))
|
||||
side2Plane.Normals.Add(New Vector3D(0, 0, 1))
|
||||
side2Plane.Normals.Add(New Vector3D(0, 0, 1))
|
||||
side2Plane.Normals.Add(New Vector3D(0, 0, 1))
|
||||
side2Plane.Normals.Add(New Vector3D(0, 0, 1))
|
||||
|
||||
side2Plane.TextureCoordinates.Add(New Point(0, 0))
|
||||
side2Plane.TextureCoordinates.Add(New Point(1, 0))
|
||||
side2Plane.TextureCoordinates.Add(New Point(1, 1))
|
||||
side2Plane.TextureCoordinates.Add(New Point(1, 1))
|
||||
side2Plane.TextureCoordinates.Add(New Point(0, 1))
|
||||
side2Plane.TextureCoordinates.Add(New Point(0, 0))
|
||||
|
||||
'side3-------------------------------------------------
|
||||
side3Plane.Positions.Add(New Point3D(-0.5, -0.5, -0.5))
|
||||
side3Plane.Positions.Add(New Point3D(0.5, -0.5, -0.5))
|
||||
side3Plane.Positions.Add(New Point3D(0.5, -0.5, 0.5))
|
||||
side3Plane.Positions.Add(New Point3D(0.5, -0.5, 0.5))
|
||||
side3Plane.Positions.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
side3Plane.Positions.Add(New Point3D(-0.5, -0.5, -0.5))
|
||||
|
||||
side3Plane.TriangleIndices.Add(0)
|
||||
side3Plane.TriangleIndices.Add(1)
|
||||
side3Plane.TriangleIndices.Add(2)
|
||||
side3Plane.TriangleIndices.Add(3)
|
||||
side3Plane.TriangleIndices.Add(4)
|
||||
side3Plane.TriangleIndices.Add(5)
|
||||
|
||||
side3Plane.Normals.Add(New Vector3D(0, -1, 0))
|
||||
side3Plane.Normals.Add(New Vector3D(0, -1, 0))
|
||||
side3Plane.Normals.Add(New Vector3D(0, -1, 0))
|
||||
side3Plane.Normals.Add(New Vector3D(0, -1, 0))
|
||||
side3Plane.Normals.Add(New Vector3D(0, -1, 0))
|
||||
side3Plane.Normals.Add(New Vector3D(0, -1, 0))
|
||||
|
||||
side3Plane.TextureCoordinates.Add(New Point(0, 0))
|
||||
side3Plane.TextureCoordinates.Add(New Point(1, 0))
|
||||
side3Plane.TextureCoordinates.Add(New Point(1, 1))
|
||||
side3Plane.TextureCoordinates.Add(New Point(1, 1))
|
||||
side3Plane.TextureCoordinates.Add(New Point(0, 1))
|
||||
side3Plane.TextureCoordinates.Add(New Point(0, 0))
|
||||
|
||||
'side4-------------------------------------------------
|
||||
side4Plane.Positions.Add(New Point3D(0.5, -0.5, -0.5))
|
||||
side4Plane.Positions.Add(New Point3D(0.5, 0.5, -0.5))
|
||||
side4Plane.Positions.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
side4Plane.Positions.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
side4Plane.Positions.Add(New Point3D(0.5, -0.5, 0.5))
|
||||
side4Plane.Positions.Add(New Point3D(0.5, -0.5, -0.5))
|
||||
|
||||
side4Plane.TriangleIndices.Add(0)
|
||||
side4Plane.TriangleIndices.Add(1)
|
||||
side4Plane.TriangleIndices.Add(2)
|
||||
side4Plane.TriangleIndices.Add(3)
|
||||
side4Plane.TriangleIndices.Add(4)
|
||||
side4Plane.TriangleIndices.Add(5)
|
||||
|
||||
side4Plane.Normals.Add(New Vector3D(1, 0, 0))
|
||||
side4Plane.Normals.Add(New Vector3D(1, 0, 0))
|
||||
side4Plane.Normals.Add(New Vector3D(1, 0, 0))
|
||||
side4Plane.Normals.Add(New Vector3D(1, 0, 0))
|
||||
side4Plane.Normals.Add(New Vector3D(1, 0, 0))
|
||||
side4Plane.Normals.Add(New Vector3D(1, 0, 0))
|
||||
|
||||
side4Plane.TextureCoordinates.Add(New Point(1, 0))
|
||||
side4Plane.TextureCoordinates.Add(New Point(1, 1))
|
||||
side4Plane.TextureCoordinates.Add(New Point(0, 1))
|
||||
side4Plane.TextureCoordinates.Add(New Point(0, 1))
|
||||
side4Plane.TextureCoordinates.Add(New Point(0, 0))
|
||||
side4Plane.TextureCoordinates.Add(New Point(1, 0))
|
||||
|
||||
'side5-------------------------------------------------
|
||||
side5Plane.Positions.Add(New Point3D(0.5, 0.5, -0.5))
|
||||
side5Plane.Positions.Add(New Point3D(-0.5, 0.5, -0.5))
|
||||
side5Plane.Positions.Add(New Point3D(-0.5, 0.5, 0.5))
|
||||
side5Plane.Positions.Add(New Point3D(-0.5, 0.5, 0.5))
|
||||
side5Plane.Positions.Add(New Point3D(0.5, 0.5, 0.5))
|
||||
side5Plane.Positions.Add(New Point3D(0.5, 0.5, -0.5))
|
||||
|
||||
side5Plane.TriangleIndices.Add(0)
|
||||
side5Plane.TriangleIndices.Add(1)
|
||||
side5Plane.TriangleIndices.Add(2)
|
||||
side5Plane.TriangleIndices.Add(3)
|
||||
side5Plane.TriangleIndices.Add(4)
|
||||
side5Plane.TriangleIndices.Add(5)
|
||||
|
||||
side5Plane.Normals.Add(New Vector3D(0, 1, 0))
|
||||
side5Plane.Normals.Add(New Vector3D(0, 1, 0))
|
||||
side5Plane.Normals.Add(New Vector3D(0, 1, 0))
|
||||
side5Plane.Normals.Add(New Vector3D(0, 1, 0))
|
||||
side5Plane.Normals.Add(New Vector3D(0, 1, 0))
|
||||
side5Plane.Normals.Add(New Vector3D(0, 1, 0))
|
||||
|
||||
side5Plane.TextureCoordinates.Add(New Point(1, 1))
|
||||
side5Plane.TextureCoordinates.Add(New Point(0, 1))
|
||||
side5Plane.TextureCoordinates.Add(New Point(0, 0))
|
||||
side5Plane.TextureCoordinates.Add(New Point(0, 0))
|
||||
side5Plane.TextureCoordinates.Add(New Point(1, 0))
|
||||
side5Plane.TextureCoordinates.Add(New Point(1, 1))
|
||||
|
||||
'side6-------------------------------------------------
|
||||
side6Plane.Positions.Add(New Point3D(-0.5, 0.5, -0.5))
|
||||
side6Plane.Positions.Add(New Point3D(-0.5, -0.5, -0.5))
|
||||
side6Plane.Positions.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
side6Plane.Positions.Add(New Point3D(-0.5, -0.5, 0.5))
|
||||
side6Plane.Positions.Add(New Point3D(-0.5, 0.5, 0.5))
|
||||
side6Plane.Positions.Add(New Point3D(-0.5, 0.5, -0.5))
|
||||
|
||||
side6Plane.TriangleIndices.Add(0)
|
||||
side6Plane.TriangleIndices.Add(1)
|
||||
side6Plane.TriangleIndices.Add(2)
|
||||
side6Plane.TriangleIndices.Add(3)
|
||||
side6Plane.TriangleIndices.Add(4)
|
||||
side6Plane.TriangleIndices.Add(5)
|
||||
|
||||
side6Plane.Normals.Add(New Vector3D(-1, 0, 0))
|
||||
side6Plane.Normals.Add(New Vector3D(-1, 0, 0))
|
||||
side6Plane.Normals.Add(New Vector3D(-1, 0, 0))
|
||||
side6Plane.Normals.Add(New Vector3D(-1, 0, 0))
|
||||
side6Plane.Normals.Add(New Vector3D(-1, 0, 0))
|
||||
side6Plane.Normals.Add(New Vector3D(-1, 0, 0))
|
||||
|
||||
side6Plane.TextureCoordinates.Add(New Point(0, 1))
|
||||
side6Plane.TextureCoordinates.Add(New Point(0, 0))
|
||||
side6Plane.TextureCoordinates.Add(New Point(1, 0))
|
||||
side6Plane.TextureCoordinates.Add(New Point(1, 0))
|
||||
side6Plane.TextureCoordinates.Add(New Point(1, 1))
|
||||
side6Plane.TextureCoordinates.Add(New Point(0, 1))
|
||||
|
||||
|
||||
'Set Brush property for the Material applied to each face
|
||||
Dim side2Material As New DiffuseMaterial(CType(Application.Current.Resources("yellowBrush"), Brush))
|
||||
Dim side6Material As New DiffuseMaterial(CType(Application.Current.Resources("orangeBrush"), Brush))
|
||||
|
||||
|
||||
Dim side1Material As New DiffuseMaterial(CType(Application.Current.Resources("blueBrush"), Brush))
|
||||
Dim side3Material As New DiffuseMaterial(CType(Application.Current.Resources("redBrush"), Brush))
|
||||
Dim side4Material As New DiffuseMaterial(CType(Application.Current.Resources("cyanBrush"), Brush))
|
||||
'<Snippet3DOverview3DN8>
|
||||
Dim side5Material As New DiffuseMaterial(CType(Application.Current.Resources("patternBrush"), Brush))
|
||||
'</Snippet3DOverview3DN8>
|
||||
|
||||
|
||||
side2.Material = side2Material
|
||||
side6.Material = side6Material
|
||||
side1.Material = side1Material
|
||||
side3.Material = side3Material
|
||||
side4.Material = side4Material
|
||||
side5.Material = side5Material
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,76 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{94FDF812-AE88-4310-AF76-73BC5610711B}</ProjectGuid>
|
||||
<RootNamespace></RootNamespace>
|
||||
<AssemblyName>ADODataSetSample</AssemblyName>
|
||||
<OutputType>winexe</OutputType>
|
||||
<TargetType>$(OutputType)</TargetType>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<UICulture>en-US</UICulture>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>.\bin\Debug\</OutputPath>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>.\bin\Release\</OutputPath>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<!-- Imports must come after all PropertyGroups and before ItemGroup -->
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="app.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="Window1.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="app.xaml.vb" />
|
||||
<Compile Include="IntColorConverter.vb" />
|
||||
<Compile Include="Window1.xaml.vb">
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<!-- To workaround a VisualStudio Beta1 problem -->
|
||||
<TemporaryHackCompile Include="$(BaseOutputPath)**\*$(GeneratedFileExtension)" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
|
||||
copy BookData.mdb "%APPDATA%"
|
||||
|
||||
@echo Copied BookData.mdb sample database to "%APPDATA%"
|
||||
@@ -0,0 +1,21 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Windows.Data
|
||||
Imports System.Globalization
|
||||
|
||||
Namespace SDKSample
|
||||
Public Class IntColorConverter
|
||||
Implements IValueConverter
|
||||
Public Function Convert(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.Convert
|
||||
Dim numValue As Integer = CInt(Fix(value))
|
||||
If numValue < 350 Then
|
||||
Return System.Windows.Media.Brushes.Green
|
||||
Else
|
||||
Return System.Windows.Media.Brushes.Red
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Function ConvertBack(ByVal value As Object, ByVal targetType As Type, ByVal parameter As Object, ByVal culture As CultureInfo) As Object Implements IValueConverter.ConvertBack
|
||||
Return Nothing
|
||||
End Function
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,13 @@
|
||||
|
||||
ADODataSetSample
|
||||
|
||||
Demonstrates filling a DataSet by connecting to an Access *.mdb file using
|
||||
ADO API in the Loaded event
|
||||
|
||||
To run:
|
||||
(1) Execute the CopyMDB.cmd. This copies the BookData.mdb to your
|
||||
"Application Data" folder, typically located at
|
||||
C:\Documents and Settings\YourAlias\Application Data/ADODataSetSample
|
||||
|
||||
(2) Using MSBUILD or from within Visual Studio build the sample using the
|
||||
vbproj file and execute bin\debug\ADODataSetSample.exe
|
||||
@@ -0,0 +1,37 @@
|
||||
<Window x:Class="SDKSample.Window1"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:c="clr-namespace:SDKSample"
|
||||
Title="ADODataSetSample"
|
||||
Loaded="OnInit"
|
||||
Background="White"
|
||||
Height="250"
|
||||
Width="450">
|
||||
|
||||
<StackPanel>
|
||||
<StackPanel.Resources>
|
||||
<c:IntColorConverter x:Key="MyConverter"/>
|
||||
|
||||
<DataTemplate x:Key="BookItemTemplate">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="250" />
|
||||
<ColumnDefinition Width="100" />
|
||||
<ColumnDefinition Width="*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text="{Binding Path=Title}" Grid.Column="0"
|
||||
FontWeight="Bold" />
|
||||
<TextBlock Text="{Binding Path=ISBN}" Grid.Column="1" />
|
||||
<TextBlock Grid.Column="2" Text="{Binding Path=NumPages}"
|
||||
Background="{Binding Path=NumPages,
|
||||
Converter={StaticResource MyConverter}}"/>
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</StackPanel.Resources>
|
||||
|
||||
<ListBox Name="myListBox" Height="200"
|
||||
ItemsSource="{Binding Path=BookTable}"
|
||||
ItemTemplate ="{StaticResource BookItemTemplate}"/>
|
||||
<Button Click="OnClick">Add Record</Button>
|
||||
</StackPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,62 @@
|
||||
Imports System.Collections
|
||||
Imports System.ComponentModel
|
||||
Imports System.Data
|
||||
Imports System.Data.OleDb
|
||||
Imports System.IO
|
||||
Imports System.Globalization
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Documents
|
||||
|
||||
|
||||
Namespace SDKSample
|
||||
''' <summary>
|
||||
''' Interaction logic for Window1.xaml
|
||||
''' </summary>
|
||||
|
||||
Partial Public Class Window1
|
||||
Inherits Window
|
||||
Public Sub New()
|
||||
Me.InitializeComponent()
|
||||
End Sub
|
||||
|
||||
Private appPath As String
|
||||
Private ReadOnly Property AppDataPath() As String
|
||||
Get
|
||||
If String.IsNullOrEmpty(appPath) Then
|
||||
appPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
|
||||
End If
|
||||
Return appPath
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'<Snippet1>
|
||||
Private myDataSet As DataSet
|
||||
|
||||
Private Sub OnInit(ByVal sender As Object, ByVal e As EventArgs)
|
||||
Dim mdbFile As String = Path.Combine(AppDataPath, "BookData.mdb")
|
||||
Dim connString As String = String.Format("Provider=Microsoft.Jet.OLEDB.4.0; Data Source={0}", mdbFile)
|
||||
Dim conn As New OleDbConnection(connString)
|
||||
Dim adapter As New OleDbDataAdapter("SELECT * FROM BookTable;", conn)
|
||||
|
||||
myDataSet = New DataSet()
|
||||
adapter.Fill(myDataSet, "BookTable")
|
||||
|
||||
' myListBox is a ListBox control.
|
||||
' Set the DataContext of the ListBox to myDataSet
|
||||
myListBox.DataContext = myDataSet
|
||||
End Sub
|
||||
'</Snippet1>
|
||||
|
||||
Private Sub OnClick(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
Dim myDataTable As DataTable = myDataSet.Tables("BookTable")
|
||||
Dim row As DataRow = myDataTable.NewRow()
|
||||
|
||||
row("Title") = "Microsoft C# Language Specifications"
|
||||
row("ISBN") = "0-7356-1448-2"
|
||||
row("NumPages") = 431
|
||||
myDataTable.Rows.Add(row)
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
</configuration>
|
||||
@@ -0,0 +1,8 @@
|
||||
<Application x:Class="SDKSample.app"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Startup="AppStartingUp"
|
||||
>
|
||||
<Application.Resources>
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,18 @@
|
||||
Imports System.Windows
|
||||
Imports System.Data
|
||||
Imports System.Xml
|
||||
Imports System.Configuration
|
||||
|
||||
Namespace SDKSample
|
||||
''' <summary>
|
||||
''' Interaction logic for app.xaml
|
||||
''' </summary>
|
||||
|
||||
Partial Public Class app
|
||||
Inherits Application
|
||||
Private Sub AppStartingUp(ByVal sender As Object, ByVal e As StartupEventArgs)
|
||||
Dim mainWindow As New Window1()
|
||||
mainWindow.Show()
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,105 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{29892B1F-32A4-4668-AA6E-DC4E49B3860E}</ProjectGuid>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>AdornerForStrokes</RootNamespace>
|
||||
<AssemblyName>AdornerForStrokes</AssemblyName>
|
||||
<ApplicationVersion>1.0.0.*</ApplicationVersion>
|
||||
<!-- Most people will use Publish dialog in Visual Studio to increment this -->
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<IncrementalBuild>true</IncrementalBuild>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DocumentationFile>AdornerForStrokes.xml</DocumentationFile>
|
||||
<NoWarn>42016,42017,42018,42019,42032,42314</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<IncrementalBuild>false</IncrementalBuild>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DocumentationFile>AdornerForStrokes.xml</DocumentationFile>
|
||||
<NoWarn>42016,42017,42018,42019,42032,42314</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
<Reference Include="ReachFramework" />
|
||||
<Reference Include="System.Printing" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Security.Authorization" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="MyApp.xaml" />
|
||||
<Page Include="Window1.xaml" />
|
||||
<Compile Include="MyApp.xaml.vb" />
|
||||
<Compile Include="Window1.xaml.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Windows" />
|
||||
<Import Include="System.Windows.Controls" />
|
||||
<Import Include="System.Windows.Documents" />
|
||||
<Import Include="System.Windows.Shapes" />
|
||||
<Import Include="System.Windows.Media" />
|
||||
<Import Include="System.Windows.Navigation" />
|
||||
<Import Include="System.Windows.Data" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="My Project\AssemblyInfo.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="My Project\MyEvents.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="RotatingAdornerForStrokes.vb" />
|
||||
<None Include="app.config" />
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="My Project\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,58 @@
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Globalization
|
||||
Imports System.Resources
|
||||
Imports System.Windows
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("AdornerForStrokes")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("MS")>
|
||||
<Assembly: AssemblyProduct("AdornerForStrokes")>
|
||||
<Assembly: AssemblyCopyright("Copyright @ MS 2006")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: ComVisible(false)>
|
||||
|
||||
'In order to begin building localizable applications, set
|
||||
'<UICulture>CultureYouAreCodingWith</UICulture> in your .vbproj file
|
||||
'inside a <PropertyGroup>. For example, if you are using US english
|
||||
'in your source files, set the <UICulture> to "en-US". Then uncomment the
|
||||
'NeutralResourceLanguage attribute below. Update the "en-US" in the line
|
||||
'below to match the UICulture setting in the project file.
|
||||
|
||||
'<Assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)>
|
||||
|
||||
|
||||
'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
|
||||
'1st parameter: where theme specific resource dictionaries are located
|
||||
'(used if a resource is not found in the page,
|
||||
' or application resource dictionaries)
|
||||
|
||||
'2nd parameter: where the generic resource dictionary is located
|
||||
'(used if a resource is not found in the page,
|
||||
'app, and any theme specific resource dictionaries)
|
||||
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>
|
||||
|
||||
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("b83a122b-fa69-474b-ad30-93d18d8a63e2")>
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
@@ -0,0 +1,13 @@
|
||||
Namespace My
|
||||
Partial Friend Class MyApplication
|
||||
|
||||
'Use the editor window dropdowns in the Application pane of the Project Designer to handle MyApplication Events
|
||||
'
|
||||
'Startup: Raised when the application starts, before the startup form is created.
|
||||
'Shutdown: Raised after all application forms are closed. This event is not raised if the application is terminating abnormally.
|
||||
'UnhandledException: Raised if the application encounters an unhandled exception.
|
||||
'StartupNextInstance: Raised when launching a single-instance application and the application is already active.
|
||||
'NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,61 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <autogenerated>
|
||||
' This code was generated by a tool.
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </autogenerated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict Off
|
||||
Option Explicit On
|
||||
|
||||
Imports System.IO
|
||||
Imports System.Resources
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'<summary>
|
||||
' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'</summary>
|
||||
'This class was auto-generated by the Strongly Typed Resource Builder
|
||||
'class via a tool like ResGen or Visual Studio.NET.
|
||||
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
'with the /str option, or rebuild your VS project.
|
||||
<Global.Microsoft.VisualBasic.HideModuleName()> _
|
||||
Module MyResources
|
||||
|
||||
Private _resMgr As System.Resources.ResourceManager
|
||||
|
||||
Private _resCulture As System.Globalization.CultureInfo
|
||||
|
||||
'<summary>
|
||||
' Returns the cached ResourceManager instance used by this class.
|
||||
'</summary>
|
||||
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Public ReadOnly Property ResourceManager() As System.Resources.ResourceManager
|
||||
Get
|
||||
If (_resMgr Is Nothing) Then
|
||||
Dim temp As System.Resources.ResourceManager = New System.Resources.ResourceManager("$safeprojectname$.MyResources", GetType(MyResources).Assembly)
|
||||
System.Threading.Thread.MemoryBarrier
|
||||
_resMgr = temp
|
||||
End If
|
||||
Return _resMgr
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'<summary>
|
||||
' Overrides the current thread's CurrentUICulture property for all
|
||||
' resource lookups using this strongly typed resource class.
|
||||
'</summary>
|
||||
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Public Property Culture() As System.Globalization.CultureInfo
|
||||
Get
|
||||
Return _resCulture
|
||||
End Get
|
||||
Set
|
||||
_resCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,38 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <autogenerated>
|
||||
' This code was generated by a tool.
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </autogenerated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict Off
|
||||
Option Explicit On
|
||||
|
||||
|
||||
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared m_Value As MySettings
|
||||
|
||||
Private Shared m_SyncObject As Object = New Object
|
||||
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Public Shared ReadOnly Property Value() As MySettings
|
||||
Get
|
||||
If (MySettings.m_Value Is Nothing) Then
|
||||
System.Threading.Monitor.Enter(MySettings.m_SyncObject)
|
||||
If (MySettings.m_Value Is Nothing) Then
|
||||
Try
|
||||
MySettings.m_Value = New MySettings
|
||||
Finally
|
||||
System.Threading.Monitor.Exit(MySettings.m_SyncObject)
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
Return MySettings.m_Value
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,8 @@
|
||||
<Application x:Class="MyApp"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="Window1.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,5 @@
|
||||
' Interaction logic for MyApp.xaml
|
||||
Partial Public Class MyApp
|
||||
Inherits Application
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,199 @@
|
||||
'<Snippet1>
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Controls.Primitives
|
||||
Imports System.Windows.Documents
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Shapes
|
||||
Imports System.Windows.Ink
|
||||
|
||||
|
||||
|
||||
Public Class RotatingStrokesAdorner
|
||||
Inherits Adorner
|
||||
|
||||
' The Thumb to drag to rotate the strokes.
|
||||
Private rotateHandle As Thumb
|
||||
|
||||
' The surrounding boarder.
|
||||
Private outline As Path
|
||||
|
||||
Private visualChildren As VisualCollection
|
||||
|
||||
' The center of the strokes.
|
||||
Private center As Point
|
||||
Private lastAngle As Double
|
||||
|
||||
Private rotation As RotateTransform
|
||||
|
||||
Private Const HANDLEMARGIN As Integer = 10
|
||||
|
||||
' The bounds of the Strokes;
|
||||
Private strokeBounds As Rect = Rect.Empty
|
||||
|
||||
|
||||
Public Sub New(ByVal adornedElement As UIElement)
|
||||
MyBase.New(adornedElement)
|
||||
|
||||
visualChildren = New VisualCollection(Me)
|
||||
rotateHandle = New Thumb()
|
||||
rotateHandle.Cursor = Cursors.SizeNWSE
|
||||
rotateHandle.Width = 20
|
||||
rotateHandle.Height = 20
|
||||
rotateHandle.Background = Brushes.Blue
|
||||
|
||||
AddHandler rotateHandle.DragDelta, _
|
||||
AddressOf rotateHandle_DragDelta
|
||||
AddHandler rotateHandle.DragCompleted, _
|
||||
AddressOf rotateHandle_DragCompleted
|
||||
|
||||
outline = New Path()
|
||||
outline.Stroke = Brushes.Blue
|
||||
outline.StrokeThickness = 1
|
||||
|
||||
visualChildren.Add(outline)
|
||||
visualChildren.Add(rotateHandle)
|
||||
|
||||
strokeBounds = AdornedStrokes.GetBounds()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Draw the rotation handle and the outline of
|
||||
''' the element.
|
||||
''' </summary>
|
||||
''' <param name="finalSize">The final area within the
|
||||
''' parent that this element should use to arrange
|
||||
''' itself and its children.</param>
|
||||
''' <returns>The actual size used. </returns>
|
||||
Protected Overrides Function ArrangeOverride(ByVal finalSize As Size) _
|
||||
As Size
|
||||
|
||||
If strokeBounds.IsEmpty Then
|
||||
Return finalSize
|
||||
End If
|
||||
|
||||
center = New Point(strokeBounds.X + strokeBounds.Width / 2, _
|
||||
strokeBounds.Y + strokeBounds.Height / 2)
|
||||
|
||||
' The rectangle that determines the position of the Thumb.
|
||||
Dim handleRect As New Rect(strokeBounds.X, _
|
||||
strokeBounds.Y - (strokeBounds.Height / 2 + _
|
||||
HANDLEMARGIN), _
|
||||
strokeBounds.Width, strokeBounds.Height)
|
||||
|
||||
If Not (rotation Is Nothing) Then
|
||||
handleRect.Transform(rotation.Value)
|
||||
End If
|
||||
|
||||
' Draws the thumb and the rectangle around the strokes.
|
||||
rotateHandle.Arrange(handleRect)
|
||||
outline.Data = New RectangleGeometry(strokeBounds)
|
||||
outline.Arrange(New Rect(finalSize))
|
||||
Return finalSize
|
||||
|
||||
End Function 'ArrangeOverride
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Rotates the rectangle representing the
|
||||
''' strokes' bounds as the user drags the
|
||||
''' Thumb.
|
||||
''' </summary>
|
||||
Private Sub rotateHandle_DragDelta(ByVal sender As Object, _
|
||||
ByVal e As DragDeltaEventArgs)
|
||||
|
||||
'Find the angle of which to rotate the shape. Use the right
|
||||
'triangle that uses the center and the mouse's position
|
||||
'as vertices for the hypotenuse.
|
||||
Dim pos As Point = Mouse.GetPosition(Me)
|
||||
|
||||
Dim deltaX As Double = pos.X - center.X
|
||||
Dim deltaY As Double = pos.Y - center.Y
|
||||
|
||||
If deltaY.Equals(0) Then
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim tan As Double = deltaX / deltaY
|
||||
Dim angle As Double = Math.Atan(tan)
|
||||
|
||||
' Convert to degrees.
|
||||
angle = angle * 180 / Math.PI
|
||||
|
||||
' If the mouse crosses the vertical center,
|
||||
' find the complementary angle.
|
||||
If deltaY > 0 Then
|
||||
angle = 180 - Math.Abs(angle)
|
||||
End If
|
||||
|
||||
' Rotate left if the mouse moves left and right
|
||||
' if the mouse moves right.
|
||||
If deltaX < 0 Then
|
||||
angle = -Math.Abs(angle)
|
||||
Else
|
||||
angle = Math.Abs(angle)
|
||||
End If
|
||||
|
||||
If Double.IsNaN(angle) Then
|
||||
Return
|
||||
End If
|
||||
|
||||
' Apply the rotation to the strokes' outline.
|
||||
rotation = New RotateTransform(angle, center.X, center.Y)
|
||||
outline.RenderTransform = rotation
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' Rotates the strokes to the same angle as outline.
|
||||
''' </summary>
|
||||
Private Sub rotateHandle_DragCompleted(ByVal sender As Object, _
|
||||
ByVal e As DragCompletedEventArgs)
|
||||
|
||||
If rotation Is Nothing Then
|
||||
Return
|
||||
End If
|
||||
|
||||
' Rotate the strokes to match the new angle.
|
||||
Dim mat As New Matrix()
|
||||
mat.RotateAt(rotation.Angle - lastAngle, center.X, center.Y)
|
||||
AdornedStrokes.Transform(mat, True)
|
||||
|
||||
' Save the angle of the last rotation.
|
||||
lastAngle = rotation.Angle
|
||||
|
||||
' Redraw rotateHandle.
|
||||
Me.InvalidateArrange()
|
||||
|
||||
End Sub
|
||||
|
||||
''' <summary>
|
||||
''' Gets the strokes of the adorned element
|
||||
''' (in this case, an InkPresenter).
|
||||
''' </summary>
|
||||
Private ReadOnly Property AdornedStrokes() As StrokeCollection
|
||||
Get
|
||||
Return CType(AdornedElement, InkPresenter).Strokes
|
||||
End Get
|
||||
End Property
|
||||
|
||||
' Override the VisualChildrenCount and
|
||||
' GetVisualChild properties to interface with
|
||||
' the adorner's visual collection.
|
||||
|
||||
Protected Overrides ReadOnly Property VisualChildrenCount() As Integer
|
||||
Get
|
||||
Return visualChildren.Count
|
||||
End Get
|
||||
End Property
|
||||
|
||||
Protected Overrides Function GetVisualChild(ByVal index As Integer) As Visual
|
||||
Return visualChildren(index)
|
||||
|
||||
End Function 'GetVisualChild
|
||||
End Class
|
||||
'</Snippet1>
|
||||
@@ -0,0 +1,20 @@
|
||||
<Window x:Class="Window1"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Rotating Strokes Adorner" Height="500" Width="500"
|
||||
Loaded="Window_Loaded"
|
||||
>
|
||||
<InkPresenter Name="inkPresenter1" >
|
||||
<InkPresenter.Strokes>
|
||||
ALMDAwRIEEU1BQE4GSAyCQD0/wIB6SI6RTMJAPifAgFaIDpFOAgA/gMAAACAfxEAAIA/
|
||||
HwkRAAAAAAAA8D8KlwE1h/CPd4SB4NA4OicCjcGjcClcDj8Lh8DgUSkUmmU6nUmoUuk
|
||||
0ukUCQKVyehz+rzuly+bzORx+BReRQ+RTaRCH8JyXhPbgcPicPh8Pg8Oh0qk1SoVGrV
|
||||
Oo0mi0Xi8rm9Xr9Dqc/p87pc/k8XicHicOj1CoVKtVmv1GqUaiUHlYg8el4akXK7m7T
|
||||
cSJgQgghEyym5zx6+PACk4dhPwg/fhCbxY8dp4p2tqnqxyvbPO85z1X1aswhvCd94Tq
|
||||
55DRUGi4+Tk6OLn4KLkoOejo6ig5KTioOPCD9LlHmrzNxMRCCc3ec8+fe4AKQBmE/Cw
|
||||
9+FkPNvlOdkrYsWa+acp3Z8erOIT8JaX4S6+FbFilbHNvvPXNJbFqluxghKc5DkwrVF
|
||||
GEEIJ1w5eLKYAKShuF+Dnr4Oa8HVHXNPFFFFho8VFkqsMRYuuvJxiF+F9r4Xx8HFiqs
|
||||
FNcirnweDw9+LvvvixdV0+GhONmlj3wjNOcSCEYTnfLy4oA
|
||||
</InkPresenter.Strokes>
|
||||
</InkPresenter>
|
||||
</Window>
|
||||
@@ -0,0 +1,42 @@
|
||||
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Text
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Documents
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Imaging
|
||||
Imports System.Windows.Shapes
|
||||
Imports System.Windows.Ink
|
||||
|
||||
|
||||
'/ <summary>
|
||||
'/ Interaction logic for Window1.xaml
|
||||
'/ </summary>
|
||||
|
||||
Partial Class Window1
|
||||
Inherits Window '
|
||||
|
||||
Private adorner As RotatingStrokesAdorner
|
||||
Private adornerLayer As AdornerLayer
|
||||
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
|
||||
End Sub
|
||||
|
||||
'<Snippet3>
|
||||
Private Sub Window_Loaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
|
||||
' Add the rotating strokes adorner to the InkPresenter.
|
||||
adornerLayer = adornerLayer.GetAdornerLayer(inkPresenter1)
|
||||
adorner = New RotatingStrokesAdorner(inkPresenter1)
|
||||
|
||||
adornerLayer.Add(adorner)
|
||||
|
||||
End Sub
|
||||
'</Snippet3>
|
||||
End Class
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<system.diagnostics>
|
||||
<sources>
|
||||
<!-- This section defines the logging configuration for My.Application.Log in Windows Forms projects.-->
|
||||
<source name="Microsoft.VisualBasic.MyServices.Log.WindowsFormsSource" switchName="DefaultSwitch">
|
||||
<listeners>
|
||||
<add name="FileLog"/>
|
||||
<!-- Uncomment the below section to write to the Application Event Log -->
|
||||
<!--<add name="EventLog"/>-->
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
<switches>
|
||||
<add name="DefaultSwitch" value="Information" />
|
||||
</switches>
|
||||
<sharedListeners>
|
||||
<add name="FileLog"
|
||||
type="System.Diagnostics.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.1200.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
|
||||
initializeData="FileLogWriter"/>
|
||||
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
|
||||
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
|
||||
</sharedListeners>
|
||||
</system.diagnostics>
|
||||
</configuration>
|
||||
@@ -0,0 +1,72 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{EBD6662E-7DCC-439C-872A-5C9846264604}</ProjectGuid>
|
||||
<RootNamespace></RootNamespace>
|
||||
<AssemblyName>AdornersMiscCode</AssemblyName>
|
||||
<OutputType>winexe</OutputType>
|
||||
<ApplicationVersion>1.0.0.*</ApplicationVersion>
|
||||
<!-- Most people will use Publish dialog in Visual Studio to increment this -->
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>.\bin\Debug\</OutputPath>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>.\bin\Release\</OutputPath>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="MyApp.xaml">
|
||||
<SubType>
|
||||
</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="Window1.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="MyApp.xaml.vb">
|
||||
<DependentUpon>MyApp.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Window1.xaml.vb">
|
||||
<DependentUpon>Window1.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,9 @@
|
||||
<Application x:Class="AdornersMiscCode.MyApp"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Startup="AppStartup"
|
||||
>
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,20 @@
|
||||
Imports System.Windows
|
||||
Imports System.Data
|
||||
Imports System.Xml
|
||||
Imports System.Configuration
|
||||
|
||||
Namespace AdornersMiscCode
|
||||
''' <summary>
|
||||
''' Interaction logic for MyApp.xaml
|
||||
''' </summary>
|
||||
|
||||
Partial Public Class MyApp
|
||||
Inherits Application
|
||||
|
||||
Private Sub AppStartup(ByVal sender As Object, ByVal args As StartupEventArgs)
|
||||
Dim mainWindow As New Window1()
|
||||
mainWindow.Show()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,42 @@
|
||||
<Window x:Class="AdornersMiscCode.Window1"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="AdornersMiscCode" Loaded="WindowLoaded"
|
||||
>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<TextBox
|
||||
Name="myTextBox"
|
||||
Height="50" Width="150"
|
||||
Grid.Row="0"
|
||||
Text="My adorned TextBox."
|
||||
/>
|
||||
<StackPanel Name="myStackPanel" Grid.Row="1">
|
||||
<Button
|
||||
Width="150"
|
||||
Content="My adorned button."
|
||||
/>
|
||||
<Button
|
||||
Width="150"
|
||||
Content="My other adorned button."
|
||||
/>
|
||||
</StackPanel>
|
||||
<AdornerDecorator Name="myAD" Grid.Row="2">
|
||||
<StackPanel Grid.Row="2">
|
||||
<Button
|
||||
Width="150"
|
||||
Content="My adorned button."
|
||||
/>
|
||||
<Button
|
||||
Width="150"
|
||||
Content="My other adorned button."
|
||||
/>
|
||||
</StackPanel>
|
||||
</AdornerDecorator>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,98 @@
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Documents
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Shapes
|
||||
|
||||
Namespace AdornersMiscCode
|
||||
''' <summary>
|
||||
''' Interaction logic for Window1.xaml
|
||||
''' </summary>
|
||||
|
||||
Partial Public Class Window1
|
||||
Inherits Window
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
|
||||
Private myAdornerLayer As AdornerLayer
|
||||
|
||||
Private Sub WindowLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
myAdornerLayer = AdornerLayer.GetAdornerLayer(myTextBox)
|
||||
|
||||
' <Snippet_RemoveSpecificAdornerLong>
|
||||
Dim toRemoveArray() As Adorner = myAdornerLayer.GetAdorners(myTextBox)
|
||||
Dim toRemove As Adorner
|
||||
If toRemoveArray IsNot Nothing Then
|
||||
toRemove = toRemoveArray(0)
|
||||
myAdornerLayer.Remove(toRemove)
|
||||
End If
|
||||
' </Snippet_RemoveSpecificAdornerLong>
|
||||
|
||||
' <Snippet_RemoveSpecificAdornerShort>
|
||||
Try
|
||||
myAdornerLayer.Remove((myAdornerLayer.GetAdorners(myTextBox))(0))
|
||||
Catch
|
||||
End Try
|
||||
' </Snippet_RemoveSpecificAdornerShort>
|
||||
For Each toAdorn As UIElement In myStackPanel.Children
|
||||
myAdornerLayer.Add(New SimpleCircleAdorner(toAdorn))
|
||||
Next toAdorn
|
||||
|
||||
' <Snippet_RemoveAllAdornersLong>
|
||||
toRemoveArray = myAdornerLayer.GetAdorners(myTextBox)
|
||||
If toRemoveArray IsNot Nothing Then
|
||||
For x As Integer = 0 To toRemoveArray.Length - 1
|
||||
myAdornerLayer.Remove(toRemoveArray(x))
|
||||
Next x
|
||||
End If
|
||||
' </Snippet_RemoveAllAdornersLong>
|
||||
|
||||
' <Snippet_RemoveAllAdornersShort>
|
||||
Try
|
||||
For Each toRemove In myAdornerLayer.GetAdorners(myTextBox)
|
||||
myAdornerLayer.Remove(toRemove)
|
||||
Next toRemove
|
||||
Catch
|
||||
End Try
|
||||
' </Snippet_RemoveAllAdornersShort>
|
||||
End Sub
|
||||
|
||||
' Sample event handler:
|
||||
' private void ButtonClick(object sender, RoutedEventArgs e) {}
|
||||
|
||||
' Adorners must subclass the abstract base class Adorner.
|
||||
Public Class SimpleCircleAdorner
|
||||
Inherits Adorner
|
||||
' Be sure to call the base class constructor.
|
||||
Public Sub New(ByVal adornedElement As UIElement)
|
||||
MyBase.New(adornedElement)
|
||||
' Any constructor implementation...
|
||||
End Sub
|
||||
|
||||
' A common way to implement an adorner's rendering behavior is to override the OnRender
|
||||
' method, which is called by the layout subsystem as part of a rendering pass.
|
||||
'<SnippetUIElementDesiredSize>
|
||||
Protected Overrides Sub OnRender(ByVal drawingContext As DrawingContext)
|
||||
' Get a rectangle that represents the desired size of the rendered element
|
||||
' after the rendering pass. This will be used to draw at the corners of the
|
||||
' adorned element.
|
||||
Dim adornedElementRect As New Rect(Me.AdornedElement.RenderSize)
|
||||
|
||||
' Some arbitrary drawing implements.
|
||||
Dim renderBrush As New SolidColorBrush(Colors.Green)
|
||||
renderBrush.Opacity = 0.2
|
||||
Dim renderPen As New Pen(New SolidColorBrush(Colors.Navy), 1.5)
|
||||
Dim renderRadius As Double = 5.0
|
||||
|
||||
' Just draw a circle at each corner.
|
||||
drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopLeft, renderRadius, renderRadius)
|
||||
drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopRight, renderRadius, renderRadius)
|
||||
drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomLeft, renderRadius, renderRadius)
|
||||
drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomRight, renderRadius, renderRadius)
|
||||
End Sub
|
||||
'</SnippetUIElementDesiredSize>
|
||||
End Class
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,46 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<AssemblyName>SDKSample</AssemblyName>
|
||||
<TargetType>winexe</TargetType>
|
||||
<Configuration Condition="'$(Configuration)'==''">Debug</Configuration>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="app.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="Window1.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Window1.xaml.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,31 @@
|
||||
<Window x:Class="SDKSample.Window1"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="SimpleAdorner" Loaded="WindowLoaded" Height="400" Width="600"
|
||||
>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<!-- An arbitrary UIElement to adorn, with arbitrary characteristics. -->
|
||||
<TextBox
|
||||
Name="myTextBox"
|
||||
Height="50" Width="150"
|
||||
Grid.Row="0"
|
||||
Text="My adorned TextBox."
|
||||
/>
|
||||
<StackPanel Name="myStackPanel" Grid.Row="1">
|
||||
<Button
|
||||
Name="myButton1"
|
||||
Width="150"
|
||||
Content="My adorned button."
|
||||
/>
|
||||
<Button
|
||||
Name="myButton2"
|
||||
Width="150"
|
||||
Content="My other adorned button."
|
||||
/>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,59 @@
|
||||
Imports System
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Documents
|
||||
Imports System.Windows.Media
|
||||
|
||||
Namespace SDKSample
|
||||
|
||||
'@ <summary>
|
||||
'@ Interaction logic for Window1.xaml
|
||||
'@ </summary>
|
||||
|
||||
Partial Public Class Window1
|
||||
Inherits Window
|
||||
|
||||
Dim myAdornerLayer As System.Windows.Documents.AdornerLayer
|
||||
|
||||
Private Sub WindowLoaded(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
'<Snippet_AdornSingleElement>
|
||||
myAdornerLayer = AdornerLayer.GetAdornerLayer(myTextBox)
|
||||
myAdornerLayer.Add(New SimpleCircleAdorner(myTextBox))
|
||||
'</Snippet_AdornSingleElement>
|
||||
|
||||
'<Snippet_AdornChildren>
|
||||
For Each toAdorn As UIElement In myStackPanel.Children
|
||||
myAdornerLayer.Add(New SimpleCircleAdorner(toAdorn))
|
||||
Next
|
||||
|
||||
'</Snippet_AdornChildren>
|
||||
End Sub
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
'<Snippet_SimpleCircleAdornerBody>
|
||||
Public Class SimpleCircleAdorner
|
||||
Inherits Adorner
|
||||
Sub New(ByVal adornedElement As UIElement)
|
||||
MyBase.New(adornedElement)
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnRender(ByVal drawingContext As System.Windows.Media.DrawingContext)
|
||||
MyBase.OnRender(drawingContext)
|
||||
Dim adornedElementRect As New Rect(AdornedElement.DesiredSize)
|
||||
Dim renderBrush As New SolidColorBrush(Colors.Green)
|
||||
renderBrush.Opacity = 0.2
|
||||
Dim renderPen As New Pen(New SolidColorBrush(Colors.Navy), 1.5)
|
||||
Dim renderRadius As Double
|
||||
renderRadius = 5.0
|
||||
|
||||
'Draw a circle at each corner.
|
||||
drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopLeft, renderRadius, renderRadius)
|
||||
drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.TopRight, renderRadius, renderRadius)
|
||||
drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomLeft, renderRadius, renderRadius)
|
||||
drawingContext.DrawEllipse(renderBrush, renderPen, adornedElementRect.BottomRight, renderRadius, renderRadius)
|
||||
End Sub
|
||||
End Class
|
||||
'</Snippet_SimpleCircleAdornerBody>
|
||||
End Namespace
|
||||
@@ -0,0 +1,4 @@
|
||||
<Application
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="Window1.xaml"/>
|
||||
@@ -0,0 +1,107 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{314F5F57-5994-4E77-8F69-939542DDFED2}</ProjectGuid>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>AdavancedInkTopicsSamples</RootNamespace>
|
||||
<AssemblyName>AdavancedInkTopicsSamples</AssemblyName>
|
||||
<ApplicationVersion>1.0.0.*</ApplicationVersion>
|
||||
<!-- Most people will use Publish dialog in Visual Studio to increment this -->
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<IncrementalBuild>true</IncrementalBuild>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DocumentationFile>AdavancedInkTopicsSamples.xml</DocumentationFile>
|
||||
<NoWarn>42016,42017,42018,42019,42032,42314</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
<IncrementalBuild>false</IncrementalBuild>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DocumentationFile>AdavancedInkTopicsSamples.xml</DocumentationFile>
|
||||
<NoWarn>42016,42017,42018,42019,42032,42314</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
<Reference Include="ReachFramework" />
|
||||
<Reference Include="System.Printing" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.Security.Authorization" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="MyApp.xaml" />
|
||||
<Page Include="Window1.xaml" />
|
||||
<Compile Include="MyApp.xaml.vb" />
|
||||
<Compile Include="Window1.xaml.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Import Include="Microsoft.VisualBasic" />
|
||||
<Import Include="System" />
|
||||
<Import Include="System.Collections" />
|
||||
<Import Include="System.Diagnostics" />
|
||||
<Import Include="System.Windows" />
|
||||
<Import Include="System.Windows.Controls" />
|
||||
<Import Include="System.Windows.Documents" />
|
||||
<Import Include="System.Windows.Shapes" />
|
||||
<Import Include="System.Windows.Media" />
|
||||
<Import Include="System.Windows.Navigation" />
|
||||
<Import Include="System.Windows.Data" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DynamicRenderer.vb" />
|
||||
<Compile Include="My Project\AssemblyInfo.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<Compile Include="My Project\MyEvents.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="StylusControl.vb" />
|
||||
<Compile Include="StylusControlSnippets.vb" />
|
||||
<None Include="app.config" />
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>VbMyResourcesResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
<CustomToolNamespace>My.Resources</CustomToolNamespace>
|
||||
<SubType>Designer</SubType>
|
||||
</EmbeddedResource>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<AppDesigner Include="My Project\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,179 @@
|
||||
'<Snippet19>
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Input.StylusPlugIns
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Ink
|
||||
'</Snippet19>
|
||||
|
||||
'<Snippet1>
|
||||
' A StylusPlugin that renders ink with a linear gradient brush effect.
|
||||
Class CustomDynamicRenderer
|
||||
Inherits DynamicRenderer
|
||||
<ThreadStatic()> _
|
||||
Private Shared brush As Brush = Nothing
|
||||
|
||||
<ThreadStatic()> _
|
||||
Private Shared pen As Pen = Nothing
|
||||
|
||||
Private prevPoint As Point
|
||||
|
||||
|
||||
Protected Overrides Sub OnStylusDown(ByVal rawStylusInput As RawStylusInput)
|
||||
' Allocate memory to store the previous point to draw from.
|
||||
prevPoint = New Point(Double.NegativeInfinity, Double.NegativeInfinity)
|
||||
MyBase.OnStylusDown(rawStylusInput)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Overrides Sub OnDraw(ByVal drawingContext As DrawingContext, _
|
||||
ByVal stylusPoints As StylusPointCollection, _
|
||||
ByVal geometry As Geometry, _
|
||||
ByVal fillBrush As Brush)
|
||||
|
||||
' Create a new Brush, if necessary.
|
||||
If brush Is Nothing Then
|
||||
brush = New LinearGradientBrush(Colors.Red, Colors.Blue, 20.0)
|
||||
End If
|
||||
|
||||
' Create a new Pen, if necessary.
|
||||
If pen Is Nothing Then
|
||||
pen = New Pen(brush, 2.0)
|
||||
End If
|
||||
|
||||
' Draw linear gradient ellipses between
|
||||
' all the StylusPoints that have come in.
|
||||
Dim i As Integer
|
||||
For i = 0 To stylusPoints.Count - 1
|
||||
|
||||
Dim pt As Point = CType(stylusPoints(i), Point)
|
||||
Dim v As Vector = Point.Subtract(prevPoint, pt)
|
||||
|
||||
' Only draw if we are at least 4 units away
|
||||
' from the end of the last ellipse. Otherwise,
|
||||
' we're just redrawing and wasting cycles.
|
||||
If v.Length > 4 Then
|
||||
' Set the thickness of the stroke based
|
||||
' on how hard the user pressed.
|
||||
Dim radius As Double = stylusPoints(i).PressureFactor * 10.0
|
||||
drawingContext.DrawEllipse(brush, pen, pt, radius, radius)
|
||||
prevPoint = pt
|
||||
End If
|
||||
Next i
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
'</Snippet1>
|
||||
|
||||
'<Snippet2>
|
||||
' A class for rendering custom strokes
|
||||
Class CustomStroke
|
||||
Inherits Stroke
|
||||
Private brush As Brush
|
||||
Private pen As Pen
|
||||
|
||||
|
||||
Public Sub New(ByVal stylusPoints As StylusPointCollection)
|
||||
MyBase.New(stylusPoints)
|
||||
' Create the Brush and Pen used for drawing.
|
||||
brush = New LinearGradientBrush(Colors.Red, Colors.Blue, 20.0)
|
||||
pen = New Pen(brush, 2.0)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Overrides Sub DrawCore(ByVal drawingContext As DrawingContext, _
|
||||
ByVal drawingAttributes As DrawingAttributes)
|
||||
|
||||
' Allocate memory to store the previous point to draw from.
|
||||
Dim prevPoint As New Point(Double.NegativeInfinity, Double.NegativeInfinity)
|
||||
|
||||
' Draw linear gradient ellipses between
|
||||
' all the StylusPoints in the Stroke.
|
||||
Dim i As Integer
|
||||
For i = 0 To Me.StylusPoints.Count - 1
|
||||
Dim pt As Point = CType(Me.StylusPoints(i), Point)
|
||||
Dim v As Vector = Point.Subtract(prevPoint, pt)
|
||||
|
||||
' Only draw if we are at least 4 units away
|
||||
' from the end of the last ellipse. Otherwise,
|
||||
' we're just redrawing and wasting cycles.
|
||||
If v.Length > 4 Then
|
||||
' Set the thickness of the stroke
|
||||
' based on how hard the user pressed.
|
||||
Dim radius As Double = Me.StylusPoints(i).PressureFactor * 10.0
|
||||
drawingContext.DrawEllipse(brush, pen, pt, radius, radius)
|
||||
prevPoint = pt
|
||||
End If
|
||||
Next i
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
'</Snippet2>
|
||||
|
||||
'<Snippet3>
|
||||
' A StylusPlugin that restricts the input area.
|
||||
Class FilterPlugin
|
||||
Inherits StylusPlugIn
|
||||
|
||||
Protected Overrides Sub OnStylusDown(ByVal rawStylusInput As RawStylusInput)
|
||||
' Call the base class before modifying the data.
|
||||
MyBase.OnStylusDown(rawStylusInput)
|
||||
|
||||
' Restrict the stylus input.
|
||||
Filter(rawStylusInput)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Overrides Sub OnStylusMove(ByVal rawStylusInput As RawStylusInput)
|
||||
' Call the base class before modifying the data.
|
||||
MyBase.OnStylusMove(rawStylusInput)
|
||||
|
||||
' Restrict the stylus input.
|
||||
Filter(rawStylusInput)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Overrides Sub OnStylusUp(ByVal rawStylusInput As RawStylusInput)
|
||||
' Call the base class before modifying the data.
|
||||
MyBase.OnStylusUp(rawStylusInput)
|
||||
|
||||
' Restrict the stylus input
|
||||
Filter(rawStylusInput)
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub Filter(ByVal rawStylusInput As RawStylusInput)
|
||||
' Get the StylusPoints that have come in.
|
||||
Dim stylusPoints As StylusPointCollection = rawStylusInput.GetStylusPoints()
|
||||
|
||||
' Modify the (X,Y) data to move the points
|
||||
' inside the acceptable input area, if necessary.
|
||||
Dim i As Integer
|
||||
For i = 0 To stylusPoints.Count - 1
|
||||
Dim sp As StylusPoint = stylusPoints(i)
|
||||
If sp.X < 50 Then
|
||||
sp.X = 50
|
||||
End If
|
||||
If sp.X > 250 Then
|
||||
sp.X = 250
|
||||
End If
|
||||
If sp.Y < 50 Then
|
||||
sp.Y = 50
|
||||
End If
|
||||
If sp.Y > 250 Then
|
||||
sp.Y = 250
|
||||
End If
|
||||
stylusPoints(i) = sp
|
||||
Next i
|
||||
|
||||
' Copy the modified StylusPoints back to the RawStylusInput.
|
||||
rawStylusInput.SetStylusPoints(stylusPoints)
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
'</Snippet3>
|
||||
@@ -0,0 +1,58 @@
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.InteropServices
|
||||
Imports System.Globalization
|
||||
Imports System.Resources
|
||||
Imports System.Windows
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
|
||||
' Review the values of the assembly attributes
|
||||
|
||||
<Assembly: AssemblyTitle("AdavancedInkTopicsSamples")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyCompany("MS")>
|
||||
<Assembly: AssemblyProduct("AdavancedInkTopicsSamples")>
|
||||
<Assembly: AssemblyCopyright("Copyright @ MS 2006")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: ComVisible(false)>
|
||||
|
||||
'In order to begin building localizable applications, set
|
||||
'<UICulture>CultureYouAreCodingWith</UICulture> in your .vbproj file
|
||||
'inside a <PropertyGroup>. For example, if you are using US english
|
||||
'in your source files, set the <UICulture> to "en-US". Then uncomment the
|
||||
'NeutralResourceLanguage attribute below. Update the "en-US" in the line
|
||||
'below to match the UICulture setting in the project file.
|
||||
|
||||
'<Assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)>
|
||||
|
||||
|
||||
'The ThemeInfo attribute describes where any theme specific and generic resource dictionaries can be found.
|
||||
'1st parameter: where theme specific resource dictionaries are located
|
||||
'(used if a resource is not found in the page,
|
||||
' or application resource dictionaries)
|
||||
|
||||
'2nd parameter: where the generic resource dictionary is located
|
||||
'(used if a resource is not found in the page,
|
||||
'app, and any theme specific resource dictionaries)
|
||||
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>
|
||||
|
||||
|
||||
|
||||
'The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
<Assembly: Guid("56c570d9-240d-4cc8-a762-fad160b349a3")>
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Build and Revision Numbers
|
||||
' by using the '*' as shown below:
|
||||
' <Assembly: AssemblyVersion("1.0.*")>
|
||||
|
||||
<Assembly: AssemblyVersion("1.0.0.0")>
|
||||
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
||||
@@ -0,0 +1,13 @@
|
||||
Namespace My
|
||||
Partial Friend Class MyApplication
|
||||
|
||||
'Use the editor window dropdowns in the Application pane of the Project Designer to handle MyApplication Events
|
||||
'
|
||||
'Startup: Raised when the application starts, before the startup form is created.
|
||||
'Shutdown: Raised after all application forms are closed. This event is not raised if the application is terminating abnormally.
|
||||
'UnhandledException: Raised if the application encounters an unhandled exception.
|
||||
'StartupNextInstance: Raised when launching a single-instance application and the application is already active.
|
||||
'NetworkAvailabilityChanged: Raised when the network connection is connected or disconnected.
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,61 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <autogenerated>
|
||||
' This code was generated by a tool.
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </autogenerated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict Off
|
||||
Option Explicit On
|
||||
|
||||
Imports System.IO
|
||||
Imports System.Resources
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
'<summary>
|
||||
' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
'</summary>
|
||||
'This class was auto-generated by the Strongly Typed Resource Builder
|
||||
'class via a tool like ResGen or Visual Studio.NET.
|
||||
'To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
'with the /str option, or rebuild your VS project.
|
||||
<Global.Microsoft.VisualBasic.HideModuleName()> _
|
||||
Module MyResources
|
||||
|
||||
Private _resMgr As System.Resources.ResourceManager
|
||||
|
||||
Private _resCulture As System.Globalization.CultureInfo
|
||||
|
||||
'<summary>
|
||||
' Returns the cached ResourceManager instance used by this class.
|
||||
'</summary>
|
||||
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Public ReadOnly Property ResourceManager() As System.Resources.ResourceManager
|
||||
Get
|
||||
If (_resMgr Is Nothing) Then
|
||||
Dim temp As System.Resources.ResourceManager = New System.Resources.ResourceManager("$safeprojectname$.MyResources", GetType(MyResources).Assembly)
|
||||
System.Threading.Thread.MemoryBarrier
|
||||
_resMgr = temp
|
||||
End If
|
||||
Return _resMgr
|
||||
End Get
|
||||
End Property
|
||||
|
||||
'<summary>
|
||||
' Overrides the current thread's CurrentUICulture property for all
|
||||
' resource lookups using this strongly typed resource class.
|
||||
'</summary>
|
||||
<System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Advanced)> _
|
||||
Public Property Culture() As System.Globalization.CultureInfo
|
||||
Get
|
||||
Return _resCulture
|
||||
End Get
|
||||
Set
|
||||
_resCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
@@ -0,0 +1,38 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <autogenerated>
|
||||
' This code was generated by a tool.
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </autogenerated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
Option Strict Off
|
||||
Option Explicit On
|
||||
|
||||
|
||||
|
||||
Partial Friend NotInheritable Class MySettings
|
||||
Inherits System.Configuration.ApplicationSettingsBase
|
||||
|
||||
Private Shared m_Value As MySettings
|
||||
|
||||
Private Shared m_SyncObject As Object = New Object
|
||||
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Public Shared ReadOnly Property Value() As MySettings
|
||||
Get
|
||||
If (MySettings.m_Value Is Nothing) Then
|
||||
System.Threading.Monitor.Enter(MySettings.m_SyncObject)
|
||||
If (MySettings.m_Value Is Nothing) Then
|
||||
Try
|
||||
MySettings.m_Value = New MySettings
|
||||
Finally
|
||||
System.Threading.Monitor.Exit(MySettings.m_SyncObject)
|
||||
End Try
|
||||
End If
|
||||
End If
|
||||
Return MySettings.m_Value
|
||||
End Get
|
||||
End Property
|
||||
End Class
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
@@ -0,0 +1,8 @@
|
||||
<Application x:Class="MyApp"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="Window1.xaml">
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,40 @@
|
||||
|
||||
Imports System.Windows
|
||||
Imports System.Data
|
||||
Imports System.Xml
|
||||
Imports System.Configuration
|
||||
|
||||
|
||||
'/ <summary>
|
||||
'/ Interaction logic for MyApp.xaml
|
||||
'/ </summary>
|
||||
|
||||
Class MyApp
|
||||
Inherits Application
|
||||
'
|
||||
'ToDo: Error processing original source shown below
|
||||
'
|
||||
' public partial class MyApp : Application
|
||||
'------------^--- 'class', 'struct', 'interface' or 'delegate' expected
|
||||
'
|
||||
'ToDo: Error processing original source shown below
|
||||
'
|
||||
' public partial class MyApp : Application
|
||||
'--------------------^--- Syntax error: ';' expected
|
||||
'public MyApp()
|
||||
' : base()
|
||||
'{
|
||||
' Window1 win = new Window1();
|
||||
' win.Show();
|
||||
'}
|
||||
Private Sub AppStartup(ByVal sender As Object, ByVal args As StartupEventArgs)
|
||||
Dim mainWindow As New Window1()
|
||||
mainWindow.Show()
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
'
|
||||
'ToDo: Error processing original source shown below
|
||||
' }
|
||||
'}
|
||||
'-^--- expression expected
|
||||
@@ -0,0 +1,177 @@
|
||||
'<Snippet20>
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Text
|
||||
Imports System.Windows.Ink
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Input.StylusPlugIns
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows
|
||||
'</Snippet20>
|
||||
|
||||
'<Snippet6>
|
||||
' A control for managing ink input
|
||||
Class InkControl
|
||||
Inherits Label
|
||||
Private ip As InkPresenter
|
||||
Private dr As DynamicRenderer
|
||||
|
||||
' The StylusPointsCollection that gathers points
|
||||
' before Stroke from is created.
|
||||
Private stylusPoints As StylusPointCollection = Nothing
|
||||
|
||||
|
||||
Public Sub New()
|
||||
' Add an InkPresenter for drawing.
|
||||
ip = New InkPresenter()
|
||||
Me.Content = ip
|
||||
|
||||
' Add a dynamic renderer that
|
||||
' draws ink as it "flows" from the stylus.
|
||||
dr = New DynamicRenderer()
|
||||
ip.AttachVisuals(dr.RootVisual, dr.DrawingAttributes)
|
||||
Me.StylusPlugIns.Add(dr)
|
||||
|
||||
Dim cdr As New CustomDynamicRenderer()
|
||||
ip.AttachVisuals(cdr.RootVisual, cdr.DrawingAttributes)
|
||||
Me.StylusPlugIns.Add(cdr)
|
||||
|
||||
End Sub
|
||||
|
||||
Shared Sub New()
|
||||
|
||||
' Allow ink to be drawn only within the bounds of the control.
|
||||
Dim owner As Type = GetType(InkControl)
|
||||
ClipToBoundsProperty.OverrideMetadata(owner, New FrameworkPropertyMetadata(True))
|
||||
|
||||
End Sub
|
||||
|
||||
'<Snippet7>
|
||||
Protected Overrides Sub OnStylusDown(ByVal e As StylusDownEventArgs)
|
||||
' Capture the stylus so all stylus input is routed to this control.
|
||||
Stylus.Capture(Me)
|
||||
|
||||
' Allocate memory for the StylusPointsCollection and
|
||||
' add the StylusPoints that have come in so far.
|
||||
stylusPoints = New StylusPointCollection()
|
||||
Dim eventPoints As StylusPointCollection = e.GetStylusPoints(Me, stylusPoints.Description)
|
||||
|
||||
stylusPoints.Add(eventPoints)
|
||||
|
||||
End Sub
|
||||
'</Snippet7>
|
||||
|
||||
'<Snippet8>
|
||||
Protected Overrides Sub OnStylusMove(ByVal e As StylusEventArgs)
|
||||
|
||||
If stylusPoints Is Nothing Then
|
||||
Return
|
||||
End If
|
||||
|
||||
' Add the StylusPoints that have come in since the
|
||||
' last call to OnStylusMove.
|
||||
Dim newStylusPoints As StylusPointCollection = e.GetStylusPoints(Me, stylusPoints.Description)
|
||||
stylusPoints.Add(newStylusPoints)
|
||||
|
||||
End Sub
|
||||
'</Snippet8>
|
||||
|
||||
'<Snippet10>
|
||||
Protected Overrides Sub OnStylusUp(ByVal e As StylusEventArgs)
|
||||
' Allocate memory for the StylusPointsCollection, if necessary.
|
||||
If stylusPoints Is Nothing Then
|
||||
Return
|
||||
End If
|
||||
|
||||
' Add the StylusPoints that have come in since the
|
||||
' last call to OnStylusMove.
|
||||
Dim newStylusPoints As StylusPointCollection = e.GetStylusPoints(Me, stylusPoints.Description)
|
||||
stylusPoints.Add(newStylusPoints)
|
||||
|
||||
' Create a new stroke from all the StylusPoints since OnStylusDown.
|
||||
Dim stroke As New Stroke(stylusPoints)
|
||||
|
||||
' Add the new stroke to the Strokes collection of the InkPresenter.
|
||||
ip.Strokes.Add(stroke)
|
||||
|
||||
' Clear the StylusPointsCollection.
|
||||
stylusPoints = Nothing
|
||||
|
||||
' Release stylus capture.
|
||||
Stylus.Capture(Nothing)
|
||||
|
||||
End Sub
|
||||
'</Snippet10>
|
||||
|
||||
'<Snippet11>
|
||||
Protected Overrides Sub OnMouseLeftButtonDown(ByVal e As MouseButtonEventArgs)
|
||||
|
||||
MyBase.OnMouseLeftButtonDown(e)
|
||||
|
||||
' If a stylus generated this event, return.
|
||||
If Not (e.StylusDevice Is Nothing) Then
|
||||
Return
|
||||
End If
|
||||
|
||||
' Start collecting the points.
|
||||
stylusPoints = New StylusPointCollection()
|
||||
Dim pt As Point = e.GetPosition(Me)
|
||||
stylusPoints.Add(New StylusPoint(pt.X, pt.Y))
|
||||
|
||||
End Sub
|
||||
'</Snippet11>
|
||||
|
||||
'<Snippet12>
|
||||
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
|
||||
|
||||
MyBase.OnMouseMove(e)
|
||||
|
||||
' If a stylus generated this event, return.
|
||||
If Not (e.StylusDevice Is Nothing) Then
|
||||
Return
|
||||
End If
|
||||
|
||||
' Don't collect points unless the left mouse button
|
||||
' is down.
|
||||
If e.LeftButton = MouseButtonState.Released Then
|
||||
Return
|
||||
End If
|
||||
|
||||
If stylusPoints Is Nothing Then
|
||||
Return
|
||||
End If
|
||||
|
||||
Dim pt As Point = e.GetPosition(Me)
|
||||
stylusPoints.Add(New StylusPoint(pt.X, pt.Y))
|
||||
|
||||
End Sub
|
||||
'</Snippet12>
|
||||
|
||||
'<Snippet13>
|
||||
Protected Overrides Sub OnMouseLeftButtonUp(ByVal e As MouseButtonEventArgs)
|
||||
|
||||
MyBase.OnMouseLeftButtonUp(e)
|
||||
|
||||
' If a stylus generated this event, return.
|
||||
If Not (e.StylusDevice Is Nothing) Then
|
||||
Return
|
||||
End If
|
||||
|
||||
If stylusPoints Is Nothing Then
|
||||
stylusPoints = New StylusPointCollection()
|
||||
End If
|
||||
|
||||
Dim pt As Point = e.GetPosition(Me)
|
||||
stylusPoints.Add(New StylusPoint(pt.X, pt.Y))
|
||||
|
||||
' Create a stroke and add it to the InkPresenter.
|
||||
Dim stroke As New Stroke(stylusPoints)
|
||||
stroke.DrawingAttributes = dr.DrawingAttributes
|
||||
ip.Strokes.Add(stroke)
|
||||
|
||||
stylusPoints = Nothing
|
||||
|
||||
End Sub
|
||||
'</Snippet13>
|
||||
End Class
|
||||
'</Snippet6>
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Text
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Input.StylusPlugIns
|
||||
|
||||
|
||||
Namespace StylusControlSnippets
|
||||
|
||||
'<Snippet14>
|
||||
Class InkControl
|
||||
Inherits Label
|
||||
'</Snippet14>
|
||||
|
||||
Private dr As DynamicRenderer
|
||||
|
||||
Private ip As InkPresenter
|
||||
|
||||
|
||||
'<Snippet17>
|
||||
Public Sub New()
|
||||
'</Snippet17>
|
||||
' Add an InkPresenter for drawing.
|
||||
ip = New InkPresenter()
|
||||
Me.Content = ip
|
||||
|
||||
'<Snippet18>
|
||||
' Add a dynamic renderer that
|
||||
' draws ink as it "flows" from the stylus.
|
||||
dr = New DynamicRenderer()
|
||||
ip.AttachVisuals(dr.RootVisual, dr.DrawingAttributes)
|
||||
Me.StylusPlugIns.Add(dr)
|
||||
|
||||
End Sub
|
||||
'</Snippet18>
|
||||
|
||||
'<Snippet15>
|
||||
End Class
|
||||
'</Snippet15>
|
||||
End Namespace 'StylusControlSnippets
|
||||
|
||||
Namespace snippets2
|
||||
|
||||
Class InkControl
|
||||
Inherits Label
|
||||
'<Snippet16>
|
||||
Private ip As InkPresenter
|
||||
|
||||
Public Sub New()
|
||||
' Add an InkPresenter for drawing.
|
||||
ip = New InkPresenter()
|
||||
Me.Content = ip
|
||||
|
||||
End Sub
|
||||
'</Snippet16>
|
||||
End Class
|
||||
End Namespace 'snippets2
|
||||
@@ -0,0 +1,11 @@
|
||||
<Window x:Class="Window1"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="AdavancedInkTopicsSamples"
|
||||
>
|
||||
<DockPanel Name="root">
|
||||
<StackPanel>
|
||||
<Button Name="ClearStrokes"></Button>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,125 @@
|
||||
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Documents
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Shapes
|
||||
Imports System.Windows.Ink
|
||||
Imports System.Windows.Input.StylusPlugIns
|
||||
|
||||
|
||||
'/ <summary>
|
||||
'/ Interaction logic for Window1.xaml
|
||||
'/ </summary>
|
||||
|
||||
Class Window1
|
||||
Inherits Window '
|
||||
|
||||
Private customInkCanvas As CustomRenderingInkCanvas
|
||||
Private ic As InkCanvas
|
||||
Private filterInkCanvas As FilterInkCanvas
|
||||
Private textbox1 As TextBox
|
||||
Private control As InkControl
|
||||
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
|
||||
customInkCanvas = New CustomRenderingInkCanvas()
|
||||
'root.Children.Add(customInkCanvas)
|
||||
|
||||
filterInkCanvas = New FilterInkCanvas()
|
||||
root.Children.Add(filterInkCanvas)
|
||||
|
||||
customInkCanvas.EditingModeInverted = InkCanvasEditingMode.EraseByPoint
|
||||
AddHandler customInkCanvas.StrokeCollected, AddressOf customInkCanvas_StrokeCollected
|
||||
|
||||
AddHandler ClearStrokes.Click, AddressOf ClearStrokes_Click
|
||||
WindowState = WindowState.Maximized
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub ClearStrokes_Click(ByVal sender As Object, ByVal e As RoutedEventArgs)
|
||||
customInkCanvas.Strokes.Clear()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub customInkCanvas_StrokeCollected(ByVal sender As Object, ByVal e As InkCanvasStrokeCollectedEventArgs)
|
||||
System.Diagnostics.Debug.WriteLine("customInkCanvase_StrokeCollected")
|
||||
e.Stroke.DrawingAttributes.Color = Colors.Green
|
||||
If TypeOf e.Stroke Is CustomStroke Then
|
||||
System.Diagnostics.Debug.WriteLine("stroke is custom")
|
||||
Else
|
||||
System.Diagnostics.Debug.WriteLine("stroke is not custom")
|
||||
End If
|
||||
|
||||
If customInkCanvas.Strokes.Contains(e.Stroke) Then
|
||||
System.Diagnostics.Debug.WriteLine("stroke is in ink canvas")
|
||||
Else
|
||||
System.Diagnostics.Debug.WriteLine("stroke is not in ink canvas") 'always lands here
|
||||
End If
|
||||
|
||||
System.Diagnostics.Debug.WriteLine("")
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
'<Snippet4>
|
||||
Public Class FilterInkCanvas
|
||||
Inherits InkCanvas
|
||||
Private filter As New FilterPlugin()
|
||||
|
||||
|
||||
Public Sub New()
|
||||
Me.StylusPlugIns.Add(filter)
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
'</Snippet4>
|
||||
|
||||
'<Snippet5>
|
||||
Public Class DynamicallyFilteredInkCanvas
|
||||
Inherits InkCanvas
|
||||
|
||||
Private filter As New FilterPlugin()
|
||||
|
||||
Public Sub New()
|
||||
Dim dynamicRenderIndex As Integer = Me.StylusPlugIns.IndexOf(Me.DynamicRenderer)
|
||||
|
||||
Me.StylusPlugIns.Insert(dynamicRenderIndex, filter)
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
'</Snippet5>
|
||||
|
||||
'<Snippet9>
|
||||
Public Class CustomRenderingInkCanvas
|
||||
Inherits InkCanvas
|
||||
|
||||
Private customRenderer As New CustomDynamicRenderer()
|
||||
|
||||
Public Sub New()
|
||||
' Use the custom dynamic renderer on the
|
||||
' custom InkCanvas.
|
||||
Me.DynamicRenderer = customRenderer
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnStrokeCollected(ByVal e As InkCanvasStrokeCollectedEventArgs)
|
||||
|
||||
' Remove the original stroke and add a custom stroke.
|
||||
Me.Strokes.Remove(e.Stroke)
|
||||
Dim customStroke As New CustomStroke(e.Stroke.StylusPoints)
|
||||
Me.Strokes.Add(customStroke)
|
||||
|
||||
' Pass the custom stroke to base class' OnStrokeCollected method.
|
||||
Dim args As New InkCanvasStrokeCollectedEventArgs(customStroke)
|
||||
MyBase.OnStrokeCollected(args)
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
'</Snippet9>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<system.diagnostics>
|
||||
<sources>
|
||||
<!-- This section defines the logging configuration for My.Application.Log in Windows Forms projects.-->
|
||||
<source name="Microsoft.VisualBasic.MyServices.Log.WindowsFormsSource" switchName="DefaultSwitch">
|
||||
<listeners>
|
||||
<add name="FileLog"/>
|
||||
<!-- Uncomment the below section to write to the Application Event Log -->
|
||||
<!--<add name="EventLog"/>-->
|
||||
</listeners>
|
||||
</source>
|
||||
</sources>
|
||||
<switches>
|
||||
<add name="DefaultSwitch" value="Information" />
|
||||
</switches>
|
||||
<sharedListeners>
|
||||
<add name="FileLog"
|
||||
type="System.Diagnostics.FileLogTraceListener, Microsoft.VisualBasic, Version=8.0.1200.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
|
||||
initializeData="FileLogWriter"/>
|
||||
<!-- Uncomment the below section and replace APPLICATION_NAME with the name of your application to write to the Application Event Log -->
|
||||
<!--<add name="EventLog" type="System.Diagnostics.EventLogTraceListener" initializeData="APPLICATION_NAME"/> -->
|
||||
</sharedListeners>
|
||||
</system.diagnostics>
|
||||
</configuration>
|
||||
@@ -0,0 +1,48 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<!--Imports the target which contains all the common targets-->
|
||||
<PropertyGroup>
|
||||
<DefaultClrNameSpace>SDKSample</DefaultClrNameSpace>
|
||||
<AssemblyName>AnimatePropertyStoryboards</AssemblyName>
|
||||
<TargetType>winexe</TargetType>
|
||||
<Configuration>Release</Configuration>
|
||||
<OutputPath>bin\$(Configuration)\</OutputPath>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{30E4DB40-8A37-480E-8D32-940BF1841066}</ProjectGuid>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="app.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="app.xaml.vb">
|
||||
<DependentUpon>app.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="StoryboardExample.vb">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Resource Include="App.ico" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
|
After Width: | Height: | Size: 25 KiB |
@@ -0,0 +1,129 @@
|
||||
' <Snippet11>
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Animation
|
||||
|
||||
Namespace SDKSample
|
||||
|
||||
|
||||
' Uses a storyboard to animate the properties
|
||||
' of two buttons.
|
||||
Public Class StoryboardExample
|
||||
Inherits Page
|
||||
|
||||
Private Dim WithEvents myWidthAnimatedButton As Button
|
||||
Private Dim WithEvents myColorAnimatedButton As Button
|
||||
Private Dim myWidthAnimatedButtonStoryboard As Storyboard
|
||||
Private Dim myColorAnimatedButtonStoryboard As Storyboard
|
||||
|
||||
|
||||
Public Sub New()
|
||||
' Create a name scope for the page.
|
||||
NameScope.SetNameScope(Me, New NameScope())
|
||||
|
||||
Me.WindowTitle = "Animate Properties using Storyboards"
|
||||
Dim myStackPanel As New StackPanel()
|
||||
myStackPanel.MinWidth = 500
|
||||
myStackPanel.Margin = New Thickness(30)
|
||||
myStackPanel.HorizontalAlignment = HorizontalAlignment.Left
|
||||
Dim myTextBlock As New TextBlock()
|
||||
myTextBlock.Text = "Storyboard Animation Example"
|
||||
myStackPanel.Children.Add(myTextBlock)
|
||||
|
||||
'
|
||||
' Create and animate the first button.
|
||||
'
|
||||
|
||||
' Create a button.
|
||||
myWidthAnimatedButton = New Button()
|
||||
myWidthAnimatedButton.Height = 30
|
||||
myWidthAnimatedButton.Width = 200
|
||||
myWidthAnimatedButton.HorizontalAlignment = HorizontalAlignment.Left
|
||||
myWidthAnimatedButton.Content = "A Button"
|
||||
|
||||
' Set the Name of the button so that it can be referred
|
||||
' to in the storyboard that's created later.
|
||||
' The ID doesn't have to match the variable name;
|
||||
' it can be any unique identifier.
|
||||
myWidthAnimatedButton.Name = "myWidthAnimatedButton"
|
||||
|
||||
' Register the name with the page to which the button belongs.
|
||||
Me.RegisterName(myWidthAnimatedButton.Name, myWidthAnimatedButton)
|
||||
|
||||
' Create a DoubleAnimation to animate the width of the button.
|
||||
Dim myDoubleAnimation As New DoubleAnimation()
|
||||
myDoubleAnimation.From = 200
|
||||
myDoubleAnimation.To = 300
|
||||
myDoubleAnimation.Duration = New Duration(TimeSpan.FromMilliseconds(3000))
|
||||
|
||||
' Configure the animation to target the button's Width property.
|
||||
Storyboard.SetTargetName(myDoubleAnimation, myWidthAnimatedButton.Name)
|
||||
Storyboard.SetTargetProperty(myDoubleAnimation, New PropertyPath(Button.WidthProperty))
|
||||
|
||||
' Create a storyboard to contain the animation.
|
||||
myWidthAnimatedButtonStoryboard = New Storyboard()
|
||||
myWidthAnimatedButtonStoryboard.Children.Add(myDoubleAnimation)
|
||||
|
||||
myStackPanel.Children.Add(myWidthAnimatedButton)
|
||||
|
||||
'
|
||||
' Create and animate the second button.
|
||||
'
|
||||
|
||||
' Create a second button.
|
||||
myColorAnimatedButton = New Button()
|
||||
myColorAnimatedButton.Height = 30
|
||||
myColorAnimatedButton.Width = 200
|
||||
myColorAnimatedButton.HorizontalAlignment = HorizontalAlignment.Left
|
||||
myColorAnimatedButton.Content = "Another Button"
|
||||
|
||||
' Create a SolidColorBrush to paint the button's background.
|
||||
Dim myBackgroundBrush As New SolidColorBrush()
|
||||
myBackgroundBrush.Color = Colors.Blue
|
||||
|
||||
' Because a Brush isn't a FrameworkElement, it doesn't
|
||||
' have a Name property to set. Instead, you just
|
||||
' register a name for the SolidColorBrush with
|
||||
' the page where it's used.
|
||||
Me.RegisterName("myAnimatedBrush", myBackgroundBrush)
|
||||
|
||||
' Use the brush to paint the background of the button.
|
||||
myColorAnimatedButton.Background = myBackgroundBrush
|
||||
|
||||
' Create a ColorAnimation to animate the button's background.
|
||||
Dim myColorAnimation As New ColorAnimation()
|
||||
myColorAnimation.From = Colors.Red
|
||||
myColorAnimation.To = Colors.Blue
|
||||
myColorAnimation.Duration = New Duration(TimeSpan.FromMilliseconds(7000))
|
||||
|
||||
' Configure the animation to target the brush's Color property.
|
||||
Storyboard.SetTargetName(myColorAnimation, "myAnimatedBrush")
|
||||
Storyboard.SetTargetProperty(myColorAnimation, New PropertyPath(SolidColorBrush.ColorProperty))
|
||||
|
||||
' Create a storyboard to contain the animation.
|
||||
myColorAnimatedButtonStoryboard = New Storyboard()
|
||||
myColorAnimatedButtonStoryboard.Children.Add(myColorAnimation)
|
||||
|
||||
myStackPanel.Children.Add(myColorAnimatedButton)
|
||||
Me.Content = myStackPanel
|
||||
|
||||
End Sub
|
||||
|
||||
' Start the animation when the button is clicked.
|
||||
Private Sub myWidthAnimatedButton_Loaded(ByVal sender as object, ByVal args as RoutedEventArgs) Handles myWidthAnimatedButton.Click
|
||||
|
||||
myWidthAnimatedButtonStoryboard.Begin(myWidthAnimatedButton)
|
||||
|
||||
End Sub
|
||||
|
||||
' Start the animation when the button is clicked.
|
||||
Private Sub myColorAnimatedButton_Loaded(ByVal sender as object, ByVal args as RoutedEventArgs) Handles myColorAnimatedButton.Click
|
||||
|
||||
myColorAnimatedButtonStoryboard.Begin(myColorAnimatedButton)
|
||||
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
' </Snippet11>
|
||||
@@ -0,0 +1,47 @@
|
||||
|
||||
<Application
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.app">
|
||||
|
||||
<!-- Resources & Styles defined in this section will impact the entire application. -->
|
||||
<Application.Resources>
|
||||
|
||||
<Style TargetType="{x:Type Canvas}" >
|
||||
<Setter Property="Canvas.HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="Canvas.Background">
|
||||
<Setter.Value>
|
||||
|
||||
<DrawingBrush Viewport="0,0,10,10" ViewportUnits="Absolute" TileMode="Tile"
|
||||
AlignmentX="Left" AlignmentY="Top">
|
||||
<DrawingBrush.Drawing>
|
||||
<DrawingGroup>
|
||||
<DrawingGroup.Children>
|
||||
<GeometryDrawing Brush="#99FFFFFF">
|
||||
<GeometryDrawing.Geometry>
|
||||
<RectangleGeometry Rect="0,0,1,1" />
|
||||
</GeometryDrawing.Geometry>
|
||||
</GeometryDrawing>
|
||||
<GeometryDrawing Geometry="M0,0 L1,0 1,0.1, 0,0.1Z" Brush="#99CCCCFF" />
|
||||
<GeometryDrawing Geometry="M0,0 L0,1 0.1,1, 0.1,0Z" Brush="#99CCCCFF" />
|
||||
</DrawingGroup.Children>
|
||||
</DrawingGroup>
|
||||
</DrawingBrush.Drawing>
|
||||
</DrawingBrush>
|
||||
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Button.MinWidth" Value="120"/>
|
||||
<Setter Property="Button.HorizontalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
<Style TargetType="{x:Type StackPanel}">
|
||||
<Setter Property="StackPanel.HorizontalAlignment" Value="Center" />
|
||||
</Style>
|
||||
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,23 @@
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Navigation
|
||||
Imports System.Data
|
||||
Imports System.Xml
|
||||
Imports System.Configuration
|
||||
|
||||
Namespace SDKSample
|
||||
|
||||
Partial Public Class app
|
||||
Inherits Application
|
||||
|
||||
Protected Overrides Sub OnStartup(ByVal e As StartupEventArgs)
|
||||
|
||||
Dim myWindow As New NavigationWindow()
|
||||
Dim myContent As New StoryboardExample()
|
||||
myWindow.Content = myContent
|
||||
MainWindow = myWindow
|
||||
myWindow.Show()
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,86 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{37B3B06E-D475-4E8F-A1D0-55098BD0176A}</ProjectGuid>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<RootNamespace></RootNamespace>
|
||||
<AssemblyName>AnimationTipsAndTricksSample_snip</AssemblyName>
|
||||
<OutputType>winexe</OutputType>
|
||||
<MinFrameworkVersionRequired>3.0</MinFrameworkVersionRequired>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>false</MapFileExtensions>
|
||||
<ApplicationVersion>1.0.0.*</ApplicationVersion>
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<PublishUrl>Publish\</PublishUrl>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>.\bin\Debug\</OutputPath>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>.\bin\Release\</OutputPath>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="mscorlib" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
<Reference Include="ReachFramework" />
|
||||
<Reference Include="System.Printing" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.IdentityModel" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="Application.xaml" />
|
||||
<Page Include="FillBehaviorTip.xaml" />
|
||||
<Page Include="Window1.xaml" />
|
||||
<Compile Include="Application.xaml.vb">
|
||||
<DependentUpon>Application.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Window1.xaml.vb">
|
||||
<DependentUpon>Window1.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="FillBehaviorTip.xaml.vb">
|
||||
<SubType>Code</SubType>
|
||||
<DependentUpon>FillBehaviorTip.xaml</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,9 @@
|
||||
<Application x:Class="Microsoft.Samples.Animation.App"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
StartupUri="Window1.xaml"
|
||||
>
|
||||
<Application.Resources>
|
||||
|
||||
</Application.Resources>
|
||||
</Application>
|
||||
@@ -0,0 +1,15 @@
|
||||
Imports System.Windows
|
||||
Imports System.Data
|
||||
Imports System.Xml
|
||||
Imports System.Configuration
|
||||
|
||||
Namespace Microsoft.Samples.Animation
|
||||
''' <summary>
|
||||
''' Interaction logic for App.xaml
|
||||
''' </summary>
|
||||
|
||||
Partial Public Class App
|
||||
Inherits System.Windows.Application
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,101 @@
|
||||
<Page x:Class="Microsoft.Samples.Animation.FillBehaviorTip"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Fill Behavior Example">
|
||||
|
||||
<Page.Resources>
|
||||
<Storyboard x:Key="TranslationAnimationStoryboardResource">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="MyTranslateTransform"
|
||||
Storyboard.TargetProperty="X"
|
||||
To="500" Duration="0:0:5" />
|
||||
</Storyboard>
|
||||
</Page.Resources>
|
||||
|
||||
<StackPanel>
|
||||
|
||||
<Canvas Width="600" Height="200">
|
||||
<Rectangle
|
||||
Canvas.Top="50" Canvas.Left="0"
|
||||
Width="50" Height="50" Fill="Red">
|
||||
<Rectangle.RenderTransform>
|
||||
<TranslateTransform
|
||||
x:Name="MyTranslateTransform"
|
||||
X="0" Y="0" />
|
||||
</Rectangle.RenderTransform>
|
||||
</Rectangle>
|
||||
</Canvas>
|
||||
|
||||
<Button Content="Start Storyboard A">
|
||||
<Button.Triggers>
|
||||
<EventTrigger RoutedEvent="Button.Click">
|
||||
<BeginStoryboard>
|
||||
<Storyboard>
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="MyTranslateTransform"
|
||||
Storyboard.TargetProperty="X"
|
||||
From="0" To="350" Duration="0:0:5"
|
||||
FillBehavior="Stop" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Button.Triggers>
|
||||
</Button>
|
||||
|
||||
<StackPanel Orientation="Horizontal">
|
||||
|
||||
<Button Content="Start Storyboard B1">
|
||||
<Button.Triggers>
|
||||
<EventTrigger RoutedEvent="Button.Click">
|
||||
<BeginStoryboard>
|
||||
<Storyboard x:Name="B1">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="MyTranslateTransform"
|
||||
Storyboard.TargetProperty="X"
|
||||
From="0" To="350" Duration="0:0:5"
|
||||
FillBehavior="Stop"
|
||||
/>
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Button.Triggers>
|
||||
</Button>
|
||||
|
||||
|
||||
<!-- Animates the same object and property as the preceding
|
||||
Storyboard. -->
|
||||
<Button Content="Start Storyboard B2">
|
||||
<Button.Triggers>
|
||||
<EventTrigger RoutedEvent="Button.Click">
|
||||
<BeginStoryboard>
|
||||
<Storyboard x:Name="B2">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="MyTranslateTransform"
|
||||
Storyboard.TargetProperty="X"
|
||||
To="500" Duration="0:0:5"
|
||||
FillBehavior="Stop" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Button.Triggers>
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<Button Content="Start Storyboard C">
|
||||
<Button.Triggers>
|
||||
<EventTrigger RoutedEvent="Button.Click">
|
||||
<BeginStoryboard>
|
||||
<Storyboard Completed="StoryboardC_Completed">
|
||||
<DoubleAnimation
|
||||
Storyboard.TargetName="MyTranslateTransform"
|
||||
Storyboard.TargetProperty="X"
|
||||
From="0" To="350" Duration="0:0:5"
|
||||
FillBehavior="Stop" />
|
||||
</Storyboard>
|
||||
</BeginStoryboard>
|
||||
</EventTrigger>
|
||||
</Button.Triggers>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Page>
|
||||
@@ -0,0 +1,35 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Text
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Documents
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Animation
|
||||
Imports System.Windows.Media.Imaging
|
||||
Imports System.Windows.Navigation
|
||||
Imports System.Windows.Shapes
|
||||
|
||||
Namespace Microsoft.Samples.Animation
|
||||
''' <summary>
|
||||
''' Interaction logic for FillBehaviorTip.xaml
|
||||
''' </summary>
|
||||
|
||||
Partial Public Class FillBehaviorTip
|
||||
Inherits System.Windows.Controls.Page
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
|
||||
End Sub
|
||||
|
||||
' <SnippetFillBehaviorTipStoryboardC1CompletedHandler>
|
||||
Private Sub StoryboardC_Completed(ByVal sender As Object, ByVal e As EventArgs)
|
||||
|
||||
Dim translationAnimationStoryboard As Storyboard = CType(Me.Resources("TranslationAnimationStoryboardResource"), Storyboard)
|
||||
translationAnimationStoryboard.Begin(Me)
|
||||
End Sub
|
||||
' </SnippetFillBehaviorTipStoryboardC1CompletedHandler>
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,14 @@
|
||||
<Window x:Class="Microsoft.Samples.Animation.Window1"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="Microsoft.Samples.Animation" Height="600" Width="650"
|
||||
>
|
||||
<DockPanel>
|
||||
<TabControl>
|
||||
<TabItem Header="FillBehavior Tip">
|
||||
<Frame Source="FillBehaviorTip.xaml" />
|
||||
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,26 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Text
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Documents
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Imaging
|
||||
Imports System.Windows.Shapes
|
||||
|
||||
|
||||
Namespace Microsoft.Samples.Animation
|
||||
''' <summary>
|
||||
''' Interaction logic for Window1.xaml
|
||||
''' </summary>
|
||||
|
||||
Partial Public Class Window1
|
||||
Inherits System.Windows.Window
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,25 @@
|
||||
Imports System.Windows
|
||||
|
||||
Namespace SDKSample
|
||||
Public Class App
|
||||
Inherits Application
|
||||
Public Sub New()
|
||||
End Sub
|
||||
<STAThread>
|
||||
Public Shared Sub Main()
|
||||
' Create new instance of application subclass
|
||||
Dim app As New App()
|
||||
|
||||
' Code to register events and set properties that were
|
||||
' defined in XAML in the application definition
|
||||
app.InitializeComponent()
|
||||
|
||||
' Start running the application
|
||||
app.Run()
|
||||
End Sub
|
||||
|
||||
Public Sub InitializeComponent()
|
||||
' Initialization code goes here.
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,69 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E58D4EFF-C005-44DD-A1E0-77AD4F7F927F}</ProjectGuid>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<RootNamespace></RootNamespace>
|
||||
<AssemblyName>AppDefAugSnippets</AssemblyName>
|
||||
<OutputType>winexe</OutputType>
|
||||
<MinFrameworkVersionRequired>3.0</MinFrameworkVersionRequired>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>false</MapFileExtensions>
|
||||
<ApplicationVersion>1.0.0.*</ApplicationVersion>
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<PublishUrl>Publish\</PublishUrl>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>.\bin\Debug\</OutputPath>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>.\bin\Release\</OutputPath>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="ReachFramework" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppDesigner Include="My Project\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="App.vb" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="My Project\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,84 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{5CF55DD6-C7A6-4A20-8313-B5D8B5F147F7}</ProjectGuid>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<RootNamespace></RootNamespace>
|
||||
<AssemblyName>AppShowWindowHardSnippets</AssemblyName>
|
||||
<OutputType>winexe</OutputType>
|
||||
<MinFrameworkVersionRequired>3.0</MinFrameworkVersionRequired>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Web</InstallFrom>
|
||||
<UpdateEnabled>true</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>false</MapFileExtensions>
|
||||
<ApplicationVersion>1.0.0.*</ApplicationVersion>
|
||||
<IsWebBootstrapper>true</IsWebBootstrapper>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<PublishUrl>Publish\</PublishUrl>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>.\bin\Debug\</OutputPath>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>.\bin\Release\</OutputPath>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
<Reference Include="ReachFramework" />
|
||||
<Reference Include="System.Printing" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.IdentityModel" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="Application.xaml" />
|
||||
<Page Include="MainWindow.xaml" />
|
||||
<Compile Include="Application.xaml.vb">
|
||||
<DependentUpon>Application.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.vb">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AppDesigner Include="My Project\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="My Project\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,5 @@
|
||||
<Application
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.App"
|
||||
Startup="App_Startup" />
|
||||
@@ -0,0 +1,15 @@
|
||||
'<SnippetStartupEventCODEBEHIND>
|
||||
|
||||
Imports System.Windows
|
||||
|
||||
Namespace SDKSample
|
||||
Partial Public Class App
|
||||
Inherits Application
|
||||
Private Sub App_Startup(ByVal sender As Object, ByVal e As StartupEventArgs)
|
||||
' Open a window
|
||||
Dim window As New MainWindow()
|
||||
window.Show()
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
'</SnippetStartupEventCODEBEHIND>
|
||||
@@ -0,0 +1,9 @@
|
||||
<Window
|
||||
x:Class="SDKSample.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
>
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,26 @@
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Text
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Documents
|
||||
Imports System.Windows.Input
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Imaging
|
||||
Imports System.Windows.Shapes
|
||||
|
||||
|
||||
Namespace SDKSample
|
||||
''' <summary>
|
||||
''' Interaction logic for MainWindow.xaml
|
||||
''' </summary>
|
||||
|
||||
Partial Public Class MainWindow
|
||||
Inherits System.Windows.Window
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,7 @@
|
||||
<Application
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
x:Class="SDKSample.App"
|
||||
StartupUri="MainWindow.xaml"
|
||||
Activated="App_Activated"
|
||||
Deactivated="App_Deactivated" />
|
||||
@@ -0,0 +1,21 @@
|
||||
'<SnippetDetectActivationStateCODEBEHIND>
|
||||
|
||||
Imports System.Windows
|
||||
|
||||
Namespace SDKSample
|
||||
Partial Public Class App
|
||||
Inherits Application
|
||||
Private isApplicationActive As Boolean
|
||||
|
||||
Private Sub App_Activated(ByVal sender As Object, ByVal e As EventArgs)
|
||||
' Application activated
|
||||
Me.isApplicationActive = True
|
||||
End Sub
|
||||
|
||||
Private Sub App_Deactivated(ByVal sender As Object, ByVal e As EventArgs)
|
||||
' Application deactivated
|
||||
Me.isApplicationActive = False
|
||||
End Sub
|
||||
End Class
|
||||
End Namespace
|
||||
'</SnippetDetectActivationStateCODEBEHIND>
|
||||
@@ -0,0 +1,90 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{2C727B60-21B5-4F1F-81C2-2F7F372F26D7}</ProjectGuid>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{F184B08F-C81C-45F6-A57F-5ABD9991F28F}</ProjectTypeGuids>
|
||||
<RootNamespace></RootNamespace>
|
||||
<AssemblyName>ApplicationDeactivatedSnippetSample</AssemblyName>
|
||||
<OutputType>winexe</OutputType>
|
||||
<ApplicationVersion>1.0.0.*</ApplicationVersion>
|
||||
<!-- Most people will use Publish dialog in Visual Studio to increment this -->
|
||||
<BootstrapperEnabled>false</BootstrapperEnabled>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<OptionExplicit>On</OptionExplicit>
|
||||
<OptionCompare>Binary</OptionCompare>
|
||||
<OptionStrict>Off</OptionStrict>
|
||||
<OptionInfer>On</OptionInfer>
|
||||
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
|
||||
<ProductVersion>10.0.20821</ProductVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>.\bin\Debug\</OutputPath>
|
||||
<DefineDebug>true</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>.\bin\Release\</OutputPath>
|
||||
<DefineDebug>false</DefineDebug>
|
||||
<DefineTrace>true</DefineTrace>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UIAutomationProvider" />
|
||||
<Reference Include="UIAutomationTypes" />
|
||||
<Reference Include="ReachFramework" />
|
||||
<Reference Include="System.Printing" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Runtime.Serialization" />
|
||||
<Reference Include="System.IdentityModel" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="Application.xaml" />
|
||||
<Page Include="MainWindow.xaml" />
|
||||
<Compile Include="Application.xaml.vb">
|
||||
<DependentUpon>Application.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.vb">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="My Project\AssemblyInfo.vb" />
|
||||
<EmbeddedResource Include="My Project\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
<LastGenOutput>Resources.Designer.vb</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="My Project\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.vb</LastGenOutput>
|
||||
</None>
|
||||
<Compile Include="My Project\Resources.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="My Project\Settings.Designer.vb">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
</Compile>
|
||||
<AppDesigner Include="My Project\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.VisualBasic.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,9 @@
|
||||
<Window x:Class="SDKSample.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
Title="SDKSample" Height="300" Width="300"
|
||||
>
|
||||
<Grid>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,23 @@
|
||||
Imports System.Windows
|
||||
Imports System.Windows.Controls
|
||||
Imports System.Windows.Data
|
||||
Imports System.Windows.Documents
|
||||
Imports System.Windows.Media
|
||||
Imports System.Windows.Media.Imaging
|
||||
Imports System.Windows.Shapes
|
||||
|
||||
|
||||
Namespace SDKSample
|
||||
''' <summary>
|
||||
''' Interaction logic for MainWindow.xaml
|
||||
''' </summary>
|
||||
|
||||
Partial Public Class MainWindow
|
||||
Inherits Window
|
||||
|
||||
Public Sub New()
|
||||
InitializeComponent()
|
||||
End Sub
|
||||
|
||||
End Class
|
||||
End Namespace
|
||||
@@ -0,0 +1,51 @@
|
||||
#Region "Using directives"
|
||||
|
||||
Imports System.Reflection
|
||||
Imports System.Runtime.CompilerServices
|
||||
Imports System.Resources
|
||||
Imports System.Globalization
|
||||
Imports System.Windows
|
||||
Imports System.Runtime.InteropServices
|
||||
|
||||
#End Region
|
||||
|
||||
' General Information about an assembly is controlled through the following
|
||||
' set of attributes. Change these attribute values to modify the information
|
||||
' associated with an assembly.
|
||||
<Assembly: AssemblyTitle("SDKSample")>
|
||||
<Assembly: AssemblyDescription("")>
|
||||
<Assembly: AssemblyConfiguration("")>
|
||||
<Assembly: AssemblyCompany("Microsoft")>
|
||||
<Assembly: AssemblyProduct("SDKSample")>
|
||||
<Assembly: AssemblyCopyright("Copyright @ Microsoft 2006")>
|
||||
<Assembly: AssemblyTrademark("")>
|
||||
<Assembly: AssemblyCulture("")>
|
||||
<Assembly: ComVisible(False)>
|
||||
|
||||
'In order to begin building localizable applications, set
|
||||
'<UICulture>CultureYouAreCodingWith</UICulture> in your .vbproj file
|
||||
'inside a <PropertyGroup>. For example, if you are using US english
|
||||
'in your source files, set the <UICulture> to en-US. Then uncomment
|
||||
'the NeutralResourceLanguage attribute below. Update the "en-US" in
|
||||
'the line below to match the UICulture setting in the project file.
|
||||
|
||||
'[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
|
||||
|
||||
|
||||
'(used if a resource is not found in the page,
|
||||
' or application resource dictionaries)
|
||||
'(used if a resource is not found in the page,
|
||||
' app, or any theme specific resource dictionaries)
|
||||
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)> 'where the generic resource dictionary is located - where theme specific resource dictionaries are located
|
||||
|
||||
|
||||
' Version information for an assembly consists of the following four values:
|
||||
'
|
||||
' Major Version
|
||||
' Minor Version
|
||||
' Build Number
|
||||
' Revision
|
||||
'
|
||||
' You can specify all the values or you can default the Revision and Build Numbers
|
||||
' by using the '*' as shown below:
|
||||
<Assembly: AssemblyVersion("1.0.*")>
|
||||
@@ -0,0 +1,62 @@
|
||||
'------------------------------------------------------------------------------
|
||||
' <auto-generated>
|
||||
' This code was generated by a tool.
|
||||
' Runtime Version:2.0.50727.312
|
||||
'
|
||||
' Changes to this file may cause incorrect behavior and will be lost if
|
||||
' the code is regenerated.
|
||||
' </auto-generated>
|
||||
'------------------------------------------------------------------------------
|
||||
|
||||
|
||||
Namespace My.Resources
|
||||
|
||||
|
||||
''' <summary>
|
||||
''' A strongly-typed resource class, for looking up localized strings, etc.
|
||||
''' </summary>
|
||||
' This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
' class via a tool like ResGen or Visual Studio.
|
||||
' To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
' with the /str option, or rebuild your VS project.
|
||||
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "2.0.0.0"), Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
|
||||
Global.Microsoft.VisualBasic.HideModuleNameAttribute()>
|
||||
Friend Module Resources
|
||||
|
||||
Private resourceMan As Global.System.Resources.ResourceManager
|
||||
|
||||
Private resourceCulture As Global.System.Globalization.CultureInfo
|
||||
|
||||
' internal Resources()
|
||||
' {
|
||||
' }
|
||||
|
||||
''' <summary>
|
||||
''' Returns the cached ResourceManager instance used by this class.
|
||||
''' </summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)>
|
||||
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
|
||||
Get
|
||||
If Object.ReferenceEquals(resourceMan, Nothing) Then
|
||||
Dim temp As New Global.System.Resources.ResourceManager("Resources", GetType(Resources).Assembly)
|
||||
resourceMan = temp
|
||||
End If
|
||||
Return resourceMan
|
||||
End Get
|
||||
End Property
|
||||
|
||||
''' <summary>
|
||||
''' Overrides the current thread's CurrentUICulture property for all
|
||||
''' resource lookups using this strongly typed resource class.
|
||||
''' </summary>
|
||||
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)>
|
||||
Friend Property Culture() As Global.System.Globalization.CultureInfo
|
||||
Get
|
||||
Return resourceCulture
|
||||
End Get
|
||||
Set(ByVal value As System.Globalization.CultureInfo)
|
||||
resourceCulture = value
|
||||
End Set
|
||||
End Property
|
||||
End Module
|
||||
End Namespace
|
||||
@@ -0,0 +1,117 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||