static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); MainForm = new ColorEdit(); Application.Run(MainForm); }
private void pict_DragDrop(object sender, DragEventArgs e) { string[] strFileNames = (string[])e.Data.GetData(DataFormats.FileDrop); if (strFileNames.Length < 1) { return; } if (!System.IO.File.Exists(strFileNames[0])) { return; } ColorEdit fm = Program.MainForm; for (int i = 0; i < fm.BmpWork.Length; ++i) { fm.BmpWork[i] = null; } Bitmap input = new Bitmap(strFileNames[0]); fm.BmpWork[0] = new Bitmap(input.Width, input.Height); Graphics g = Graphics.FromImage(fm.BmpWork[0]); g.DrawImage(input, 0, 0, fm.BmpWork[0].Width, fm.BmpWork[0].Height); input.Dispose(); pict.Width = fm.BmpWork[0].Width; pict.Height = fm.BmpWork[0].Height; this.Width = fm.BmpWork[0].Width + pict.Location.X + 48; this.Height = fm.BmpWork[0].Height + pict.Location.Y + 64; pict.Image = fm.BmpWork[0]; fm.btnUndo.Enabled = false; fm.btnRedo.Enabled = false; }