예제 #1
0
 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);
     }
 }
예제 #2
0
 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);
             }
         }
     }
 }
예제 #3
0
        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);
                }
            }
        }
예제 #4
0
        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;
                    }
                }
            }
        }
예제 #5
0
        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;
                    }
                }
            }
        }
예제 #6
0
        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;
        }
예제 #7
0
        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);
                }
            }
        }