代码拉取完成,页面将自动刷新
同步操作将从 勒密尔朗/studentPhotoCollection 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
using System;
using System.Drawing;
using System.Windows.Forms;
namespace StudentPhotoCollection
{
public partial class PreviewForm : Form
{
private Image img;
private Bitmap bitmap;
private bool confirm;
private bool saveFlag;
public PreviewForm(Image img, string formName)
{
InitializeComponent();
this.img = img;
this.Text = formName;
// 设置窗体大小
if (this.img.Width > 10)
{
this.Width = this.img.Width;
}
if(this.img.Height > 10)
{
this.Height = this.img.Height;
}
this.pictureBox_photoOne.Image = this.img;
}
public PreviewForm(Bitmap img, string formName, bool confirm)
{
InitializeComponent();
this.bitmap = img;
this.Text = formName;
this.confirm = confirm;
this.saveFlag = false;
// 设置窗体大小
if (this.bitmap.Width > 10)
{
this.Width = this.bitmap.Width;
}
if (this.bitmap.Height > 10)
{
this.Height = this.bitmap.Height;
}
this.pictureBox_photoOne.Image = this.bitmap;
// 是否显示确认按钮
if (this.confirm)
{
// 显示重拍和继续按钮
this.panel1.Visible = true;
// 将PictureBox设为透明,在C#中,控件的透明指对父窗体透明。
this.panel1.BackColor = Color.Transparent;
this.panel1.Parent = this.pictureBox_photoOne;
// 设置拍照按钮图片始终左右居中
int x = (int)(0.5 * (this.Width - this.panel1.Width));
int y = (int)(0.9 * (this.Height - this.panel1.Height));
//int y = this.panel1.Location.Y;
this.panel1.Location = new System.Drawing.Point(x, y);
}
}
private void PreviewForm_Load(object sender, EventArgs e)
{
}
private void PreviewForm_FormClosing(object sender, FormClosingEventArgs e)
{
if (this.confirm && !this.saveFlag)
{
//父窗体
MainForm mainForm = (MainForm)this.Owner;
//设置并保存照片
mainForm.SaveShootPhoto(this.bitmap);
}
}
private void PreviewForm_Resize(object sender, EventArgs e)
{
// 设置图片始终跟随,注意pictureBox的SizeMode 属性值需设置为 StretchImage
this.pictureBox_photoOne.Width = this.Width;
this.pictureBox_photoOne.Height = this.Height;
if (this.confirm)
{
// 设置拍照按钮图片始终左右居中
int x = (int)(0.5 * (this.Width - this.panel1.Width));
int y = (int)(0.9 * (this.Height - this.panel1.Height));
//int y = this.panel1.Location.Y;
this.panel1.Location = new System.Drawing.Point(x, y);
}
}
private void Button_reShoot_Click(object sender, EventArgs e)
{
//重拍照片
Dispose();
Close();
}
private void Button_okNext_Click(object sender, EventArgs e)
{
//继续拍照
//父窗体
MainForm mainForm = (MainForm)this.Owner;
//设置并保存照片
mainForm.SaveShootPhoto(this.bitmap);
this.saveFlag = true;
Dispose();
Close();
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。