////////////////////////////////////////Form edit scale/////////////////////////////////////////////////////// /* * Form editform = new Form(); * * System.Windows.Forms.Label label1 = new System.Windows.Forms.Label(); * System.Windows.Forms.Label label2 = new System.Windows.Forms.Label(); * System.Windows.Forms.Label label3 = new System.Windows.Forms.Label(); * TextBox txtcharttitle = new TextBox(); * TextBox txtxaxistitle = new TextBox(); * TextBox txtyaxistitle = new TextBox(); * DataGridView EditScaleGridView = new DataGridView(); * System.Windows.Forms.Label label4 = new System.Windows.Forms.Label(); * System.Windows.Forms.Label label5 = new System.Windows.Forms.Label(); * Button btncolor = new Button(); * System.Windows.Forms.Label label6 = new System.Windows.Forms.Label(); * ComboBox comboedittype = new ComboBox(); * System.Windows.Forms.Label label7 = new System.Windows.Forms.Label(); * ComboBox comboeditbold = new ComboBox(); * Button btnOK = new Button(); * Button btnCancel = new Button(); * ColorDialog colorDialog1 = new ColorDialog(); * public void initeditscale() * { * // * // label1 * // * label1.AutoSize = true; * label1.Location = new System.Drawing.Point(12, 23); * label1.Name = "label1"; * label1.Size = new System.Drawing.Size(55, 13); * label1.TabIndex = 0; * label1.Text = "Tiêu đề Chart"; * // * // label2 * // * label2.AutoSize = true; * label2.Location = new System.Drawing.Point(11, 49); * label2.Name = "label2"; * label2.Size = new System.Drawing.Size(56, 13); * label2.TabIndex = 1; * label2.Text = "XAxis Title"; * // * // label3 * // * label3.AutoSize = true; * label3.Location = new System.Drawing.Point(12, 75); * label3.Name = "label3"; * label3.Size = new System.Drawing.Size(56, 13); * label3.TabIndex = 2; * label3.Text = "YAxis Title"; * // * // textBox1 * // * txtcharttitle.Location = new System.Drawing.Point(73, 20); * txtcharttitle.Name = "txtcharttitle"; * txtcharttitle.Size = new System.Drawing.Size(140, 20); * txtcharttitle.TabIndex = 3; * txtcharttitle.Text = myPane.Title.Text; * txtcharttitle.TextChanged += new EventHandler(txtcharttitle_TextChanged); * // * // textBox2 * // * txtxaxistitle.Location = new System.Drawing.Point(73, 46); * txtxaxistitle.Name = "txtxaxistitle"; * txtxaxistitle.Size = new System.Drawing.Size(140, 20); * txtxaxistitle.TabIndex = 4; * txtxaxistitle.Text = myPane.XAxis.Title.Text; * txtxaxistitle.TextChanged += new EventHandler(txtxaxistitle_TextChanged); * // * // textBox3 * // * txtyaxistitle.Location = new System.Drawing.Point(74, 72); * txtyaxistitle.Name = "txtyaxistitle"; * txtyaxistitle.Size = new System.Drawing.Size(139, 20); * txtyaxistitle.TabIndex = 5; * txtyaxistitle.Text = myPane.YAxis.Title.Text; * txtyaxistitle.TextChanged += new EventHandler(txtyaxistitle_TextChanged); * // * // EditScaleGridView * // * EditScaleGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; * EditScaleGridView.Location = new System.Drawing.Point(12, 146); * EditScaleGridView.Name = "Tùy chỉnh"; * EditScaleGridView.Size = new System.Drawing.Size(201, 214); * EditScaleGridView.TabIndex = 6; * EditScaleGridView.CellContentClick += new DataGridViewCellEventHandler(EditScaleGridView_CellContentClick); * // * // label4 * // * label4.AutoSize = true; * label4.Location = new System.Drawing.Point(12, 121); * label4.Name = "label4"; * label4.Size = new System.Drawing.Size(88, 13); * label4.TabIndex = 7; * label4.Text = "Các Sensors hiển thị"; * // * // label5 * // * label5.AutoSize = true; * label5.Location = new System.Drawing.Point(267, 151); * label5.Name = "label5"; * label5.Size = new System.Drawing.Size(31, 13); * label5.TabIndex = 8; * label5.Text = "Màu vẽ"; * // * // btncolor * // * btncolor.Location = new System.Drawing.Point(304, 146); * btncolor.Name = "btncolor"; * btncolor.Size = new System.Drawing.Size(68, 23); * btncolor.BackColor = Color.Gray; * btncolor.TabIndex = 9; * btncolor.UseVisualStyleBackColor = true; * btncolor.Click += new EventHandler(btncolor_Click); * // * // label6 * // * label6.AutoSize = true; * label6.Location = new System.Drawing.Point(229, 190); * label6.Name = "label6"; * label6.Size = new System.Drawing.Size(69, 13); * label6.TabIndex = 10; * label6.Text = "Kiểu dữ liệu"; * // * // comboedittype * // * comboedittype.FormattingEnabled = true; * comboedittype.Items.AddRange(new object[] { * "Raw", * "Refine"}); * comboedittype.Location = new System.Drawing.Point(304, 187); * comboedittype.Name = "comboedittype"; * comboedittype.Size = new System.Drawing.Size(68, 21); * comboedittype.TabIndex = 11; * comboedittype.SelectedIndexChanged += new EventHandler(comboedittype_SelectedIndexChanged); * // * // label7 * // * label7.AutoSize = true; * label7.Location = new System.Drawing.Point(235, 230); * label7.Name = "label7"; * label7.Size = new System.Drawing.Size(63, 13); * label7.TabIndex = 12; * label7.Text = "Nét vẽ đậm"; * // * // comboeditbold * // * comboeditbold.FormattingEnabled = true; * comboeditbold.Items.AddRange(new object[] { * "1", * "2", * "3", * "4", * "5"}); * comboeditbold.Location = new System.Drawing.Point(304, 230); * comboeditbold.Name = "comboeditbold"; * comboeditbold.Size = new System.Drawing.Size(68, 21); * comboeditbold.TabIndex = 13; * comboeditbold.SelectedIndexChanged += new EventHandler(comboeditbold_SelectedIndexChanged); * // * // btnOK * // * btnOK.Location = new System.Drawing.Point(304, 298); * btnOK.Name = "btnOK"; * btnOK.Size = new System.Drawing.Size(68, 23); * btnOK.TabIndex = 14; * btnOK.Text = "Lưu"; * btnOK.UseVisualStyleBackColor = true; * btnOK.Click += new EventHandler(btnOK_Click); * // * // btnCancel * // * btnCancel.Location = new System.Drawing.Point(304, 327); * btnCancel.Name = "btnCancel"; * btnCancel.Size = new System.Drawing.Size(68, 23); * btnCancel.TabIndex = 15; * btnCancel.Text = "Bỏ qua"; * btnCancel.UseVisualStyleBackColor = true; * // * // EditScaleForm * // * editform.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); * editform.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; * editform.ClientSize = new System.Drawing.Size(391, 361); * editform.Controls.Add(this.btnCancel); * editform.Controls.Add(this.btnOK); * editform.Controls.Add(this.comboeditbold); * editform.Controls.Add(this.label7); * editform.Controls.Add(this.comboedittype); * editform.Controls.Add(this.label6); * editform.Controls.Add(this.btncolor); * editform.Controls.Add(this.label5); * editform.Controls.Add(this.label4); * editform.Controls.Add(this.EditScaleGridView); * editform.Controls.Add(this.txtyaxistitle); * editform.Controls.Add(this.txtxaxistitle); * editform.Controls.Add(this.txtcharttitle); * editform.Controls.Add(this.label3); * editform.Controls.Add(this.label2); * editform.Controls.Add(this.label1); * editform.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; * editform.Name = "EditScaleForm"; * editform.Text = "EditScaleForm"; * EditScaleGridView.DataSource = tblchart; * * } * * void txtyaxistitle_TextChanged(object sender, EventArgs e) * { * myPane.YAxis.Title.Text = txtyaxistitle.Text; * } * * void txtxaxistitle_TextChanged(object sender, EventArgs e) * { * myPane.XAxis.Title.Text = txtxaxistitle.Text; * } * * void txtcharttitle_TextChanged(object sender, EventArgs e) * { * myPane.Title.Text = txtcharttitle.Text; * } * * int rowindex = -1; * void EditScaleGridView_CellContentClick(object sender, DataGridViewCellEventArgs e) * { * rowindex = e.RowIndex; * //show color * btncolor.BackColor = clchart[rowindex]; * //show data type * if (Convert.ToInt16(tblchart.Rows[rowindex]["TypeofValue"]) == 0) * { * comboedittype.Text = "Raw"; * } * else comboedittype.Text = "Refine"; * //show bold line * comboeditbold.Text = tblchart.Rows[rowindex]["BoldLine"].ToString(); * } * * void btncolor_Click(object sender, EventArgs e) * { * if (rowindex >= 0) * { * if (colorDialog1.ShowDialog() == DialogResult.OK) * { * try * { * clchart[rowindex] = colorDialog1.Color; * btncolor.BackColor = clchart[rowindex]; * } * catch (Exception exception) * { * ShowErrorMessage(exception.Message); * } * } * } * } * * void comboedittype_SelectedIndexChanged(object sender, EventArgs e) * { * if (rowindex >= 0) * { * try * { * string selectedcombo = comboedittype.Items[comboedittype.SelectedIndex].ToString(); * if (selectedcombo == "Raw") * { * tblchart.Rows[rowindex]["TypeofValue"] = 0; * } * if (selectedcombo == "Refine") * { * tblchart.Rows[rowindex]["TypeofValue"] = 1; * } * EditScaleGridView.DataSource = tblchart; * } * catch (Exception exception) * { * ShowErrorMessage(exception.Message); * } * * } * } * * void comboeditbold_SelectedIndexChanged(object sender, EventArgs e) * { * try * { * string selectedcombo = comboeditbold.Items[comboeditbold.SelectedIndex].ToString(); * tblchart.Rows[rowindex]["BoldLine"] = Convert.ToInt16(selectedcombo); * EditScaleGridView.DataSource = tblchart; * } * catch (Exception exception) * { * ShowErrorMessage(exception.Message); * } * } * * void btnOK_Click(object sender, EventArgs e) * { * try * { * rowindex = -1; * btncolor.BackColor = Color.Gray; * comboeditbold.Text = ""; * comboedittype.Text = ""; * txtcharttitle.Text = myPane.Title.Text; * txtxaxistitle.Text = myPane.XAxis.Title.Text; * txtyaxistitle.Text = myPane.YAxis.Title.Text; * editform.Close(); * } * catch (Exception exception) * { * ShowErrorMessage(exception.Message); * } * } */ #endregion #region Menu private void scaleToolStripMenuItem_Click(object sender, EventArgs e) { //editform.ShowDialog(); var edit = new EditScaleForm(); edit.pane = myPane; edit.datachart = tblchart; edit.colors = clchart; if (edit.ShowDialog() == DialogResult.OK) { //chart after edit resetchart(); chartview(tblchart, clchart); } }
private void scaleToolStripMenuItem_Click(object sender, EventArgs e) { //editform.ShowDialog(); var edit = new EditScaleForm(); edit.pane = myPane; edit.datachart = tblchart; edit.colors = clchart; if (edit.ShowDialog() == DialogResult.OK) { //chart after edit resetchart(); chartview(tblchart, clchart); } }