Beispiel #1
0
        public void DrawBtn(ResDocData infos)
        {
            // Set Current Doc
            SelectedDoc = infos;

            cvsMainDisplay.Children.Clear();
            int posNum = infos.BoxInfoList.Count;

            Button[] btn = new Button[posNum];

            for (int i = 0; i < posNum; i++)
            {
                var box = infos.BoxInfoList[i];
                var w   = box.x1 - box.x0;
                var h   = box.y1 - box.y0;

                // Bind event
                var newbtn = CheckButton(i, w, h);
                Canvas.SetLeft(newbtn, box.x0);
                Canvas.SetTop(newbtn, box.y0);

                cvsMainDisplay.Children.Add(newbtn);
                btn[i] = newbtn;
            }
        }
        public void DrawBtn(ResDocData infos, double wratio, double hratio)
        {
            // Set Current Doc
            SelectedDoc = infos;

            cvsMap.Children.Clear();
            int posNum = infos.BoxInfoList.Count;

            Button[] btn = new Button[posNum];

            for (int i = 0; i < posNum; i++)
            {
                var box = infos.BoxInfoList[i];
                int w   = (int)(box.w * wratio);
                int h   = (int)(box.h * hratio);

                // Bind event
                var newbtn = CheckButton(i, w, h, box.content);
                Canvas.SetLeft(newbtn, box.x0 * wratio);
                Canvas.SetTop(newbtn, box.y0 * hratio + h);

                cvsMap.Children.Add(newbtn);
                btn[i] = newbtn;
            }
        }
        public void SetImage(string srcpath, ResDocData dataInfo)    // done
        {
            // 원래 이미지 인풋이였는데 string 패쓰 인풋해준다
            // data인포로 그려주는데, 좌표를 리 스케일링 해서 비율 맞춰야 한다.

            var cvsw = cvsMap.ActualWidth;
            var cvsh = cvsMap.ActualHeight;
            var img  = new Image <Bgr, byte>(srcpath);
            var imgw = img.Width;
            var imgh = img.Height;

            imgMap.ImageSource = img.ToBitmapSource();


            DrawBtn(dataInfo, cvsw / imgw, cvsh / imgh);
        }
        public void test(ResDocData dataInfo, double wratio, double hratio)
        {
            cvsMap.Children.Clear();

            var box = dataInfo.BoxInfoList.First();
            int w   = (int)(box.w * wratio);
            int h   = (int)(box.h * hratio);

            // Bind event
            var newbtn = CheckButton(0, w, h, dataInfo.BoxInfoList.First().content);

            Canvas.SetLeft(newbtn, box.x0 * wratio);
            //Canvas.SetLeft( newbtn, 200 );
            Canvas.SetTop(newbtn, box.y0 * hratio + h);
            //Canvas.SetTop( newbtn, 200 );

            cvsMap.Children.Add(newbtn);
        }
Beispiel #5
0
        //public void test( ResDocData dataInfo )
        //{
        //    cvsMainDisplay.Children.Clear();

        //    var box = dataInfo.BoxInfoList.First();
        //    var w = box.w;
        //    var h = box.h;

        //    // Bind event
        //    var newbtn = CheckButton( 0 , w , h );
        //    Canvas.SetLeft( newbtn, box.x0 );
        //    Canvas.SetTop( newbtn, box.y0 );

        //    cvsMainDisplay.Children.Add( newbtn );
        //}

        public void CreateSecondBtn(ResDocData dataInfo)
        {
            //DrawBtn( dataInfo );
        }