Exemplo n.º 1
0
        private void btnDo_Click(object sender, EventArgs e)
        {
            bool needsave = false;

            foreach (var fdata in FaceDataHelper.GetFaceDatas())
            {
                if (fdata.IsCustomed)
                {
                    needsave = true;
                    break;
                }
            }
            if (needsave == false)
            {
                return;
            }
            using (var fdlg = new FolderBrowserDialog())
            {
                fdlg.ShowNewFolderButton = true;
                if (fdlg.ShowDialog(this) == DialogResult.OK)
                {
                    var outputdir = fdlg.SelectedPath;
                    OutputHelper.Output(outputdir);
                    var dr = MessageBox.Show("已保存,是否打开文件夹", "已保存", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                    if (dr == DialogResult.Yes)
                    {
                        System.Diagnostics.Process.Start(outputdir);
                    }
                }
            }
        }
Exemplo n.º 2
0
        public static void Output(string outputDir)
        {
            var fdatas = FaceDataHelper.GetFaceDatas();
            var outputThumbFaceDatas = new List <FaceData>();

            foreach (var fdata in fdatas)
            {
                if (fdata.IsCustomed)
                {
                    CopyFile(fdata.Path13, fdata.Filename13, outputDir);
                    CopyFile(fdata.Path18, fdata.Filename18, outputDir);
                    CopyFile(fdata.Path20, fdata.Filename20, outputDir);
                    CopyFile(fdata.Path81, fdata.Filename81, outputDir);
                    CopyFile(fdata.Path82, fdata.Filename82, outputDir);
                    CopyFile(fdata.Path83, fdata.Filename83, outputDir);
                    if (string.IsNullOrEmpty(fdata.Path22) == false)
                    {
                        outputThumbFaceDatas.Add(fdata);
                    }
                }
            }

            if (outputThumbFaceDatas.Count > 0)
            {
                Dictionary <int, Image> drawImageCache = new Dictionary <int, Image>();
                List <int> pageChanged = new List <int>();
                foreach (var fdata in outputThumbFaceDatas)
                {
                    var pageno = fdata.PageInThumb;
                    if (drawImageCache.Keys.Contains(pageno) == false)
                    {
                        drawImageCache[fdata.PageInThumb] = new Bitmap(ThumbHelper.GetThumbPageImage(fdata.PageInThumb));
                    }
                    var g    = Graphics.FromImage(drawImageCache[pageno]);
                    var simg = Bitmap.FromFile(fdata.Path22);
                    g.DrawImage(simg,
                                new Rectangle(
                                    fdata.XPosInThumb * ThumbHelper.BLOCK_WIDTH,
                                    fdata.YPosInThumb * ThumbHelper.BLOCK_HEIGHT,
                                    ThumbHelper.BLOCK_WIDTH,
                                    ThumbHelper.BLOCK_HEIGHT),
                                new Rectangle(0, 0, ThumbHelper.BLOCK_WIDTH, ThumbHelper.BLOCK_HEIGHT),
                                GraphicsUnit.Pixel);
                    g.Dispose();
                    if (pageChanged.Contains(pageno) == false)
                    {
                        pageChanged.Add(pageno);
                    }
                }
                foreach (var pageno in pageChanged)
                {
                    SaveImage(drawImageCache[pageno], "00000022_0000" + pageno + ".bmp", outputDir);
                }
            }
            FaceDataHelper.SaveMyData();
        }
Exemplo n.º 3
0
        private void btnReset_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show("是否重置全部修改", "重置", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) != DialogResult.Yes)
            {
                return;
            }

            foreach (var pnl in this.flowPanels)
            {
                foreach (Control ctrl in pnl.Controls)
                {
                    if (ctrl is Button && ctrl.Tag is FaceData)
                    {
                        var btn   = ctrl as Button;
                        var fdata = btn.Tag as FaceData;
                        this.ResetFaceData(fdata);
                        this.ButtonBindFaceData(btn, fdata);
                    }
                }
            }
            FaceDataHelper.SaveMyData();
        }
Exemplo n.º 4
0
        public MainForm()
        {
            InitializeComponent();
            this.flowPanels = new FlowLayoutPanel[] {
                this.flowLayoutPanel1, this.flowLayoutPanel2,
                this.flowLayoutPanel3, this.flowLayoutPanel4,
                this.flowLayoutPanel5, this.flowLayoutPanel6,
                this.flowLayoutPanel7, this.flowLayoutPanel8
            };
            var datas = FaceDataHelper.GetFaceDatas();

            foreach (var data in datas)
            {
                var ctrl = new Button();
                this.ButtonBindFaceData(ctrl, data);
                ctrl.Width    = buttonsize;
                ctrl.Height   = buttonsize;
                ctrl.Tag      = data;
                ctrl.Click   += Ctrl_Click;
                ctrl.MouseUp += Ctrl_MouseUp;
                //ctrl.ForeColor = Color.GreenYellow;
                ctrl.Font      = new Font(new FontFamily("宋体"), 7, FontStyle.Bold);
                ctrl.TextAlign = ContentAlignment.BottomCenter;
                var pnl = this.flowPanels[data.PageInThumb - 1];
                ctrl.Margin = new Padding(0);
                pnl.Controls.Add(ctrl);
                if (data.Number % 10 == 0)
                {
                    var page = ThumbHelper.GetThumbPage(data.PageInThumb);
                    if (data.XPosInThumb + 1 == page.ColSize)
                    {
                        pnl.SetFlowBreak(ctrl, true);
                    }
                }
                ctrl.Show();
            }
            dlg = new Pig313PKFaceToolPlus.EditForm();
        }
Exemplo n.º 5
0
 private void Form1_FormClosed(object sender, FormClosedEventArgs e)
 {
     FaceDataHelper.SaveMyData();
 }