//双击选中的磁贴(保存其下面的图片),并启动编辑窗口 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(); } }
//蒙版预览加黑 private void BtnMask_Click(object sender, EventArgs e) { //添加蒙版 if (btnMask.Text == "蒙版") { btnMask.Text = "取消"; btnEditPic.Enabled = false; btnSelectPic.Enabled = false; pnlBack.BackColor = Color.Black; if (picImage.Image != null) { pnlTile.Enabled = false; pnlTile.BackColor = Color.Black; foreach (PictureBox p in pnlTile.Controls) { if (p.BorderStyle == BorderStyle.FixedSingle) { p.Image = PartImage.GetPart(picImage.Image, p.Left, p.Top, p.Width, p.Height); } } } else { picImage.Visible = false; } } //取消蒙版 else { btnMask.Text = "蒙版"; btnSelectPic.Enabled = true; if (picImage.Image != null) { btnEditPic.Enabled = true; pnlTile.Enabled = true; pnlTile.BackColor = Color.Transparent; } else { picImage.Visible = true; } pnlBack.BackColor = MyBackColor; foreach (PictureBox p in pnlTile.Controls) { p.Image = null; } } }
//双击选中的磁贴(保存其下面的图片),并启动编辑窗口 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(); } }