using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using MaterialSkin.Controls; namespace Lindt.Candybox.RecipeSelector { public partial class FAUFInput : MaterialForm { public FAUFInput(string recipe) { InitializeComponent(); lblBlisterName.Text = recipe.Replace("R", ""); var path = @"..\Data\Samples\\" +recipe + ".bmp"; Bitmap sample; if (File.Exists(path)) { sample = new Bitmap(path); } else { sample = new Bitmap(256,256); } var img = new Bitmap(256,256); using (Graphics g = Graphics.FromImage(img)) { g.Clear(Color.White); var offsetX = (img.Width - sample.Width) / 2; var offsetY = (img.Height - sample.Height) / 2; g.DrawImage(sample,offsetX,offsetY,sample.Width,sample.Height); } sample.Dispose(); pictureBox1.Image = img; textBox1.Focus(); textBox1.SelectAll(); } public string Value { get; set; } = ""; private void btnSkip_Click(object sender, EventArgs e) { DialogResult = DialogResult.OK; } private void btnStart_Click(object sender, EventArgs e) { Value = textBox1.Text; DialogResult = DialogResult.OK; } private void textBox1_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Return) { Value = textBox1.Text; DialogResult = DialogResult.OK; } } } }