private void DoubleClicked(object sender, EventArgs e)
        {
            if (!canChange())
            {
                return;
            }

            Hide();

            if (box == null)
            {
                LoadTextbox();
            }
            //if (box != null) box.Dispose();

            Parent.Controls.Add(box = new TextBox
            {
                Left     = Left,
                Font     = Font,
                Text     = Text,
                Location = Location,
                AutoSize = false,
                Size     = Size
            });

            Theme.ChangeControl(box);

            //LoadTextbox();
        }
Example #2
0
            public AddPage(TabControl control) : base(control)
            {
                Text = "+";
                Font = control.Font;

                Button addBtn = new Button
                {
                    Size      = new Size(100, 36),
                    Text      = "Create Tab",
                    FlatStyle = FlatStyle.Flat,
                    Anchor    = AnchorStyles.None
                };

                addBtn.Location = new Point(Width / 2 - addBtn.Width / 2,
                                            Height / 2 - addBtn.Height / 2);

                addBtn.Click += (s, e) =>
                {
                    int currentID = control.SelectedIndex;
                    control.TabPages.Insert(currentID, new NotePage(control));
                    control.SelectedIndex = currentID;
                };

                Controls.Add(addBtn);

                Theme.ChangeControl(this);
            }
Example #3
0
        void UpdateTimer()
        {
            if (TypeCombo.SelectedIndex == 0)
            {
                if (HourLbl.Text != "23" || MinuteLbl.Text != "59" || SecondLbl.Text != "59")
                {
                    SecondLbl.Text = AddZero(int.Parse(SecondLbl.Text) + 1);

                    if (SecondLbl.Text == "60")
                    {
                        SecondLbl.Text = "00";
                        MinuteLbl.Text = AddZero(int.Parse(MinuteLbl.Text) + 1);

                        if (MinuteLbl.Text == "60")
                        {
                            MinuteLbl.Text = "00";
                            HourLbl.Text   = AddZero(int.Parse(HourLbl.Text) + 1);
                        }
                    }
                }
            }
            else
            {
                if (HourLbl.Text != "00" || MinuteLbl.Text != "00" || SecondLbl.Text != "00")
                {
                    SecondLbl.Text = AddZero(int.Parse(SecondLbl.Text) - 1);

                    if (SecondLbl.Text == "0-1")
                    {
                        SecondLbl.Text = "59";
                        MinuteLbl.Text = AddZero(int.Parse(MinuteLbl.Text) - 1);

                        if (MinuteLbl.Text == "0-1")
                        {
                            MinuteLbl.Text = "59";
                            HourLbl.Text   = AddZero(int.Parse(HourLbl.Text) - 1);
                        }
                    }
                }
                else
                {
                    if (!ended)
                    {
                        ended = true;

                        Show();
                        BringToFront();

                        new SoundPlayer(Properties.Resources.Beeping).Play();
                    }
                    flash ^= true;

                    BackPanel.BackColourName = flash ? "StopwatchFlash" : "FormColour";

                    Theme.ChangeControl(BackPanel);
                }
            }
        }
Example #4
0
        private void Guess(string guess)
        {
            if (TypedPanel.Visible)
            {
                InputTxt.Enabled = false;
                CheckBtn.Enabled = false;
            }
            else
            {
                foreach (Control c in MultiplePanel.Controls)
                {
                    c.TabStop = false;
                }

                foreach (Control c in MultiplePanel.Controls)
                {
                    c.Enabled = false;
                }
            }

            bool correct = questions[curID].Attempt(guess);

            if (correct)
            {
                CorrectLbl.BackColourName = "CorrectBackcolour";
                CorrectLbl.ForeColourName = "CorrectForecolour";
                CorrectLbl.Text           = "Correct!";
            }
            else
            {
                CorrectLbl.BackColourName = "IncorrectBackcolour";
                CorrectLbl.ForeColourName = "IncorrectForecolour";
                CorrectLbl.Text           = "Incorrect...";
            }

            Theme.ChangeControl(CorrectLbl);

            AnswersLbl.Text = CurrentQuestion.AnswerList();

            CorrectPanel.Height = AnswersLbl.Top + AnswersLbl.PreferredHeight + NextBtn.Height + 6;

            NextBtn.Text = (curID == questions.Length - 1) ? "Show Results" : "Next Question";

            CorrectPanel.BringToFront();
            CorrectPanel.Visible = true;

            Height = PreferredSize.Height;

            AcceptButton = NextBtn;

            NextBtn.Focus();
        }
Example #5
0
            public NotePage(TabControl control, string text = "") : base(control)
            {
                Text = "Page " + (control.TabCount);
                Font = Font;

                notes.Location = new Point(6, 6);
                notes.Dock     = DockStyle.Fill;
                //notes.Size = new Size(Width - 12, Height - 12);
                notes.Font = control.Font;
                notes.Text = text;
                Controls.Add(notes);

                Theme.ChangeControl(this);
            }
Example #6
0
        public QPanel(Panel _owner, Question _question, int _id)
        {
            InitializeComponent();

            Anchor = AnchorStyles.Left | AnchorStyles.Right | AnchorStyles.Top;

            question = _question;
            owner    = _owner;
            editor   = owner.FindForm() as TestEditor;

            ID = _id;

            RefreshControls();

            Theme.ChangeControl(this);
        }
Example #7
0
        public ItemPanel(Panel _owner, string name, string _dir)
        {
            Left      = 10;
            owner     = _owner;
            PanelName = name;

            Dir = _dir;

            InitializeComponent();

            NameLink.Text = name;
            IconBox.Image = GetIcon();
            Theme.ChangeControl(this);
            Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;

            CheckEditing();
        }
Example #8
0
        private void OptionsBtn_Click(object sender, EventArgs e)
        {
            settingsShown ^= true;

            OptionsBtn.Text = "Options " + (settingsShown ? "<<<" : ">>>");

            SettingsGroup.Visible = settingsShown;

            if (!settingsCreated)
            {
                settingsCreated = true;
                assess.CreateSettingsPanel(SettingsPanel);
                SettingsGroup.Width = SettingsGroup.PreferredSize.Width;
                Theme.ChangeControl(SettingsPanel);
            }

            Width = PreferredSize.Width + 9;
        }
Example #9
0
        private void SetRunning(bool running)
        {
            if (running)
            {
                //tSec = DateTime.Now.Second;
                lastTime = DateTime.Now;
                TimerMain.Start();
                StartBtn.Text = "Stop";
            }
            else
            {
                flash = false;
                ended = false;

                BackPanel.BackColourName = "FormColour";
                Theme.ChangeControl(BackPanel);

                TimerMain.Stop();
                StartBtn.Text = "Start";
            }

            CheckReset();
        }
Example #10
0
        private void MoveToQuestion(int id)
        {
            curID = id;

            NumLbl.Text        = $"Question {curID + 1} of {questions.Length}";
            QuestionLbl.Text   = CurrentQuestion.question.question;
            TestProgress.Value = id;

            if (canSkip)
            {
                CheckBtn.Enabled = true;
            }

            if (CurrentQuestion.question.multipleChoice == -1)
            {
                AcceptButton = CheckBtn;

                InputTxt.Enabled = true;
                //CheckBtn.Enabled = false;

                InputTxt.Text = "";

                TypedPanel.Visible    = true;
                MultiplePanel.Visible = false;

                ActiveControl = InputTxt;
            }
            else
            {
                AcceptButton = null;

                MultiplePanel.Controls.Clear();

                for (int i = CurrentQuestion.question.answers.Length - 1; i >= 0; i--)
                //for (int i = 0; i < CurrentQuestion.question.answers.Length; i++)
                {
                    string a = CurrentQuestion.question.answers[i];

                    var btn = new ColourSpecificButton()
                    {
                        Text     = a,
                        Font     = Font,
                        AutoSize = true,
                        //Size = new Size(0, 40),
                        //Dock = DockStyle.Top,
                        FlatStyle      = FlatStyle.Flat,
                        TabIndex       = i,
                        TabStop        = true,
                        BackColourName = "ChoiceColourBack",
                        ForeColourName = "ChoiceColourFore"
                    };

                    btn.Size = new Size(0, btn.Height + 6);
                    btn.Dock = DockStyle.Top;

                    btn.FlatAppearance.BorderSize = 0;

                    btn.SendToBack();

                    Theme.ChangeControl(btn);

                    btn.Click += Btn_Click;

                    MultiplePanel.Controls.Add(btn);
                }

                MultiplePanel.Height = MultiplePanel.PreferredSize.Height;

                MultiplePanel.Visible = true;
                TypedPanel.Visible    = false;
            }

            CorrectPanel.Visible = false;

            Height = PreferredSize.Height;
        }