WEB开发网
开发学院软件开发C语言 C#开发WPF/Silverlight动画及游戏系列教程(Game T... 阅读

C#开发WPF/Silverlight动画及游戏系列教程(Game Tutorial):(四十四)制作主角属性面板及加点器

 2010-09-30 22:36:17 来源:WEB开发网   
核心提示: 这样我们就可以在游戏窗口中对已创建的选项卡控件注册SelectionChanged事件了://主角属性选项卡内容QXTabControltc=newQXTabControl(){TabItemOrientation=Orientation.Horizontal,TabItemHeight=28,

这样我们就可以在游戏窗口中对已创建的选项卡控件注册SelectionChanged事件了:

//主角属性选项卡内容
QXTabControl tc = new QXTabControl() {
     TabItemOrientation = Orientation.Horizontal,
     TabItemHeight = 28,
     BodyLeft = -4,
     BodyTop = 27
};
//添加4个选项卡
tc.AddItem(63, 28, 1, "/Image/Icon/39.png", "/Image/Icon/40.png", "/Image/Icon/41.png", "/Image/Icon/42.png", "属  性");
tc.AddItem(63, 28, 1, "/Image/Icon/39.png", "/Image/Icon/40.png", "/Image/Icon/41.png", "/Image/Icon/42.png", "声  望");
tc.AddItem(63, 28, 1, "/Image/Icon/39.png", "/Image/Icon/40.png", "/Image/Icon/41.png", "/Image/Icon/42.png", "称  号");
tc.AddItem(63, 28, 1, "/Image/Icon/39.png", "/Image/Icon/40.png", "/Image/Icon/41.png", "/Image/Icon/42.png", "荣  誉");
……
tc.SelectionChanged += (sender, item) => {
      QXTabControl tabControl = sender as QXTabControl;
      switch (item.Text) {
           case "属  性":
                tabControl.SetBody(leaderAttributePart);
           break;
           case "声  望":
                 tabControl.SetBody(new Canvas() {
                     Background = new ImageBrush() { ImageSource = Super.GetImage("/Image/Plate/RoleAttributeBack1.png") },
                     Width = 350,
                     Height = 389,
                 });
           break;
           case "称  号":
                 tabControl.SetBody(new Canvas() {
                      Background = new ImageBrush() { ImageSource = Super.GetImage("/Image/Plate/RoleAttributeBack2.png") },
                      Width = 350,
                      Height = 389,
                 });
           break;
           default:
                 tabControl.SetBody(null);
           break;
      };
};

上一页  1 2 3 4 5  下一页

Tags:开发 WPF Silverlight

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接