private void SetStyle(GridViewCellStyle style) { if (style.Font != null) { if (style.Font.Bold) { style.Font = GetFont(FontStyle.Bold); } else if (style.Font.Italic) { style.Font = GetFont(FontStyle.Italic); } else if (style.Font.Underline) { style.Font = GetFont(FontStyle.Underline); } else { style.Font = GetFont(FontStyle.Regular); } } else { style.Font = GetFont(FontStyle.Regular); } }
private void radButtonElementUnderline_Click(object sender, EventArgs e) { foreach (GridViewCellInfo cell in gridView.SelectedCells) { GridViewCellStyle style = cell.Style; if (style != null) { if (style.Font != null) { if (!style.Font.Underline) { style.Font = GetFont(FontStyle.Underline); } else { style.Font = GetFont(FontStyle.Regular); } } else { style.Font = GetFont(FontStyle.Underline); } } } }
private void radDropDownListElementFontSize_SelectedIndexChanged(object sender, EventArgs e) { if (updatingCombos) { return; } foreach (GridViewCellInfo cell in gridView.SelectedCells) { GridViewCellStyle style = cell.Style; if (style != null) { SetStyle(style); } } }
private void radButtonElementFontColor_Click(object sender, EventArgs e) { RadColorDialog radColorDialog = new RadColorDialog(); if (radColorDialog.ShowDialog() == DialogResult.OK) { Color color = radColorDialog.SelectedColor; foreach (GridViewCellInfo cell in gridView.SelectedCells) { GridViewCellStyle style = cell.Style; if (style != null) { style.ForeColor = color; } } } }
private void radButtonElementColor_Click(object sender, EventArgs e) { RadColorDialog radColorDialog = new RadColorDialog(); if (radColorDialog.ShowDialog() == DialogResult.OK) { Color color = radColorDialog.SelectedColor; foreach (GridViewCellInfo cell in gridView.SelectedCells) { GridViewCellStyle style = cell.Style; if (style != null) { style.CustomizeFill = true; style.GradientStyle = GradientStyles.Solid; style.BackColor = color; } } } }
private void UpdateCombos(GridViewCellStyle style) { if (style.Font == null) { return; } updatingCombos = true; string fontFamilyName = "Calibri"; if (style.Font.FontFamily != null) { } fontFamilyName = style.Font.FontFamily.Name; foreach (RadListDataItem item in radDropDownListElementFont.Items) { if (item.Text == fontFamilyName) { radDropDownListElementFont.SelectedItem = item; break; } } float fontSize = style.Font.Size; foreach (RadListDataItem item in radDropDownListElementFontSize.Items) { if (float.Parse(item.Text) == fontSize) { radDropDownListElementFontSize.SelectedItem = item; break; } } updatingCombos = false; }
private void gridView_CurrentCellChanged(object sender, CurrentCellChangedEventArgs e) { if (e.NewCell != null) { string columnName = e.NewCell.ColumnInfo.HeaderText; string rowNumber = (e.NewCell.RowInfo.Index + 1).ToString(); this.radTextBoxCellNumber.Text = columnName + rowNumber; if (e.NewCell.Value != null) { this.radTextBoxCellContent.Text = e.NewCell.Value.ToString(); } else { this.radTextBoxCellContent.Text = String.Empty; } GridViewCellStyle style = e.NewCell.Style; if (style != null) { UpdateCombos(style); } } }