zoukankan      html  css  js  c++  java
  • *****get default focusedcell backcolor

     from:

    http://www.devexpress.com/Support/Center/p/CQ55609.aspx

    Is it possible to determine the default focused cell backcolor at run time if we havent overriden it already.

    Unless I explicitly set the focusedcell backcolor, it shows as zero.
    But I want to know the actual "default" color that will be used so I can apply the same color in another area.

    Is this possible?

    This does not work.
     Following is the immediate output from the following command. As you can see, it returns Color.Empty (view is a gridview object which has not had the focusedcell.backcolor modified)

    ?view.PaintAppearance.FocusedCell.BackColor
    "{Name=0, ARGB=(0, 0, 0, 0)}"
        A: 0
        B: 0
        G: 0
        IsEmpty: true
        IsKnownColor: false
        IsNamedColor: false
        IsSystemColor: false
        Name: "0"
        R: 0 

    Hello Geoffrey,

    Thank you for the sample project. The cause of the problem is that you obtaining colors within the Form's Load method. At this point the Grid's internal structures are not initialized yet. We are using a postponed initialization mechanism in our controls so theirs internal objects are initialized only after the control's handle is created. However, you can force the initialization by calling the GridControl's ForceInitialize method before obtaining colors:

    [C#]

    foreach (Control c in this.Controls)
    {
        if (c is GridControl)
        {
            textBox1.AppendText("Grid:" + c.Name + Environment.NewLine);
            GridControl grid = (GridControl)c;
            grid.ForceInitialize(); ///... <<<<< add this line
            foreach (GridView view in grid.ViewCollection)
            {
                textBox1.AppendText("\tView:" + view.Name + Environment.NewLine);
                foreach (AppearanceObject appearance in view.PaintAppearance)
                {
                    textBox1.AppendText("\t\tAppearance:" + appearance.Name + Environment.NewLine);
                    textBox1.AppendText("\t\t\tBackColour:" + appearance.BackColor.ToString() +
    Environment.NewLine);
                }
            }
        }
    }

    Please try this solution and inform us of your results.

    Thanks,
    Stan.

    gridControl1.ForceInitialize();
                foreach (AppearanceObject appearance in gridView1.PaintAppearance)
                {
                    if (appearance.Name == "FocusedRow")
                    {
                        gridView1.Appearance.FocusedCell.BackColor = appearance.BackColor;
                        break;
                    }
                }
     

  • 相关阅读:
    调试sharepoint开发中的用户控件ascx Virus
    sharepoint中的时间问题 Virus
    使用VS进行工作流开发系列博客6Developing Workflows in VS: Part 5 Code Your Workflow Virus
    [摘抄]windows服务中的定时器timer使用 Virus
    宿主和工作流:两个世界的交互 II(工作流给Host传递数据) Virus
    sharepoint2007开发备用链接 Virus
    宿主和工作流:两个世界的交互 4(Host给工作流传递数据) Virus
    品读《建筑的永恒之道》系列 目录
    《建筑的永恒之道》相关评论汇总
    品读《建筑的用恒之道》系列 (一)大师尚在人间
  • 原文地址:https://www.cnblogs.com/luoyaoquan/p/2136068.html
Copyright © 2011-2022 走看看