示例#1
0
        //测量直线1
        private void buttonDrawLine1_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 Line1;

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

            HOperatorSet.SetColor(hwindow, "yellow");
            HOperatorSet.DrawLineMod(hwindow, ImageHeight / 2, ImageWidth / 2 - 50, ImageHeight / 2, ImageWidth / 2 + 50,
                                     out L1StartRowDraw, out L1StartColumnDraw, out L1EndRowDraw, out L1EndColumnDraw);
            HOperatorSet.SetColor(hwindow, "green");
            HOperatorSet.GenRegionLine(out Line1, L1StartRowDraw, L1StartColumnDraw, L1EndRowDraw, L1EndColumnDraw);
            HOperatorSet.DispObj(Line1, hwindow);
        }