示例#1
0
 private void LoadImage(string imageFilename)
 {
     optionalStartFileName = imageFilename;
     processor = new Processor(
             new Bitmap(imageFilename), panel);
     SetPanelSize(processor.OriginalImage.Width,
         processor.OriginalImage.Height);
     InitOptions(new OriginalForm(processor).Options);
 }
示例#2
0
        private void Initialize(string filename)
        {
            if (filename == null)
            {
                System.Resources.ResourceManager resource =
                    new System.Resources.ResourceManager("SBIP.Resource",
                    System.Reflection.Assembly.GetExecutingAssembly());
                //processor = new Processor(
                //    new Bitmap((Bitmap)resource.GetObject("dom_erfurt")), panel);
                processor = new Processor(
                    new Bitmap(1024, 600, PixelFormat.Format24bppRgb), panel);

                options.Height = 100; // Hack, for SetPanelSize(..) method
                SetPanelSize(processor.OriginalImage.Width,
                    processor.OriginalImage.Height);

                InitOptions(new OriginalForm(processor).Options);
            }
            else
            {
                Text = filename;
                optionalStartFileName = filename;
                FileInfo info = new FileInfo(filename);
                string ext = info.Extension.ToLower();

                switch (ext)
                {
                    case ".wmf":
                    case ".tiff":
                    case ".tif":
                    case ".gif":
                    case ".emf":
                    case ".png":
                    case ".bmp":
                    case ".jpeg":
                    case ".jpg":
                        LoadImage(filename);
                        break;
                    default:
                        if (MessageBox.Show(
                            "This file type is not supported by SBIP.\n" +
                            @"Open SBIP anyway?",
                            @"Wrong file type",
                            MessageBoxButtons.YesNo) == DialogResult.Yes)
                        {
                            Initialize(null);
                        }
                        else
                        {
                            Dispose();
                            return;
                        }
                        break;
                }
            }
        }