WPF中的自定义控件实例
2021-04-11 16:25
标签:opacity == alt info 自定义控件 ado lap none 控件 1、前端 2、后台 WPF中的自定义控件实例 标签:opacity == alt info 自定义控件 ado lap none 控件 原文地址:https://www.cnblogs.com/LY-HeroesRebor/p/9025187.html 1 UserControl x:Class="RayProject.Control.EMIControl"
2 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
3 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
5 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
6 xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"
7 xmlns:winForms="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"
8 mc:Ignorable="d"
9 d:DesignHeight="300" d:DesignWidth="300"
10 Height="283" Width="330" >
11
12
13 Grid>
14 Grid x:Name="top1" Margin="0,0,0,199.5" >
15 Image x:Name="形状_48" Stretch="Fill" Source="/Skins/Images/Radar/Shape1-2.png" Height="72.554" Margin="10,10,10,0.5" />
16 Image x:Name="形状_49" Source="/Skins/Images/Radar/Shape1-1.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="274,15,0,0" Height="31" Width="36"/>
17 TextBlock x:Name="_1号干扰器" Padding="6" Foreground="#FF5D9FF7" FontSize="16" FontFamily="Microsoft YaHei" TextAlignment="Left" Text="1号干扰器" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="66,10,0,0" Width="86.383" Height="37.117" />
18 Grid>
19 Grid x:Name="干扰1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="120.482,57.5,10,61.5">
20 Image x:Name="多边形_4" Source="/Skins/Images/Radar/polygon1.png" HorizontalAlignment="Left" VerticalAlignment="Top" />
21 Image x:Name="形状_41" Source="/Skins/Images/Radar/shape46.png" HorizontalAlignment="Left" VerticalAlignment="Top" RenderTransformOrigin="0.5,0.5" Margin="13.915,12.001,0,0" Height="137" Width="156.442"/>
22
23 WindowsFormsHost Background="Transparent" Margin="55,21,56,17">
24 winForms:PictureBox x:Name="WavesGif" ImageLocation="./Skins/Images/Radar/shapes25.png" SizeMode="Zoom" >winForms:PictureBox>
25 WindowsFormsHost>
26
27 Grid>
28 Grid x:Name="旋转角度1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="31,182.497,0,0" Width="75.329" Height="92.275">
29 Image x:Name="椭圆_8" Opacity="0.651" Source="/Skins/Images/Radar/ellipes53.png" HorizontalAlignment="Left" VerticalAlignment="Top" Height=" 60" Width="60" Margin="7.5,32.275,0,0"/>
30 Image Source="/Skins/Images/Radar/pointer1.png" HorizontalAlignment="Left" VerticalAlignment="Top" RenderTransformOrigin="0.227,0.504" Margin="34.24,57.727,0,0" Height="9.935" Width="24.049" >
31 Image.RenderTransform>
32 RotateTransform x:Name="LevelPointer" Angle="-90" >RotateTransform>
33 Image.RenderTransform>
34 Image>
35 TextBlock x:Name="LevelAngleTxt" Text="{Binding LevelAngle, RelativeSource={RelativeSource AncestorType=UserControl}}" TextAlignment="Right" Foreground="#FF057BF2" FontSize="14" FontFamily="Microsoft YaHei" HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="0.569" Width="32.461" Margin="20.758,8.798,0,0" >
36 Run Text="°" Foreground="#FF057BF2" FontSize="14" FontFamily="Microsoft YaHei" >Run>
37 TextBlock>
38 Grid>
39 Grid x:Name="垂直旋转1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="31,78.5,0,0" Height="98.997" Width="84.482">
40 Path x:Name="矩形_22" Data="F1M1,1C1,1 4,1 4,1 4,1 4,65 4,65 4,65 1,65 1,65 1,65 1,1 1,1z" Fill="#FF106CF5" Opacity="0.651" HorizontalAlignment="Left" VerticalAlignment="Top"
41 Margin="8.5,20,0,0" Stretch="Fill" Width="3.168" Height="78.997"/>
42 Path x:Name="垂直指针" Fill="#FF106CF5" Margin="9.21,57.863,0,0" Stretch="Fill" HorizontalAlignment="Left" VerticalAlignment="Top" RenderTransformOrigin="0.035,0.051" Data="M1.5102235,2.3961067E-05 C1.7992257,0.0016530752 2.0908819,0.08649683 2.3473819,0.26162171 2.3473819,0.26162183 17.458466,10.602197 24.069564,15.1262 L24.203769,15.218037 24.384181,14.954367 C25.084826,13.93038 25.618651,13.150199 25.618651,13.150199 25.618651,13.150199 38.823771,22.184523 38.823771,22.184523 38.823771,22.184523 34.306113,28.787045 34.306113,28.787045 34.306113,28.787045 21.100991,19.752721 21.100991,19.752721 21.100991,19.752721 21.634816,18.972541 22.335461,17.948552 L22.510035,17.693415 22.375441,17.601323 C15.764075,13.077588 0.65238202,2.737622 0.65238178,2.7376225 -0.030617952,2.2696218 -0.20561802,1.3366218 0.26238179,0.65262151 0.55425704,0.22574675 1.0285538,-0.0026906729 1.5102235,2.3961067E-05 z" Width="34.532" Height="25.872" >
43 Path.RenderTransform>
44 TransformGroup>
45 ScaleTransform/>
46 SkewTransform/>
47 RotateTransform x:Name="VerticalPointer" Angle="-35.782"/>
48 TranslateTransform X="-0.106" Y="0.302"/>
49 TransformGroup>
50 Path.RenderTransform>
51 Path>
52 Image x:Name="椭圆_5_拷贝_3" Source="/Skins/Images/Radar/ellipes5_21.png" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="6.335,54.898,0,0" Height="7.999" Width="8"/>
53 TextBlock x:Name="VerticalAngleTxt" Text="{Binding VerticalAngle, RelativeSource={RelativeSource AncestorType=UserControl}}" TextAlignment="Right" Foreground="#FF057BF2" FontSize="14" FontFamily="Microsoft YaHei" HorizontalAlignment="Left" VerticalAlignment="Top" Opacity="0.569" Width="35" Height="15" >
54 Run Text="°" Foreground="#FF057BF2" FontSize="14" FontFamily="Microsoft YaHei" >Run>
55 TextBlock>
56 Grid>
57
58 Grid x:Name="状态1" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="139.094,226.5,0,0" Height="32" Width="150">
59 Image x:Name="bgImage" HorizontalAlignment="Left" VerticalAlignment="Top" Stretch="Fill" Source="/Skins/Images/Radar/Rectangle7.png" Width="150"/>
60 Label Content="状态" Padding="8" Foreground="White" Opacity="0.569" FontSize="14" FontFamily="Microsoft YaHei" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="9,0,0,0" Width="50.943" Height="32" />
61 TextBlock x:Name="statusTxt" Text="{Binding StatusText, RelativeSource={RelativeSource AncestorType=UserControl}}" Padding="20,8" Foreground="#FF0DF612" FontSize="14" FontFamily="Microsoft YaHei" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="59.943,0,0,0" Width="80.057" Height="32" />
62 Grid>
63 Grid>
64
65 UserControl>
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.Threading.Tasks;
6 using System.Windows;
7 using System.Windows.Controls;
8 using System.Windows.Data;
9 using System.Windows.Documents;
10 using System.Windows.Input;
11 using System.Windows.Media;
12 using System.Windows.Media.Animation;
13 using System.Windows.Media.Imaging;
14 using System.Windows.Navigation;
15 using System.Windows.Shapes;
16 using System.Windows.Threading;
17
18 namespace RayProject.Control
19 {
20 ///