Example #1
0
        private void buttonSelectShema_Click(object sender, EventArgs e)
        {
            if (openFileSchema.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    store.Schema      = new Bitmap(openFileSchema.FileName);
                    schemaImage.Image = store.GetCopyOfSchema();

                    double scale     = Math.Min(800.0 / store.Schema.Width, 600.0 / store.Schema.Height);
                    int    newWidth  = (int)(store.Schema.Width * scale);
                    int    newHeight = (int)(store.Schema.Height * scale);

                    textBoxWidth.Text  = newWidth.ToString();
                    textBoxHeight.Text = newHeight.ToString();
                    schemaImage.Refresh();
                }
                catch (SecurityException ex)
                {
                    MessageBox.Show($"Security error.\n\nError message: {ex.Message}\n\n" +
                                    $"Details:\n\n{ex.StackTrace}");
                }
            }
        }
Example #2
0
 private void InitializeControls()
 {
     realImage = new RealImage("Изображение", size, store.GetCopyOfRealImage(), CloseSchema);
     schema    = new Schema("Схема", size, store.GetCopyOfSchema(), CloseRealImage, Redraw, realImage.SynchronizePosition);
 }