本帖最后由 MyOracleOCM 于 2014-10-11 22:20 编辑
直接上图,有真相。。。
接下来是XAML代码:
<Window x:Name="DNF连发" x:Class="DNF连发.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="DNF连发" Height="350" Width="535" Closed="DNF连发_Closed" Loaded="DNF连发_Loaded" >
<Grid x:Name="连发">
<Border BorderBrush="Black" BorderThickness="1" HorizontalAlignment="Left" Height="4" Margin="135,169,0,0" VerticalAlignment="Top" Width="3"/>
<ComboBox x:Name="下拉框1" SelectedValuePath="Tag" HorizontalAlignment="Left" Margin="64,34,0,0" VerticalAlignment="Top" Width="120" >
<ComboBoxItem Name="选项1" Content="A" Tag="test1" Selected="选项Selected_1"></ComboBoxItem>
<ComboBoxItem Content="S" Tag="test2" ></ComboBoxItem>
<ComboBoxItem Content="D" Tag="test3" ></ComboBoxItem>
<ComboBoxItem Content="Z" Tag="test4" ></ComboBoxItem>
<ComboBoxItem Content="X" Tag="test5" ></ComboBoxItem>
<ComboBoxItem Content="C" Tag="test6" ></ComboBoxItem>
<ComboBoxItem Content="F" Tag="test7" ></ComboBoxItem>
<ComboBoxItem Content="G" Tag="test8" ></ComboBoxItem>
//</ComboBox>试过在这里加代码,可是报错。
<ComboBox x:Name="下拉框2" SelectedValuePath="Tag" HorizontalAlignment="Left" Margin="64,102,0,0" VerticalAlignment="Top" Width="120"/>
<ComboBoxItem Content="A" Tag="test1" ></ComboBoxItem>
<ComboBoxItem Content="S" Tag="test2" ></ComboBoxItem>
<ComboBoxItem Content="D" Tag="test3" ></ComboBoxItem>
<ComboBoxItem Content="Z" Tag="test4" ></ComboBoxItem>
<ComboBoxItem Content="X" Tag="test5" ></ComboBoxItem>
<ComboBoxItem Content="C" Tag="test6" ></ComboBoxItem>
<ComboBoxItem Content="F" Tag="test7" ></ComboBoxItem>
<ComboBoxItem Content="G" Tag="test8" ></ComboBoxItem>
</ComboBox>
<ComboBox x:Name="下拉框3" HorizontalAlignment="Left" Margin="64,169,0,0" VerticalAlignment="Top" Width="120"/>
<ComboBox x:Name="下拉框4" HorizontalAlignment="Left" Margin="64,232,0,0" VerticalAlignment="Top" Width="120"/>
<ComboBox x:Name="下拉框5" HorizontalAlignment="Left" Margin="338,34,0,0" VerticalAlignment="Top" Width="120"/>
<ComboBox x:Name="下拉框6" HorizontalAlignment="Left" Margin="338,102,0,0" VerticalAlignment="Top" Width="120"/>
<ComboBox x:Name="下拉框7" HorizontalAlignment="Left" Margin="338,169,0,0" VerticalAlignment="Top" Width="120"/>
<ComboBox x:Name="下拉框8" HorizontalAlignment="Left" Margin="338,232,0,0" VerticalAlignment="Top" Width="120"/>
<Button x:Name="确定" Content="确定" HorizontalAlignment="Left" Margin="135,273,0,0" VerticalAlignment="Top" Width="75" Click="确定_Click" />
<Button x:Name="重置" Content="重置" HorizontalAlignment="Left" Margin="300,273,0,0" VerticalAlignment="Top" Width="75" Click="重置_Click"/>
</Grid>
</Window>
然后是CS文件:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace DNF连发
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void myComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void 重置_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("已重置,可以重新选择需要连发的按键!");
}
private void 确定_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("您已确定需要的连发按键吗?");
}
private void DNF连发_Closed(object sender, EventArgs e)
{
MessageBox.Show("谢谢使用,祝你生活愉快!");
}
private void DNF连发_Loaded(object sender, RoutedEventArgs e)
{
MessageBox.Show("欢迎使用本软件");
}
private void 选项Selected_1(object sender, RoutedEventArgs e)
{
}
private void ComboBoxItem_Selected_1(object sender, RoutedEventArgs e)
{
}
}
}
需要的效果为,每个下拉框的选择项相同:
|
-
1.png
(6.46 KB, 下载次数: 23)
效果图1
-
2.png
(5 KB, 下载次数: 26)
效果图2
|