【WPF开发】无人机HUD (Head Up Display)开源控件

WiKi

HUD即Head Up Display,用于显示无人机的三个姿态角,即俯仰角(Pitch)、翻滚角(Roll)、偏航角(Yaw)。例如下面的视图。
【WPF开发】无人机HUD (Head Up Display)开源控件_第1张图片

相关资料

gitHub主页:https://github.com/fengdingfeilong/HUD

使用

从GitHub上下载后,用VS2015打开,直接运行,即可直接运行出来里面的实例。可以点击解决方案中HUD工程,build出DLL文件。
查看HudSample代码,使用HUD相当简单,只有一行代码。

"HUDSample.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:HUDSample"
        xmlns:hud="clr-namespace:HUD;assembly=HUD"
        mc:Ignorable="d"
        Title="MainWindow" Height="800" Width="1200">
    <Grid>
        <Grid.ColumnDefinitions>
            
            "Auto"/>
        Grid.ColumnDefinitions>
        "{Binding ElementName=Slider_Yaw,Path=Value,Mode=TwoWay}" PitchAngle="{Binding ElementName=Slider_Pitch,Path=Value}" RollAngle="{Binding ElementName=Slider_Roll,Path=Value}" MaxRollAngle="80"/>
        Grid.Column="1">
            <Grid Width="300" Margin="5">
                <Grid.ColumnDefinitions>
                    "50"/>
                    
                Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    "40"/>
                    "40"/>
                    "40"/>
                    
                Grid.RowDefinitions>
                Text="航向角" VerticalAlignment="Center"/>
                <Slider Name="Slider_Yaw" Grid.Column="1" Minimum="-180" Maximum="180" Value="0" TickFrequency="20" TickPlacement="BottomRight"  VerticalAlignment="Center"/>
                Text="俯仰角" VerticalAlignment="Center" Grid.Row="1"/>
                <Slider Name="Slider_Pitch" Grid.Column="1" Grid.Row="1" Minimum="-90" Maximum="90" Value="0" TickFrequency="10" TickPlacement="BottomRight"  VerticalAlignment="Center"/>
                Text="翻转角" VerticalAlignment="Center" Grid.Row="2"/>
                <Slider Name="Slider_Roll" Grid.Column="1" Grid.Row="2" Minimum="-180" Maximum="180" Value="0" TickFrequency="20" TickPlacement="BottomRight"  VerticalAlignment="Center"/>
            Grid>
        
    Grid>

你可能感兴趣的:(WPF开发)