[1195] | 1 | using System;
|
---|
| 2 | using System.Collections.Generic;
|
---|
| 3 | using System.Windows.Forms;
|
---|
| 4 |
|
---|
| 5 | namespace HeuristicLab.Visualization.Options {
|
---|
| 6 | public partial class OptionsDialog : Form {
|
---|
| 7 | private LineChart lc;
|
---|
| 8 |
|
---|
| 9 | public OptionsDialog(LineChart lc) {
|
---|
| 10 | InitializeComponent();
|
---|
| 11 | this.lc = lc;
|
---|
| 12 | }
|
---|
| 13 |
|
---|
| 14 | private void button1_Click(object sender, EventArgs e) {
|
---|
[1233] | 15 | ColorDialog dlg = new ColorDialog();
|
---|
[1195] | 16 | dlg.ShowDialog();
|
---|
| 17 | this.ColorPreviewTB.BackColor = dlg.Color;
|
---|
| 18 | }
|
---|
| 19 |
|
---|
| 20 | public IList<int> GetThicknesses() {
|
---|
| 21 | return new List<int>() {0, 1, 2, 3, 4, 5, 6, 7, 8};
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | public IList<DrawingStyle> GetStyles() {
|
---|
| 25 | return new List<DrawingStyle>() {DrawingStyle.Solid, DrawingStyle.Dashed};
|
---|
| 26 | }
|
---|
| 27 |
|
---|
| 28 | private void OptionsDialog_Load(object sender, EventArgs e) {
|
---|
| 29 | this.LineSelectCB.DataSource = lc.GetRows();
|
---|
| 30 | this.LineSelectCB.DisplayMember = "Label";
|
---|
| 31 |
|
---|
| 32 | LineThicknessCB.DataSource = GetThicknesses();
|
---|
| 33 | LinestyleCB.DataSource = GetStyles();
|
---|
| 34 | LineSelectCB.SelectedIndex = 0;
|
---|
| 35 | LineSelectCB_SelectedIndexChanged(this, null);
|
---|
| 36 | }
|
---|
| 37 |
|
---|
| 38 | private void LineSelectCB_SelectedIndexChanged(object sender, EventArgs e) {
|
---|
[1233] | 39 | IDataRow datarow = (IDataRow)this.LineSelectCB.SelectedValue;
|
---|
| 40 |
|
---|
| 41 | int index = this.LineThicknessCB.FindStringExact(datarow.Thickness.ToString());
|
---|
[1195] | 42 | this.LineThicknessCB.SelectedIndex = index;
|
---|
[1233] | 43 | index = this.LinestyleCB.FindStringExact(datarow.Style.ToString());
|
---|
[1195] | 44 | LinestyleCB.SelectedIndex = index;
|
---|
[1233] | 45 | this.ColorPreviewTB.BackColor = datarow.Color;
|
---|
[1195] | 46 | }
|
---|
| 47 |
|
---|
| 48 | private void OptionsDialogCancelButton_Click(object sender, EventArgs e) {
|
---|
| 49 | this.Close();
|
---|
| 50 | }
|
---|
| 51 |
|
---|
| 52 | private void OptionsDialogOkButton_Click(object sender, EventArgs e) {
|
---|
[1233] | 53 | IDataRow datarow = (IDataRow)this.LineSelectCB.SelectedValue;
|
---|
| 54 |
|
---|
| 55 | datarow.Thickness = (int)this.LineThicknessCB.SelectedItem;
|
---|
| 56 | datarow.Color = this.ColorPreviewTB.BackColor;
|
---|
| 57 | datarow.Style = (DrawingStyle)this.LineThicknessCB.SelectedItem;
|
---|
| 58 |
|
---|
| 59 | this.lc.ApplyChangesToRow(datarow);
|
---|
[1195] | 60 | this.Close();
|
---|
| 61 | }
|
---|
| 62 | }
|
---|
| 63 | } |
---|