“熊猫视图”.Net图形控件功能介绍 [二十四]:视图联动

        “熊猫视图”.Net图形控件支持视图之间的联动操作与显示。即,当在主视图A中操作时,关联视图B同步进行响应的操作和显示。演示代码如下:

namespace 熊猫视图
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();

            //设置视图范围
            pandaView1.ScaleView(0, 0, 1920, 1080);
            pandaView2.ScaleView(0, 0, 1920, 1080);

            //设置联动视图
            pandaView1.LinkView = pandaView2;
        }

        private void Form1_Shown(object sender, EventArgs e)
        {
            pandaView1.FullView();
            pandaView2.FullView();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            //定义视图1图像对象
            PandaView.Picture p1 = new PandaView.Picture();
            p1.Points = new[] { new PointF(0, 0), new PointF(1920, 1080) };
            p1.AllowZoom = true;
            p1.FixSize = false;
            p1.Edge = true;
            p1.EdgePen = Pens.Crimson;
            p1.Image = Image.FromFile(@"D:\1.jpg");
            p1.Creat(pandaView1);

            //定义视图2图像对象
            PandaView.Picture p2 = new PandaView.Picture();
            p2.Points = new[] { new PointF(0, 0), new PointF(1920, 1080) };
            p2.AllowZoom = true;
            p2.FixSize = false;
            p2.Edge = true;
            p2.EdgePen = Pens.Blue;
            p2.Image = Image.FromFile(@"D:\2.jpg");
            p2.Creat(pandaView2);

            .....省略定义左上角文字对象.....
        }

        private void 关联放大局部ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            pandaView1.ViewTool = pandaView2.ViewTool = PandaView.ViewTools.ZoomInArea;
        }

        private void 关联LineDrawToolStripMenuItem_Click(object sender, EventArgs e)
        {
            pandaView1.ViewTool = pandaView2.ViewTool = PandaView.ViewTools.LineDraw;
        }
    }
}

视图缩放平联动操作效果:

 视图放大局部联动操作效果:

 视图LineDraw联动操作效果:

你可能感兴趣的:(熊猫视图.Net控件,c#,视图联动,C#,图形联动,C#,显示联动,c#,熊猫视图)