效果图如下
<DockPanel Grid.ColumnSpan="6" HorizontalAlignment="Left" Height="17" LastChildFill="True" Margin="0,16,0,0" VerticalAlignment="Top" Width="990" >
<Menu DockPanel.Dock="Top">
<MenuItem Header="File" Width="40">
<MenuItem Header="视图">
<MenuItem Header="线条设置" Click="SetLineStyle_Click"/>
<Separator/>
<MenuItem Header="查看动态测量图" Click="NoteLine_Click"/>
<Separator/>
<MenuItem Header="线条属性设置" Click="SetLinePro_Click"/>
</MenuItem>
<MenuItem Header="NEW" >
<!-- 在new前面插入一张图片-->
<!-- <MenuItem.Icon> -->
<!-- <Image Source="Images/NewDocumentHS.png"/> -->
<!-- </MenuItem.Icon> -->
</MenuItem>
</MenuItem>
<MenuItem Header="Draw" Name="menuTools">
</MenuItem>
<MenuItem Header="Edit" Name="menuEdit">
</MenuItem>
<MenuItem Header="Help">
</MenuItem>
</Menu>
menu和menultem
DockPanel
Separator
CheckBox
ComboBox
<ToolBarTray Grid.ColumnSpan="12" HorizontalAlignment="Left" Height="39" Margin="0,0,-6,-39" VerticalAlignment="Top" Width="996" RenderTransformOrigin="0.502,-1.043" DockPanel.Dock="Top">
<ToolBar HorizontalAlignment="Left" Height="39" VerticalAlignment="Top" Width="996" Margin="0,0,-972,-26">
<Button Click="RUN_BUTTOM_Click" ToolTip="RUN" >
<Image x:Name="RUN_BUTTOM" Height="34" VerticalAlignment="Top" Width="26" Source=".\Images\run.png" />
</Button>
<Button Click="STOP_BUTTON_Click" ToolTip="STOP" >
<Image x:Name="STOP_BUTTON" Height="34" VerticalAlignment="Top" Width="26" Source=".\Images\stop.png" />
</Button>
。。。
<ComboBox x:Name="Disp_source_Select1" Height="34" Margin="0" VerticalAlignment="Top" Width="120">
<CheckBox x:Name="AD_Data" Content="AD_Data" Click="AD_Data_Click"/>
<CheckBox x:Name="BackLineShow" Content="Background" Click="Background_Click"/>
<CheckBox x:Name="ReferLineShow" Content="Reference" Click="Reference_Click"/>
<CheckBox x:Name="SampleLineShow" Content="Sample" Click="Sample_Click"/>
<CheckBox x:Name="SampleLineShow1" Content="Sample1" Click="Sample1_Click"/>
<CheckBox x:Name="SampleLineShow2" Content="Sample2" Click="Sample2_Click"/>
在c#中相对路径用"./"表示当前目录。插入的图片文件夹必须放在“.exe"的同一个目录中,同时在项目下新建一个放图片的文件夹。本案例操作如下:
ground station_test1——>添加新建文件夹(新建了一个images)——>images导入图片