示例#1
0
        private void LoadImage()
        {
            Image img  = this.CurrentEditImage;
            int   intX = 3; // (this.xtraScrollableControl.Width - img.Width) / 2;
            int   intY = 3; // (this.xtraScrollableControl.Height - img.Height) / 2;

            if (intX < 0)
            {
                intX = 0;
            }
            if (intY < 0)
            {
                intY = 0;
            }

            PictureBox objPicBox = new PictureBox();

            objPicBox.Location    = new Point(intX, intY);
            objPicBox.Image       = img;
            objPicBox.Size        = new Size(img.Width, img.Height);
            objPicBox.BackColor   = Color.White;
            objPicBox.BorderStyle = BorderStyle.None;

            objPicBox.MouseDown += new MouseEventHandler(PictureBox_MouseDown);
            objPicBox.MouseMove += new MouseEventHandler(PictureBox_MouseMove);
            objPicBox.MouseUp   += new MouseEventHandler(PictureBox_MouseUp);
            objPicBox.Paint     += new PaintEventHandler(PictureBox_Paint);
            objPicBox.Resize    += new EventHandler(PictureBox_Resize);

            PictureValue voPicture = new PictureValue();

            voPicture.imgBack   = img;
            voPicture.intWidth  = img.Width;
            voPicture.intHeight = img.Height;

            objPicBox.Tag = voPicture;
            objPicBox.Invalidate();

            this.enumPicPaintType = enmPicturePaintType.None;
            this.xtraScrollableControl.Controls.Clear();
            this.xtraScrollableControl.Controls.Add(objPicBox);

            Graphics   g        = Graphics.FromImage(objPicBox.Image);
            SolidBrush sbRubber = new SolidBrush(Color.White);

            g.FillRectangle(sbRubber, objPicBox.Image.Width - 2, 0, 2, objPicBox.Image.Height);
            g.FillRectangle(sbRubber, 0, objPicBox.Image.Height - 2, objPicBox.Image.Width, 2);
            g = null;

            this.penDash             = new Pen(Color.Black);
            this.penDash.DashPattern = new float[] { 3.0f, 3.0f };
            this.ghpSelectPath       = new GraphicsPath();
            this.imgFillImage        = new Bitmap(32, 32);
            this.txbContent          = new TextureBrush(imgFillImage);
        }
示例#2
0
        private void Function(DevExpress.XtraEditors.SimpleButton p_btnImage)
        {
            if (p_btnImage == null)
            {
                return;
            }
            this.picCurrentImage.Image = p_btnImage.Image;

            if (p_btnImage.Tag == null)
            {
                return;
            }
            switch (p_btnImage.Tag.ToString())
            {
            case "0":
                this.enumPicPaintType = enmPicturePaintType.None;
                break;

            case "1":
                this.enumPicPaintType = enmPicturePaintType.Pen;
                break;

            case "2":
                this.enumPicPaintType = enmPicturePaintType.Line;
                break;

            case "3":
                this.enumPicPaintType = enmPicturePaintType.Rectangle;
                break;

            case "4":
                this.enumPicPaintType = enmPicturePaintType.Round;
                break;

            case "5":
                this.enumPicPaintType = enmPicturePaintType.Polygon;
                break;

            case "6":
                this.enumPicPaintType = enmPicturePaintType.Rubber;
                break;

            case "7":
                this.enumPicPaintType = enmPicturePaintType.Text;
                break;

            case "8":
                this.enumPicPaintType = enmPicturePaintType.DashRect;
                break;

            case "9":
                this.enumPicPaintType = enmPicturePaintType.DashRound;
                break;

            case "10":
                this.enumPicPaintType = enmPicturePaintType.DashPen;
                break;

            case "11":
                break;

            default:
                break;
            }
        }