public PictureViewer(string type, Bitmap bitmap)
        {
            InitializeComponent();
            this.WindowState    = FormWindowState.Maximized;
            this.MinimumSize    = this.Size;
            this.DoubleBuffered = true;
            this.type           = type;
            this.bitmap         = bitmap;
            LblResult.Hide();
            this.FormBorderStyle = FormBorderStyle.FixedDialog;
            oldHeight            = ImageBox.Height;
            oldWidth             = ImageBox.Width;
            ImageBox.Image       = bitmap;
            ImageBox.SizeMode    = PictureBoxSizeMode.StretchImage;
            directory            = Directory.GetCurrentDirectory();

            if (type == "result")
            {
                this.WindowState     = FormWindowState.Maximized;
                this.FormBorderStyle = FormBorderStyle.Sizable;
                this.MinimumSize     = Size.Empty;
                this.MinimizeBox     = this.MaximizeBox = true;
                BtnDone.Hide();
                BtnReset.Hide();
                LblResult.Show();
                ImageBox.Width  = this.Width = bitmap.Width;
                ImageBox.Height = this.Height = bitmap.Height;
                ImageBox.Dock   = DockStyle.None;
                ImageBox.Anchor = AnchorStyles.None;
                //  ImageBox.Width = bitmap.Width;
                //ImageBox.Height = bitmap.Height;

                Console.WriteLine("scalebitmap" + ImageBox.Width.ToString() + "x" + ImageBox.Height.ToString());
            }
        }
Exemple #2
0
 private void TxtInput_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter || e.KeyCode == Keys.Return)
     {
         BtnDone.PerformClick();
     }
 }