Ejemplo n.º 1
0
        public Image DisplayArray(int objectNo)
        {
            //아래의 라인을 막으면 메인에서 NowRectangle함수가 0으로 나타난다.
            //Recipe_Config_Viewer_To_List_Inspect 메인의 함수에서 NowRectangle 이를 사용할수 없다.
            _nowGraphicsList = _drawArea1.GetSetGraphicsList;
            _nowRectangle    = _nowGraphicsList[objectNo].NowRectangle();

            var cg = _drawArea1.pictureBox1.CreateGraphics();

            var pointx  = Convert.ToInt32(_nowRectangle.X * _multiplyX);
            var pointy  = Convert.ToInt32(_nowRectangle.Y * _multiplyY);
            var lengthx = Convert.ToInt32(_nowRectangle.Width * _multiplyX);
            var lengthy = Convert.ToInt32(_nowRectangle.Height * _multiplyY);

            _realRectangles[objectNo].X      = pointx;
            _realRectangles[objectNo].Y      = pointy;
            _realRectangles[objectNo].Width  = lengthx;
            _realRectangles[objectNo].Height = lengthy;

            _cutImage  = new Bitmap(lengthx, lengthy);
            _cutImageG = Graphics.FromImage(_cutImage);

            _cutRectangle = new Rectangle(0, 0, lengthx, lengthy);

            _cutImageG.DrawImage(_drawArea1.pictureBox1.Image, _cutRectangle, pointx, pointy, lengthx, lengthy, GraphicsUnit.Pixel);
            //textBox1.Text += "Jpg : " + pointx.ToString("0000")+ "    " + pointy.ToString("0000")+ "    " + lengthx.ToString("0000") + "    " + lengthy.ToString("0000");
            return(_cutImage);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     Initialization
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="docManager"></param>
        public void Initialize(Form owner, ref GraphicsList graphicsList)
        {
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer, true);

            // Keep reference to owner form
            Owner = owner;

            // create list of graphic objects
            //_graphicsList = new GraphicsList();
            _graphicsList = graphicsList;
        }
Ejemplo n.º 3
0
        public ControlDrawArea(DrawArea drawArea, FormDlgMain formDlg)
        {
            _drawArea1 = drawArea;
            FormDlgMain formDlgMain = formDlg;

            _drawArea1.DrawingEnd     += new MyEvent1(DisplayArea);
            _drawArea1.RectSeclecting += new RecipeEvent2(Rect_Selected);

            _cusCap = new System.Drawing.Drawing2D.AdjustableArrowCap(5, 5, false);

            _drawArea1.Owner = formDlgMain;
            _nowGraphicsList = new GraphicsList();

            //_drawArea1.Initialize(formDlgMain);
            _drawArea1.Initialize(formDlgMain, ref _nowGraphicsList);

            _rectArray = new DrawList();
        }