Ejemplo n.º 1
0
        public WinClassic StartInfobox95(string title, string text, InfoboxType type, InfoboxButtons btns)
        {
            pfc.AddFontFile(SaveSystem.GameDirectory + "\\Data\\LeviWindows.ttf");
            Infobox95 app = new Infobox95(type, btns);

            app.infoText.Text = text;
            app.infoText.Font = new Font(pfc.Families[0], 16F, FontStyle.Regular, GraphicsUnit.Point, ((0)));

            return(Init(app, title, null, false, false, resize: false));
        }
Ejemplo n.º 2
0
        public Infobox95(InfoboxType type, InfoboxButtons btns)
        {
            InitializeComponent();
            this.BackColor = SaveSystem.currentTheme.threeDObjectsColor;
            this.programContent.BackColor = SaveSystem.currentTheme.threeDObjectsColor;

            switch (type)
            {
            case InfoboxType.Info:
                pictureBox1.Image = Properties.Resources.Win95Info;
                SoundPlayer spa = new SoundPlayer(SaveSystem.currentTheme.asteriskSound);
                spa.Play();
                spa.Stream.Position = 0;

                break;

            case InfoboxType.Question:
                pictureBox1.Image = Properties.Resources.Win95Question;
                SoundPlayer spq = new SoundPlayer(SaveSystem.currentTheme.questionSound);
                spq.Play();
                spq.Stream.Position = 0;
                break;

            case InfoboxType.Warning:
                pictureBox1.Image = Properties.Resources.Win95Warning;
                SoundPlayer spw = new SoundPlayer(SaveSystem.currentTheme.exclamationSound);
                spw.Play();
                spw.Stream.Position = 0;
                break;

            case InfoboxType.Error:
                pictureBox1.Image = Properties.Resources.Win95Error;
                SoundPlayer spe = new SoundPlayer(SaveSystem.currentTheme.critStopSound);
                spe.Play();
                spe.Stream.Position = 0;
                break;
            }

            btnStatus = (int)btns;
            switch (btns)
            {
            case InfoboxButtons.OK:
                button1.Text = "OK";
                button2.Hide();
                button3.Hide();
                break;
            }
        }
Ejemplo n.º 3
0
        public Infobox95(InfoboxType type, InfoboxButtons btns)
        {
            InitializeComponent();
            button1.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
            button2.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);
            button3.Paint += (sender, args) => Paintbrush.PaintClassicBorders(sender, args, 2);

            switch (type)
            {
            case InfoboxType.Info:
                pictureBox1.Image = Properties.Resources.Win95Info;
                SoundPlayer spa = new SoundPlayer(SaveSystem.currentTheme.asteriskSound);
                spa.Play();
                break;

            case InfoboxType.Question:
                pictureBox1.Image = Properties.Resources.Win95Question;
                SoundPlayer spq = new SoundPlayer(SaveSystem.currentTheme.questionSound);
                spq.Play();
                break;

            case InfoboxType.Warning:
                pictureBox1.Image = Properties.Resources.Win95Warning;
                SoundPlayer spw = new SoundPlayer(SaveSystem.currentTheme.exclamationSound);
                spw.Play();
                break;

            case InfoboxType.Error:
                pictureBox1.Image = Properties.Resources.Win95Error;
                SoundPlayer spe = new SoundPlayer(SaveSystem.currentTheme.critStopSound);
                spe.Play();
                break;
            }

            btnStatus = (int)btns;
            switch (btns)
            {
            case InfoboxButtons.OK:
                button1.Text = "OK";
                button2.Hide();
                button3.Hide();
                break;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// cTor.
        /// </summary>
        /// <param name="title">a caption on the titlebar</param>
        /// <param name="head">info to be displayed with a proportional font -
        /// keep this fairly brief</param>
        /// <param name="copyable">info to be displayed in a fixed-width font as
        /// readily copyable text - can be <c>null</c></param>
        /// <param name="ibt">an <c><see cref="InfoboxType"/></c> to deter the
        /// backcolor of <c><see cref="la_head"/></c></param>
        /// <param name="buttons"><c><see cref="InfoboxButtons"/></c> to show to
        /// the user</param>
        internal Infobox(
            string title,
            string head,
            string copyable        = null,
            InfoboxType ibt        = InfoboxType.Info,
            InfoboxButtons buttons = InfoboxButtons.Okay)
        {
            // TODO: Store static location and size of the Infobox (if shown non-modally).

            InitializeComponent();

            if (copyable != null)
            {
                InitializePanel();
                pa_Copyable.BringToFront();
                YataDialog.SetTabs(rt_Copyable);

                if (Settings._fontf != null)
                {
                    rt_Copyable.Font.Dispose();
                    rt_Copyable.Font = Settings._fontf;
                }
            }
            else
            {
                la_head.Dock = DockStyle.Fill;
            }

            if (Settings._fonti != null)
            {
                Font.Dispose();
                Font = Settings._fonti;
            }


            Text = title;

            switch (ibt)
            {
            case InfoboxType.Info:  la_head.BackColor = Color.Lavender;   break;

            case InfoboxType.Warn:  la_head.BackColor = Color.Moccasin;   break;

            case InfoboxType.Error: la_head.BackColor = Color.SandyBrown; break;
            }

            switch (buttons)
            {
            case InfoboxButtons.Okay:
                bu_Cancel.Text = "ok";
                break;

            case InfoboxButtons.CancelYes:
                bu_Okay.Text    = "yes";
                bu_Okay.Visible = true;
                break;

            case InfoboxButtons.AbortLoadNext:
                bu_Cancel.Text = "abort";
                bu_Okay.Text   = "load";
                bu_Retry.Text  = "next";

                bu_Okay.Visible      =
                    bu_Retry.Visible = true;
                break;

            case InfoboxButtons.Abort:
                bu_Cancel.Text = "abort";
                break;
            }


            SuspendLayout();

            int client_w = 0;
            int client_h = 0;

            int widthScroller = SystemInformation.VerticalScrollBarWidth;

            string[] lines;

            if (copyable != null)
            {
                lines = copyable.Split(gs.CRandorLF, StringSplitOptions.None);

                int test;
                foreach (var line in lines)
                {
                    test = TextRenderer.MeasureText(line, rt_Copyable.Font).Width;
                    if (test > client_w)
                    {
                        client_w = test;
                    }
                }
                client_w += pa_Copyable.Padding.Horizontal + widthScroller;

                client_h           = rt_Copyable.Font.Height + 1;
                pa_Copyable.Height = client_h * (lines.Length + 1)
                                     + pa_Copyable.Padding.Vertical;

                rt_Copyable.Text = copyable + Environment.NewLine;
            }

            if (client_w < w_Min)
            {
                client_w = w_Min;
            }
            else if (client_w > w_Max)
            {
                client_w = w_Max;
            }


            int lineshead;

            if (TextRenderer.MeasureText(head, la_head.Font).Width + la_head.Padding.Horizontal > client_w)
            {
                lines = SplitString(head, client_w - la_head.Padding.Horizontal, la_head.Font);

                lineshead = lines.Length;

                head = String.Empty;
                for (int i = 0; i != lineshead; ++i)
                {
                    if (i != 0)
                    {
                        head += Environment.NewLine;
                    }
                    head += lines[i];
                }
            }
            else
            {
                lineshead = 1;
            }

            la_head.Text = head;

            client_h       = la_head.Font.Height + 1;
            la_head.Height = client_h * lineshead + la_head.Padding.Vertical + 1;


            client_h = la_head.Height
                       + (pa_Copyable != null ? pa_Copyable.Height : 0)
                       + pa_buttons.Height;

            if (client_h > h_Max)
            {
                client_h = h_Max;
            }

            ClientSize  = new Size(client_w + 2, client_h + 1);             // pad.
            MinimumSize = new Size(Width, Height);

            ResumeLayout();

            bu_Cancel.Select();
        }