コード例 #1
0
        public void BlendPictures(PictureBoxProxy i_PictureCover)
        {
            Bitmap bitmap = new Bitmap(PhotoComponent.Width, PhotoComponent.Height);

            using (Graphics graphics = Graphics.FromImage(bitmap))
            {
                graphics.DrawImage(PhotoComponent, 0, 0, PhotoComponent.Width, PhotoComponent.Height);
            }

            Graphics  g = Graphics.FromImage(bitmap);
            Rectangle rectangleAreaToDrawImage = new Rectangle(i_PictureCover.Location.X, i_PictureCover.Location.Y, i_PictureCover.Width, i_PictureCover.Height);

            g.DrawImage(i_PictureCover.Image, rectangleAreaToDrawImage);
            PhotoComponent = bitmap;
        }
コード例 #2
0
 public Glasses(PhotoComponent i_Photo, PictureBoxProxy glassesPicture) : base(i_Photo)
 {
     BlendPictures(glassesPicture);
 }
コード例 #3
0
ファイル: Hat.cs プロジェクト: roiadiv/Facebook-winForm-app
 public Hat(PhotoComponent i_Photo, PictureBoxProxy hatPicture) : base(i_Photo)
 {
     BlendPictures(hatPicture);
 }
コード例 #4
0
        private void checkBox_CheckedChanged(object sender, EventArgs e)
        {
            CheckBox selectedCheckBox = sender as CheckBox;

            if (selectedCheckBox.Checked == true)
            {
                buttonStartDecorate.Enabled = true;
                r_CheckedDecoratorFeatures.Add(selectedCheckBox.Text);
                if (selectedCheckBox.Parent == panelThugLife)
                {
                    eThugLifeItems thugLifeItem;
                    Enum.TryParse(selectedCheckBox.Text, out thugLifeItem);
                    switch (thugLifeItem)
                    {
                    case eThugLifeItems.Hat:
                        PictureBoxProxy hatPhoto = new PictureBoxProxy();
                        hatPhoto.Location   = pictureBoxEditPhoto.Location;
                        hatPhoto.Name       = "Hat";
                        hatPhoto.Image      = global::Facebook_app.Properties.Resources.Thug_Life_Black_Hat_PNG;
                        hatPhoto.Size       = hatPhoto.Image.Size;
                        hatPhoto.Parent     = pictureBoxEditPhoto;
                        hatPhoto.BackColor  = Color.Transparent;
                        hatPhoto.MouseDown += (ss, mouseEvent) =>
                        {
                            if (mouseEvent.Button == MouseButtons.Left)
                            {
                                hatPhoto.ImageFirstPoint = Control.MousePosition;
                            }
                        };

                        hatPhoto.MouseMove += (ss, mouseEvent) =>
                        {
                            if (mouseEvent.Button == MouseButtons.Left)
                            {
                                Point tempPointToDrag = Control.MousePosition;
                                Point reLocation      = new Point(hatPhoto.ImageFirstPoint.X - tempPointToDrag.X, hatPhoto.ImageFirstPoint.Y - tempPointToDrag.Y);
                                hatPhoto.Location        = new Point(hatPhoto.Location.X - reLocation.X, hatPhoto.Location.Y - reLocation.Y);
                                hatPhoto.ImageFirstPoint = tempPointToDrag;
                            }
                        };

                        r_ItemsToBlend.Add(hatPhoto.Name, hatPhoto);
                        pictureBoxEditPhoto.Controls.Add(hatPhoto);
                        break;

                    case eThugLifeItems.Necklace:
                        PictureBoxProxy necklacePhoto = new PictureBoxProxy();
                        necklacePhoto.Location   = pictureBoxEditPhoto.Location;
                        necklacePhoto.Name       = "Necklace";
                        necklacePhoto.Parent     = pictureBoxEditPhoto;
                        necklacePhoto.BackColor  = Color.Transparent;
                        necklacePhoto.Image      = global::Facebook_app.Properties.Resources.Thug_Life_Gold_Chain1;
                        necklacePhoto.Size       = necklacePhoto.Image.Size;
                        necklacePhoto.MouseDown += (ss, mouseEvent) =>
                        {
                            if (mouseEvent.Button == MouseButtons.Left)
                            {
                                necklacePhoto.ImageFirstPoint = Control.MousePosition;
                            }
                        };

                        necklacePhoto.MouseMove += (ss, mouseEvent) =>
                        {
                            if (mouseEvent.Button == MouseButtons.Left)
                            {
                                Point tempPointToDrag = Control.MousePosition;
                                Point reLoction       = new Point(necklacePhoto.ImageFirstPoint.X - tempPointToDrag.X, necklacePhoto.ImageFirstPoint.Y - tempPointToDrag.Y);
                                necklacePhoto.Location        = new Point(necklacePhoto.Location.X - reLoction.X, necklacePhoto.Location.Y - reLoction.Y);
                                necklacePhoto.ImageFirstPoint = tempPointToDrag;
                            }
                        };

                        r_ItemsToBlend.Add(necklacePhoto.Name, necklacePhoto);
                        pictureBoxEditPhoto.Controls.Add(necklacePhoto);
                        break;

                    case eThugLifeItems.Joint:
                        PictureBoxProxy jointPhoto = new PictureBoxProxy();
                        jointPhoto.Location   = pictureBoxEditPhoto.Location;
                        jointPhoto.Name       = "Joint";
                        jointPhoto.Image      = global::Facebook_app.Properties.Resources.thugLifeJoint;
                        jointPhoto.Size       = jointPhoto.Image.Size;
                        jointPhoto.Parent     = pictureBoxEditPhoto;
                        jointPhoto.BackColor  = Color.Transparent;
                        jointPhoto.MouseDown += (ss, mouseEvent) =>
                        {
                            if (mouseEvent.Button == MouseButtons.Left)
                            {
                                jointPhoto.ImageFirstPoint = Control.MousePosition;
                            }
                        };

                        jointPhoto.MouseMove += (ss, mouseEvent) =>
                        {
                            if (mouseEvent.Button == MouseButtons.Left)
                            {
                                Point tempPointToDrag = Control.MousePosition;
                                Point reLoaction      = new Point(jointPhoto.ImageFirstPoint.X - tempPointToDrag.X, jointPhoto.ImageFirstPoint.Y - tempPointToDrag.Y);
                                jointPhoto.Location        = new Point(jointPhoto.Location.X - reLoaction.X, jointPhoto.Location.Y - reLoaction.Y);
                                jointPhoto.ImageFirstPoint = tempPointToDrag;
                            }
                        };

                        r_ItemsToBlend.Add(jointPhoto.Name, jointPhoto);
                        pictureBoxEditPhoto.Controls.Add(jointPhoto);
                        break;

                    case eThugLifeItems.Glasses:
                        PictureBoxProxy glassesPhoto = new PictureBoxProxy();
                        glassesPhoto.Location   = pictureBoxEditPhoto.Location;
                        glassesPhoto.Name       = "Glasses";
                        glassesPhoto.Image      = global::Facebook_app.Properties.Resources.Thug_Life_Cool_Glasse1;
                        glassesPhoto.Size       = glassesPhoto.Image.Size;
                        glassesPhoto.Parent     = pictureBoxEditPhoto;
                        glassesPhoto.BackColor  = Color.Transparent;
                        glassesPhoto.MouseDown += (ss, mouseEvent) =>
                        {
                            if (mouseEvent.Button == MouseButtons.Left)
                            {
                                glassesPhoto.ImageFirstPoint = Control.MousePosition;
                            }
                        };

                        glassesPhoto.MouseMove += (ss, mouseEvent) =>
                        {
                            if (mouseEvent.Button == MouseButtons.Left)
                            {
                                Point tempPointToDrag = Control.MousePosition;
                                Point reLoaction      = new Point(glassesPhoto.ImageFirstPoint.X - tempPointToDrag.X, glassesPhoto.ImageFirstPoint.Y - tempPointToDrag.Y);
                                glassesPhoto.Location        = new Point(glassesPhoto.Location.X - reLoaction.X, glassesPhoto.Location.Y - reLoaction.Y);
                                glassesPhoto.ImageFirstPoint = tempPointToDrag;
                            }
                        };

                        r_ItemsToBlend.Add(glassesPhoto.Name, glassesPhoto);
                        pictureBoxEditPhoto.Controls.Add(glassesPhoto);
                        break;
                    }
                }
            }
            else
            {
                r_CheckedDecoratorFeatures.Remove(selectedCheckBox.Text);
                r_ItemsToBlend.Remove(selectedCheckBox.Text);
                if (selectedCheckBox.Parent == panelThugLife)
                {
                    pictureBoxEditPhoto.Controls.RemoveByKey(selectedCheckBox.Text);
                }

                if (r_CheckedDecoratorFeatures.Count == 0)
                {
                    buttonStartDecorate.Enabled = false;
                }
            }
        }
コード例 #5
0
 public Necklace(PhotoComponent i_Photo, PictureBoxProxy necklacePicture) : base(i_Photo)
 {
     BlendPictures(necklacePicture);
 }
コード例 #6
0
 public Joint(PhotoComponent i_Photo, PictureBoxProxy jointPicture) : base(i_Photo)
 {
     BlendPictures(jointPicture);
 }