Ejemplo n.º 1
0
        /// <summary>コンストラクタ</summary>
        /// <param name="text">タイトル</param>
        /// <param name="image">画像</param>
        /// <param name="writer"><see cref="LogWriter"/></param>
        public PictureForm(string text, Image image, LogWriter writer)
        {
            InitializeComponent();

            logWriter = writer;

            saveItem.Click += new EventHandler((object sender, EventArgs e) =>
            {
                dialog.FileName = text;
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    string path         = dialog.FileName;
                    SaveImage saveImage = new SaveImage(logWriter);
                    saveImage.Save(pictureBox.Image, path);
                }
            });
            sizeItem.Click += new EventHandler((object sender, EventArgs e) =>
            {
                ClientSize = pictureBox.Image.Size;
            });

            pictureBox.Image = image;
            ClientSize       = image.Size;

            Text = text;

            Config.StyleSetup(this);
        }
Ejemplo n.º 2
0
        /// <summary>画像を保存します</summary>
        /// <param name="image">画像</param>
        /// <param name="depth">深さ</param>
        private void SaveImage(Bitmap image, LabelStructure depth)
        {
            DialogResult com = MessageBox.Show("3次元画像を保存しますか?", "確認", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (com == DialogResult.Yes)
            {
                SaveFileDialog saveDialog = new SaveFileDialog();
                saveDialog.Filter     = "3次元画像|*.rgbad;*.txt";
                saveDialog.Title      = "保存";
                saveDialog.DefaultExt = "rgbad";
                if (saveDialog.ShowDialog() == DialogResult.OK)
                {
                    string    path      = Path.GetDirectoryName(saveDialog.FileName) + "\\" + Path.GetFileNameWithoutExtension(saveDialog.FileName);
                    SaveImage saveImage = new SaveImage(logWriter);
                    saveImage.Save(image, depth, path + ".txt");
                    saveImage.SaveBinary(image, depth, path + ".rgbad");
                    depth.SetMinMax();
                    saveImage.SaveChip(image, depth, path);
                }
            }
        }