Example #1
0
        public ResizablePictureBox CreateResizablePictureBox(string file)
        {
            string fileName = Path.GetFileName(file);
            string tempLoc = findLegalName(tempImages.Name,fileName);
            File.Copy(file,tempLoc);

            ResizablePictureBox pictureBox = new ResizablePictureBox(tempLoc);
            pictureBox.Name = String.Format("{0} (Image)",Path.GetFileNameWithoutExtension(file).Replace('_',' '));
            pictureBox.ContextMenuStrip = this.objectRightClick;
            pictureBox.MouseUp += new MouseEventHandler(Control_MouseUp);
            pictureBox.MouseDown += new MouseEventHandler(pictureBox_MouseDown);
            pictureBox.GotFocus += new EventHandler(pictureBox_GotFocus);
            pictureBox.LostFocus += new EventHandler(pictureBox_LostFocus);
            pictureBox.Move += new EventHandler(Control_Move);
            pictureBox.KeyDown += new KeyEventHandler(pictureBox_KeyDown);

            if (pictureBox.Width>this.workspace.Width)
                pictureBox.Width = this.workspace.Width;
            if (pictureBox.Height>this.workspace.Height)
                pictureBox.Height = this.workspace.Height;

            return pictureBox;
        }
Example #2
0
 public ResizablePictureBox CreateResizablePictureBox(ResizablePictureBox pictureBox)
 {
     ResizablePictureBox newPictureBox = CreateResizablePictureBox(pictureBox.ImageLocation);
     newPictureBox.Location = pictureBox.Location;
     newPictureBox.Size = pictureBox.Size;
     return newPictureBox;
 }
Example #3
0
 public ImageInfo(ResizablePictureBox pictureBox, int zindex, int fadeIn, int fadeOut)
     : base(zindex,fadeIn,fadeOut)
 {
     this.pictureBox = pictureBox;
 }
Example #4
0
 private void drawPictureBoxOutline(ResizablePictureBox pictureBox)
 {
     selected.Refresh();
     Graphics graphics = pictureBox.CreateGraphics();
     Pen pen = new Pen(Color.LightBlue,10);
     graphics.DrawRectangle(pen,pictureBox.ClientRectangle);
 }
Example #5
0
 private int defaultImageWidth(ResizablePictureBox control)
 {
     return control.Image.Width > maxSize.Width ? maxSize.Width : control.Image.Width;
 }
Example #6
0
 private int defaultImageHeight(ResizablePictureBox control)
 {
     return control.Image.Height > maxSize.Height ? maxSize.Height : control.Image.Height;
 }
Example #7
0
 private static Bitmap resizeImage(ResizablePictureBox pictureBox)
 {
     Bitmap bitmap = new Bitmap(pictureBox.Width,pictureBox.Height);
     Graphics graphics = Graphics.FromImage(bitmap);
     graphics.DrawImage(pictureBox.Image,new Rectangle(new Point(0,0),new Size(pictureBox.Width,pictureBox.Height)));
     return bitmap;
 }