// -------------------------------------------------------------------
        // OpenSpriteDialog
        // -------------------------------------------------------------------

        public void OpenSpriteDialog()
        {
            DialogPreviewGraphicSelectFrame dialog = new DialogPreviewGraphicSelectFrame(panel.Graphic.CreateCopy(), OptionsKind.CharacterSelection, GraphicTileset);

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                panel.Graphic = dialog.GetGraphic();
                if (panel.Graphic.IsNone())
                {
                    comboBox1.SelectedIndex = (int)DrawType.None;
                    ResetGraphics();
                }
                else if (panel.Graphic.IsTileset())
                {
                    panel.Image = GraphicTileset.LoadImage();
                    panel.Refresh();
                }
                else
                {
                    panel.Image = panel.Graphic.LoadImage();
                    panel.Refresh();
                }
                var eventSubscribers = ClosingDialogEvent;
                if (eventSubscribers != null)
                {
                    eventSubscribers(panel.Graphic);
                }
            }
        }
        // -------------------------------------------------------------------
        // LoadBar
        // -------------------------------------------------------------------

        public void LoadBar(SystemGraphic graphic)
        {
            PictureBoxIcon.Image = graphic.LoadImage();

            int width, height;

            if (PictureBoxIcon.Image.Size.Width > PanelBar.Size.Width)
            {
                width = PanelBar.Size.Width;
            }
            else
            {
                width = PictureBoxIcon.Image.Size.Width;
            }

            if (PictureBoxIcon.Image.Size.Height > PanelBar.Size.Height)
            {
                height = PanelBar.Size.Height;
            }
            else
            {
                height = PictureBoxIcon.Image.Size.Height;
            }

            PictureBoxIcon.Size     = new Size(width, height);
            PictureBoxIcon.Location = new Point(0, 0);
        }
        // -------------------------------------------------------------------
        // LoadTexture
        // -------------------------------------------------------------------

        public void LoadTexture(SystemGraphic graphic, float zoom = -1)
        {
            Image = graphic.LoadImage();
            if (zoom == -1)
            {
                zoom = WANOK.RELATION_SIZE;
            }
            Size     = new Size((int)(Image.Width * zoom), (int)(Image.Height * zoom));
            Location = new Point(0, 0);
        }
        // -------------------------------------------------------------------
        // InitializeListParameters
        // -------------------------------------------------------------------

        public void InitializeListParameters(SystemGraphic graphic, SystemGraphic graphicTileset = null)
        {
            GraphicTileset = graphicTileset;
            panel.Graphic  = graphic;
            if (panel.Graphic.IsNone())
            {
                ResetGraphics();
            }
            else if (panel.Graphic.IsTileset())
            {
                panel.Image = GraphicTileset.LoadImage();
                panel.Refresh();
            }
            else
            {
                panel.Image = panel.Graphic.LoadImage();
                panel.Refresh();
            }
        }
Example #5
0
        // -------------------------------------------------------------------
        // LoadIcon
        // -------------------------------------------------------------------

        public void LoadIcon(SystemGraphic graphic)
        {
            PictureBoxIcon.Image    = graphic.LoadImage();
            PictureBoxIcon.Size     = new Size((WANOK.BASIC_SQUARE_SIZE / 2), (WANOK.BASIC_SQUARE_SIZE / 2));
            PictureBoxIcon.Location = new Point(0, 0);
        }
Example #6
0
        // -------------------------------------------------------------------
        // LoadPicture
        // -------------------------------------------------------------------

        public void LoadPicture(PictureBox pb, SystemGraphic graphic)
        {
            pb.Image = graphic.LoadImage();
            pb.Size  = new Size((int)(pb.Image.Width * WANOK.RELATION_SIZE), (int)(pb.Image.Height * WANOK.RELATION_SIZE));
        }