Exemplo n.º 1
0
        public void Open()
        {
            EnableComponents(true);

            OpenedBmp  = false;
            OpenedSHBD = true;

            Selected = SHBD.Load(GetFullPath());
            Selected.SetBitmap();

            PictureBox.Image = Selected.Bitmap.Clone(new Rectangle(0, 0, Selected.Bitmap.Width, Selected.Bitmap.Height), PixelFormat.DontCare);
            ImageWidth       = PictureBox.Image.Width;
            ImageHeight      = PictureBox.Image.Height;

            Refresh();
        }
Exemplo n.º 2
0
        // ====================================Menu Items====================================
        private void OpenMenu_Click(object sender, EventArgs e)
        {
            var openFileDialog = new OpenFileDialog
            {
                Filter = @"SHBD File (*.shbd)|*.shbd|Bitmap File (*.bmp)|*.bmp",
            };

            if (openFileDialog.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Path   = System.IO.Path.GetDirectoryName(openFileDialog.FileName);
            MapInx = System.IO.Path.GetFileNameWithoutExtension(openFileDialog.FileName);
            EnableComponents(true);

            switch (openFileDialog.FilterIndex)
            {
            case 1:
                OpenedBmp  = false;
                OpenedSHBD = true;
                Selected   = SHBD.Load(GetFullPath());
                Selected.SetBitmap();
                break;

            case 2:
                OpenedBmp  = true;
                OpenedSHBD = false;
                var bitmap = ReadBitmapFromBytes(openFileDialog.FileName);
                Selected = SHBD.Load(bitmap.Width / 8, bitmap.Height, bitmap);
                break;
            }

            PictureBox.Image = Selected.Bitmap.Clone(new Rectangle(0, 0, Selected.Bitmap.Width, Selected.Bitmap.Height), PixelFormat.DontCare);
            ImageWidth       = PictureBox.Image.Width;
            ImageHeight      = PictureBox.Image.Height;

            Refresh();
        }