Exemple #1
0
        private void layoutOption(List<String> _temporary)//选项 8个
        {
            mbordercontrol = new PaperBorderControl();
           
            mBorders = new List<Border>();

            mImagecontrol = new PaperImageControl();

            vImages = new List<Image>();

            cutLine();


            // 载入选项
            for (int i = 0; i < _temporary.Count; i++)// 8 是选项 ps:在内部就可以显示border 放外部循环就不行
            {
                //border 
                b = mbordercontrol.GenBorder(102, 94);
                mBorders.Add(b);
                PapertestCanvas.Children.Add(b);
                

                //image
                im = new Image();
                im = mImagecontrol.GetImage(82, 74);
                BitmapImage bitim = new BitmapImage();
                bitim.BeginInit();
               // bitim.UriSource = new Uri("\\PCAT;component\\Images\\" + _temporary[i] + ".bmp", UriKind.Relative);
                bitim.EndInit();
                im.Stretch = Stretch.Fill;
                im.Source = bitim;
                vImages.Add(im);
                PapertestCanvas.Children.Add(im);
               
                //Event

                im.MouseDown += new MouseButtonEventHandler(im_MouseDown);
                im.MouseEnter += new MouseEventHandler(im_MouseEnter);
                im.MouseLeave += new MouseEventHandler(im_MouseLeave);

                if (i < (_temporary.Count / 2))
                {

                    Canvas.SetTop(b, actual_y + bordertop);//
                    Canvas.SetLeft(b, actual_x + borderleft);// 
                    borderleft = borderleft + borderadd;

                    Canvas.SetTop(im, actual_y + imagetop);//
                    Canvas.SetLeft(im, actual_x + imageleft);//
                    imageleft = imageleft + imageadd;
                    
                    
                    
                }
                else 
                {
                    Canvas.SetTop(b, actual_y + bordertop2);// 
                    Canvas.SetLeft(b, actual_x + borderleft2);// 
                    borderleft2 = borderleft2 + borderadd;

                    Canvas.SetTop(im, actual_y + imagetop2);//
                    Canvas.SetLeft(im, actual_x + imageleft2);//
                    imageleft2 = imageleft2 + imageadd;
                    
                }
             }//---for

        }
Exemple #2
0
        public ExamplePage()
        {
            InitializeComponent();
            BaseCanvas.Width  = (int)System.Windows.SystemParameters.PrimaryScreenWidth;
            BaseCanvas.Height = (int)System.Windows.SystemParameters.PrimaryScreenHeight;
            mbordercontrol    = new PaperBorderControl();

            mBorders = new List <Border>();

            mImagecontrol = new PaperImageControl();

            mImages = new List <Image>();

            mLayoutInstruction = new LayoutInstruction(ref BaseCanvas);

            mLayoutInstruction.addInstruction(-FEITStandard.PAGE_BEG_Y, -FEITStandard.PAGE_BEG_X, FEITStandard.PAGE_WIDTH / 100 * 81, 140,
                                              "    横线上方呈现了折纸和扎孔(扎透了所有的层)的过程,横线下方给出了5种纸被展开后的情况,其中只有一个是正确的答案。"
                                              , "Kaiti_GB2312", 30, Color.FromRgb(255, 255, 255));

            //窗口布局



            Canvas.SetLeft(border1, actual_x + 55);
            Canvas.SetTop(border1, actual_y + 320);

            Canvas.SetLeft(label1, actual_x + 609);//正确答案
            Canvas.SetTop(label1, actual_y + 595);

            Canvas.SetLeft(label2, actual_x + 214);//请选择正确答案
            Canvas.SetTop(label2, actual_y + 500);

            Canvas.SetLeft(label3, actual_x + 294);//正确答案
            Canvas.SetTop(label3, actual_y + 270);

            Canvas.SetLeft(label4, actual_x + 433);//正确答案
            Canvas.SetTop(label4, actual_y + 270);


            additem();//练习题目



            //
            for (int i = 0; i < 5; i++)
            {
                //border
                b = mbordercontrol.GenBorder(102, 94);
                mBorders.Add(b);
                this.BaseCanvas.Children.Add(b);
                Canvas.SetTop(b, actual_y + bordertop);
                Canvas.SetLeft(b, actual_x + borderleft);
                borderleft = borderleft + borderadd;

                //image
                string temp = (i + 1).ToString();
                im         = new Image();
                im.Stretch = Stretch.Fill;

                System.Drawing.Image  pie  = System.Drawing.Image.FromFile("Paper\\PaperRes\\Example\\O" + temp + ".bmp");
                System.Drawing.Bitmap bmpe = new System.Drawing.Bitmap(pie);

                IntPtr hBitmape = bmpe.GetHbitmap();
                System.Windows.Media.ImageSource WpfBitmape = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmape, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(82, 74));//FromEmptyOptions() 源图像大小
                im.Source = WpfBitmape;
                //im = mImagecontrol.GetImage(82,74);
                //BitmapImage bitim = new BitmapImage();
                //bitim.BeginInit();
                //bitim.UriSource = new Uri("/PCAT;component/Images/O" + temp + ".bmp", UriKind.Relative);
                //bitim.EndInit();
                //im.Stretch = Stretch.Fill;
                //im.Source = bitim;
                mImages.Add(im);
                this.BaseCanvas.Children.Add(im);
                Canvas.SetTop(im, actual_y + imagetop);
                Canvas.SetLeft(im, actual_x + imageleft);
                imageleft = imageleft + imageadd;
                //Event

                im.MouseDown  += new MouseButtonEventHandler(im_MouseDown);
                im.MouseEnter += new MouseEventHandler(im_MouseEnter);
                im.MouseLeave += new MouseEventHandler(im_MouseLeave);
            }
        }
Exemple #3
0
        private void layoutOptionFive(List<String> _temporary)
        {
            mbordercontrol = new PaperBorderControl();

            mBorders = new List<Border>();

            mImagecontrol = new PaperImageControl();

            vImages = new List<Image>();

            cutLine();

            cut_line.Width = 660 + 180; //分割线加长

            imageleft = 130 - 85;

            borderleft = 120 - 85;
            // 载入选项
            for (int i = 0; i < _temporary.Count; i++)// 8 是选项 ps:在内部就可以显示border 放外部循环就不行
            {
                //border 
                b = mbordercontrol.GenBorder(102, 94);
                mBorders.Add(b);
                PapertestCanvas.Children.Add(b);


                //image
                im = new Image();

                im.Stretch = Stretch.Fill;

                System.Drawing.Image picc = System.Drawing.Image.FromFile("Paper\\PaperRes\\Test\\PaS\\" + _temporary[i] + ".bmp");
                System.Drawing.Bitmap bmpc = new System.Drawing.Bitmap(picc);

                IntPtr hBitmapc = bmpc.GetHbitmap();
                System.Windows.Media.ImageSource WpfBitmapc = System.Windows.Interop.Imaging.CreateBitmapSourceFromHBitmap(hBitmapc, IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(82, 74));//FromEmptyOptions() 源图像大小
                im.Source = WpfBitmapc;

                //im = mImagecontrol.GetImage(82, 74);
                //BitmapImage bitim = new BitmapImage();
                //bitim.BeginInit();
                //bitim.UriSource = new Uri("\\PCAT;component\\Images\\" + _temporary[i] + ".bmp", UriKind.Relative);
                //bitim.EndInit();
                //im.Stretch = Stretch.Fill;
                //im.Source = bitim;
                vImages.Add(im);
                PapertestCanvas.Children.Add(im);

                //Event

                im.MouseDown += new MouseButtonEventHandler(im_MouseDown);
                im.MouseEnter += new MouseEventHandler(im_MouseEnter);
                im.MouseLeave += new MouseEventHandler(im_MouseLeave);

                
                    Canvas.SetTop(b, actual_y + bordertop);//
                    Canvas.SetLeft(b, actual_x + borderleft);// 
                    borderleft = borderleft + borderadd;

                    Canvas.SetTop(im, actual_y + imagetop);//
                    Canvas.SetLeft(im, actual_x + imageleft);//
                    imageleft = imageleft + imageadd;



                
            }//---for
        }