private void table_CellButtonClicked(object sender, XPTable.Events.CellButtonEventArgs e) { if (e.Cell.Row.Tag is int) { int id = (int)e.Cell.Row.Tag; UO.UseSkill((ushort)id); } }
/// <summary> /// Handles the CellButtonClicked event of the tableOtherElements control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="XPTable.Events.CellButtonEventArgs"/> instance containing the event data.</param> /// <remarks>Documented by Dev05, 2007-11-02</remarks> private void tableOtherElements_CellButtonClicked(object sender, XPTable.Events.CellButtonEventArgs e) { tableOtherElements.TableModel.Rows.RemoveAt(e.Cell.Row.Index); if (!actualizing) { Actualize(sender); } }
/// <summary> /// Handles the CellButtonClicked event of the tableCards control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="XPTable.Events.CellButtonEventArgs"/> instance containing the event data.</param> /// <remarks>Documented by Dev05, 2007-09-27</remarks> private void tableCards_CellButtonClicked(object sender, XPTable.Events.CellButtonEventArgs e) { tableCards.TableModel.Rows.RemoveAt(e.Cell.Row.Index); if (tableCards.TableModel.Rows.Count == 0) { tableCards.GridLines = GridLines.None; } if (e.Cell.Row == currentItem) { position = 50; } }
private void table1_CellButtonClicked(object sender, XPTable.Events.CellButtonEventArgs e) { FolderBrowserDialog fbd = new FolderBrowserDialog(); if (tableModel1.Rows[e.Row].Cells[1].Text.Trim().Length > 0) { fbd.SelectedPath = tableModel1.Rows[e.Row].Cells[1].Text; } var result = fbd.ShowDialog(); if (result == DialogResult.OK) { tableModel1.Rows[e.Row].Cells[1].Text = fbd.SelectedPath; } }
/// <summary> /// Handles the CellButtonClicked event of the tableXSL control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="XPTable.Events.CellButtonEventArgs"/> instance containing the event data.</param> /// <remarks>Documented by Dev05, 2007-10-30</remarks> private void tableXSL_CellButtonClicked(object sender, XPTable.Events.CellButtonEventArgs e) { XSLStyleElement element = e.Cell.Tag as XSLStyleElement; FontDialog fontdialog = new FontDialog(); fontdialog.ShowColor = false; fontdialog.ShowApply = false; fontdialog.ShowEffects = false; fontdialog.ShowHelp = false; fontdialog.ScriptsOnly = true; fontdialog.MinSize = 6; fontdialog.MaxSize = 72; fontdialog.FontMustExist = true; FontStyle style = FontStyle.Regular; if (element.Items.ContainsKey("font-weight") && element.Items["font-weight"].ToLower() == "bold") { style |= FontStyle.Bold; } if (element.Items.ContainsKey("font-style") && element.Items["font-style"].ToLower() == "italic") { style |= FontStyle.Italic; } string fontFace = element.Items.ContainsKey("font-family") ? element.Items["font-family"] : "Arial"; int defaultFontSize = 12; int fontSize = defaultFontSize; if (element.Items.ContainsKey("font-size") && !element.Items["font-size"].Contains("%")) { if (element.Items["font-size"].EndsWith("pt")) { if (!Int32.TryParse(element.Items["font-size"].Replace("pt", String.Empty), out fontSize)) { fontSize = defaultFontSize; } } else { if (!Int32.TryParse(element.Items["font-size"], out fontSize)) { fontSize = defaultFontSize; } } } try // to handle a rare exception that can be thrown when the user selects an invalid font { fontdialog.Font = new Font(fontFace, fontSize, style); } catch { fontdialog.Font = new Font("Microsoft Sans Serif", fontSize, style); } if (fontdialog.ShowDialog() == DialogResult.OK) { if (element.Items.ContainsKey("font-size")) { element.Items["font-size"] = Math.Round(fontdialog.Font.Size, 0).ToString() + "pt"; } else { element.Items.Add("font-size", Math.Round(fontdialog.Font.Size, 0).ToString() + "pt"); } if (element.Items.ContainsKey("font-style")) { element.Items["font-style"] = fontdialog.Font.Italic ? "italic" : "normal"; } else { element.Items.Add("font-style", fontdialog.Font.Italic ? "italic" : "normal"); } if (element.Items.ContainsKey("font-weight")) { element.Items["font-weight"] = fontdialog.Font.Bold ? "bold" : "normal"; } else { element.Items.Add("font-weight", fontdialog.Font.Bold ? "bold" : "normal"); } if (element.Items.ContainsKey("font-family")) { element.Items["font-family"] = fontdialog.Font.FontFamily.Name; } else { element.Items.Add("font-family", fontdialog.Font.FontFamily.Name); } SaveFile(); ShowPreview(); } }