public TextExerciseControl(TextTemplate template) : base(template) { _textLabel = new FixedLabel { AutoSize = false, TextAlign = ContentAlignment.MiddleCenter, Text = template.FullTemplate }; Controls.Add(_textLabel); }
public LatexExerciseControl(LatexTemplate template) : base(template) { _textLabel = new FixedLabel { AutoSize = false, TextAlign = ContentAlignment.MiddleCenter, ImageAlign = ContentAlignment.MiddleCenter }; Controls.Add(_textLabel); }
public GraphicExerciseControl(GraphicTemplate template) : base(template) { _textLabel = new FixedLabel { AutoSize = false, TextAlign = ContentAlignment.MiddleCenter, Text = template.FullTemplate }; _chart = new Chart { Left = 0 }; ChartArea area = new ChartArea(nameof(area)) { AxisX = { Interval = template.Interval.Width }, AxisY = { Interval = template.Interval.Height } }; _chart.ChartAreas.Add(area); Series series = new Series(nameof(series)) { ChartArea = area.Name, ChartType = SeriesChartType.Spline, Color = Color.Red }; foreach (DataPoint point in Template.Points.Select(point => new DataPoint(point.X, point.Y))) { series.Points.Add(point); } _chart.Series.Add(series); Controls.Add(_textLabel); Controls.Add(_chart); }
private void InitializeComponent() { SuspendLayout(); ClientSize = new Size(GUILayout.MainFormSizeWidth, GUILayout.MainFormSizeHeight); _githubButton = new WebBrowserButton { Size = new Size(25, 25), Url = ProgramLocalization.ProjectGitHubPage, BackgroundImageLayout = ImageLayout.Stretch, BackgroundImage = Images.Flat.GitHub, }; _githubButton.SetPosition(this, PointOffset.UpRight, 0); _localizationComboBox = new LocalizationComboBox(); _localizationComboBox.SetPosition(_githubButton, PointOffset.Left, 0); _subjectComboBox = new FixedComboBox { DropDownStyle = ComboBoxStyle.DropDownList, }; _subjectComboBox.SetSize(180, ControlSizeType.Width); foreach (SubjectType subject in EnumUtils.GetValuesWithoutDefault <SubjectType>()) { _subjectComboBox.Items.Add(Globals.Localization.Subjects[subject]); } _subjectComboBox.SelectedIndex = 0; _startTestButton = new FixedButton(); _startTestButton.SetSize(125, ControlSizeType.Width); _startTestButton.SetPosition(_subjectComboBox, PointOffset.Right, 0); _startTestButton.Click += StartTestButtonOnClick; _testTab = new TestTab { Appearance = TabAppearance.FlatButtons, BackColor = Color.Black }; _testTab.SetPosition(_subjectComboBox, PointOffset.Down, 0); _testTab.SetSize(ClientSize.Width, ClientSize.Height - _testTab.Location.Y - 20); _testTab.Completed += StopTest; _timerLabel = new FixedLabel { AutoSize = false, ForeColor = Color.Red }; _timerLabel.SetSize(20, ControlSizeType.Height); _timerLabel.SetPosition(0, _testTab.Location.Y + _testTab.Size.Height); _stopTestButton = new FixedButton { Visible = false, Enabled = false }; _stopTestButton.SetSize(120, 20); _stopTestButton.SetPosition(ClientSize.Width - _stopTestButton.Size.Width, _testTab.Location.Y + _testTab.Size.Height); _stopTestButton.Click += StopTestButtonOnClick; _lastGradeLabel = new FixedLabel { AutoSize = false, TextAlign = ContentAlignment.MiddleCenter, ForeColor = Color.Red, Text = @"-", Visible = false }; _lastGradeLabel.SetSize(30, _stopTestButton.Size.Height); _lastGradeLabel.SetPosition(_stopTestButton, PointOffset.Left, 0); _lastGradeTextLabel = new FixedLabel { AutoSize = false, TextAlign = ContentAlignment.MiddleRight, ForeColor = Color.Red, Visible = false }; _lastGradeTextLabel.SetSize(120, _lastGradeLabel.Size.Height); _lastGradeTextLabel.SetPosition(_lastGradeLabel, PointOffset.Left, 0); FormBorderStyle = FormBorderStyle.FixedSingle; MaximizeBox = false; Icon = Resources.Resources.icon; Controls.Add(_githubButton); Controls.Add(_localizationComboBox); Controls.Add(_subjectComboBox); Controls.Add(_startTestButton); Controls.Add(_testTab); Controls.Add(_timerLabel); Controls.Add(_stopTestButton); Controls.Add(_lastGradeLabel); Controls.Add(_lastGradeTextLabel); ResumeLayout(); }