Пример #1
0
        //双击选中的磁贴(保存其下面的图片),并启动编辑窗口
        private void SendPicture(object sender, EventArgs e)
        {
            var p = (TilePic)sender;

            if (p.BorderStyle == BorderStyle.FixedSingle)
            {
                var frm = new FormEditConfig {
                    Icon = this.Icon
                };
                if (myBitmap != null)
                {
                    double num  = (double)myBitmap.Width / (double)picEdited.Width;
                    int    pX   = Convert.ToInt32(num * (double)(p.Left - picEdited.Left));
                    int    pY   = Convert.ToInt32(num * (double)(p.Top - picEdited.Top));
                    int    num2 = Convert.ToInt32(num * (double)(p.Width - 1));
                    Bitmap part = PartImage.GetPart(myBitmap, pX, pY, num2, num2);
                    frm.picEditedView.Image = part;
                }
                pnlTile.Visible = false;
                frm.FormClosed += delegate(object a, FormClosedEventArgs b) {
                    pnlTile.Visible = true;
                };
                frm.ShowDialog();
            }
        }
Пример #2
0
        //双击选中的磁贴(保存其下面的图片),并启动编辑窗口
        private void SendPicture(object sender, EventArgs e)
        {
            var p = (TilePic)sender;

            if (p.BorderStyle == BorderStyle.FixedSingle)
            {
                var frm = new FormEditConfig();
                if (myBitmap != null)
                {
                    double num  = (double)myBitmap.Width / picEdited.Width;
                    int    pX   = Convert.ToInt32(num * (p.Left - picEdited.Left));
                    int    pY   = Convert.ToInt32(num * (p.Top - picEdited.Top));
                    int    num2 = Convert.ToInt32(num * (p.Width - 1));
                    Bitmap part = PartImage.GetPart(myBitmap, pX, pY, num2, num2);
                    frm.picEditedView.Image = part;
                }
                this.Hide();
                frm.FormClosed += (a, b) => this.Show();
                frm.ShowDialog();
            }
        }