XToolControl.cs
上传用户:lslight
上传日期:2022-01-10
资源大小:14248k
文件大小:5k
源码类别:

DirextX编程

开发平台:

C#

  1. ////////////////////////////////////////////////////////////////////////
  2. //      ■■■■     ■■■■■       ■■■■       ■       ■      //
  3. //    ■                 ■         ■               ■       ■      //
  4. //    ■                 ■         ■    ■■■     ■       ■      //
  5. //    ■                 ■         ■       ■      ■       ■      //
  6. //      ■■■■         ■           ■■■■         ■■■■       //
  7. // Copyright (c) 三峡大学水利与环境学院 肖泽云. All rights reserved.  //
  8. ////////////////////////////////////////////////////////////////////////
  9. using System;
  10. using System.Collections.Generic;
  11. using System.ComponentModel;
  12. using System.Drawing;
  13. using System.Data;
  14. using System.Text;
  15. using System.Windows.Forms;
  16. namespace CTGU.XZY
  17. {
  18.     public partial class XToolControl : UserControl
  19.     {
  20.         public XSceneControl xSceneControl;
  21.         public XToolControl()
  22.         {
  23.             InitializeComponent();
  24.         }
  25.         [Description("设置三维控件对象")] //显示在属性设计视图中的描述
  26.         [Browsable(true)]//指定是否在属性栏可见
  27.         [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]//指定属性对设计时序列化程序所具有的可见性。 
  28.         public XSceneControl SceneControl
  29.         {
  30.             get
  31.             {
  32.                 return xSceneControl;
  33.             }
  34.             set
  35.             {
  36.                 this.xSceneControl = value;
  37.             }
  38.         }
  39.         private bool CheckControl()//用于检查是否链接到三维控件
  40.         {
  41.             if (xSceneControl == null)
  42.             {
  43.                 return false;
  44.             }
  45.             else
  46.             {
  47.                 return true;
  48.             }
  49.         }
  50.         private void originViewTool_Click(object sender, EventArgs e)
  51.         {
  52.             if (!CheckControl())
  53.             {
  54.                 return;
  55.             }
  56.             xSceneControl.ResetView();
  57.         }
  58.         private void refreshViewTool_Click(object sender, EventArgs e)
  59.         {
  60.             if (!CheckControl())
  61.             {
  62.                 return;
  63.             }
  64.             xSceneControl.Render();
  65.         }
  66.         private void zoomInTool_Click(object sender, EventArgs e)
  67.         {
  68.             if (!CheckControl())
  69.             {
  70.                 return;
  71.             }
  72.             xSceneControl.ZoomIn();
  73.         }
  74.         private void zoomOutTool_Click(object sender, EventArgs e)
  75.         {
  76.             if (!CheckControl())
  77.             {
  78.                 return;
  79.             }
  80.             xSceneControl.ZoomOut();
  81.         }
  82.         private void lastViewTool_Click(object sender, EventArgs e)
  83.         {
  84.             if (!CheckControl())
  85.             {
  86.                 return;
  87.             }
  88.             xSceneControl.LastScene();
  89.         }
  90.         private void nextViewTool_Click(object sender, EventArgs e)
  91.         {
  92.             if (!CheckControl())
  93.             {
  94.                 return;
  95.             }
  96.             xSceneControl.NextScene();
  97.         }
  98.         private void rotateLeftTool_Click(object sender, EventArgs e)
  99.         {
  100.             if (!CheckControl())
  101.             {
  102.                 return;
  103.             }
  104.             xSceneControl.RotateLeft();
  105.         }
  106.         private void rotateRightTool_Click(object sender, EventArgs e)
  107.         {
  108.             if (!CheckControl())
  109.             {
  110.                 return;
  111.             }
  112.             xSceneControl.RotateRight();
  113.         }
  114.         private void rotateUpTool_Click(object sender, EventArgs e)
  115.         {
  116.             if (!CheckControl())
  117.             {
  118.                 return;
  119.             }
  120.             xSceneControl.RotateUp();
  121.         }
  122.         private void rotateDownTool_Click(object sender, EventArgs e)
  123.         {
  124.             if (!CheckControl())
  125.             {
  126.                 return;
  127.             }
  128.             xSceneControl.RotateDown();
  129.         }
  130.         private void viewTopTool_Click(object sender, EventArgs e)
  131.         {
  132.             if (!CheckControl())
  133.             {
  134.                 return;
  135.             }
  136.             xSceneControl.TopView();
  137.         }
  138.         private void viewFrontButton_Click(object sender, EventArgs e)
  139.         {
  140.             if (!CheckControl())
  141.             {
  142.                 return;
  143.             }
  144.             xSceneControl.FrontView();
  145.         }
  146.         private void viewLeftTool_Click(object sender, EventArgs e)
  147.         {
  148.             if (!CheckControl())
  149.             {
  150.                 return;
  151.             }
  152.             xSceneControl.LeftView();
  153.         }
  154.     }
  155. }