コード例 #1
0
        //测量直线2
        private void buttonDrawLine2_Click(object sender, EventArgs e)
        {
            this.tabControl1.SelectedIndex = 0;
            //hWindowControl1.HalconWindow.ClearWindow();
            //HOperatorSet.DispObj(getImage, hwindow);
            hWindowControl1.Focus();
            HOperatorSet.SetLineWidth(hwindow, 2);
            HOperatorSet.SetDraw(hwindow, "margin");

            HObject Line2;

            HOperatorSet.GenEmptyObj(out Line2);
            Line2.Dispose();

            HOperatorSet.SetColor(hwindow, "yellow");
            HOperatorSet.DrawLineMod(hwindow, ImageHeight / 2 - 50, ImageWidth / 2, ImageHeight / 2 + 50, ImageWidth / 2,
                                     out L2StartRowDraw, out L2StartColumnDraw, out L2EndRowDraw, out L2EndColumnDraw);
            HOperatorSet.SetColor(hwindow, "green");
            HOperatorSet.GenRegionLine(out Line2, L2StartRowDraw, L2StartColumnDraw, L2EndRowDraw, L2EndColumnDraw);
            HOperatorSet.DispObj(Line2, hwindow);
        }