Beispiel #1
0
 protected internal CellElement(CellView host, object row, Column column) : base(host)
 {
   m_Row = row;
   m_Column = column;
   m_Grid = column.Grid;
   
   m_Style = new Style(null, getBaseStyle());
   
   if (row==null)//if header cell
   {
      m_ColumnResizeElement = new ColumnResizeElement(host, this);
      m_ColumnResizeElement.ZOrder = 1;
   }   
 }
Beispiel #2
0
       public Grid() : base ()
       {
         //SetStyle(ControlStyles.OptimizedDoubleBuffer, true); //the CellView is already dbl buffered
         SetStyle(ControlStyles.UserPaint, true);
         SetStyle(ControlStyles.AllPaintingInWmPaint, true); //no ERASE BACKGROUND
         
         SetStyle(ControlStyles.UserMouse, true);

         base.DoubleBuffered = true;
         
         UpdateStyles();
         
         m_Style = new Style(this, null);
         m_HeaderStyle = new Style(this, null);
         m_SelectedStyle = new Style(this, null);
         
         BuildDefaultStyle(m_Style);
         BuildDefaultHeaderStyle(m_HeaderStyle);
         BuildDefaultSelectedStyle(m_SelectedStyle);
         
        
                  
         m_CellView = new CellView() {   Parent = this , TabStop = false};
         
         
         m_HScrollBar = new HScrollBar() {   Parent = this, TabStop = false, Minimum=0, SmallChange=1, LargeChange =1  };
         m_HScrollBar.ValueChanged += m_HScrollBar_Scroll;
                                        
         m_VScrollBar = new VScrollBar() {   Parent = this, TabStop = false, Minimum=0, SmallChange=1   };                                          
         m_VScrollBar.ValueChanged += m_VScrollBar_Scroll;   
         
         m_DataSourceChangedNotificationTimer = new Timer();
         m_DataSourceChangedNotificationTimer.Interval = REBUILD_TIMEOUT_MS;
         m_DataSourceChangedNotificationTimer.Enabled = false;
         m_DataSourceChangedNotificationTimer.Tick += new EventHandler((o, e) =>
                                                       {
                                                        if (m_RepositioningColumn!=null || m_ResizingColumn!=null ) return;//while grid is being manipulated dont flush timer just yet
                                                        m_DataSourceChangedNotificationTimer.Stop(); 
                                                        notifyDataSourceChanged(m_DataSourceChangedNotificationRow);
                                                        m_DataSourceChangedNotificationRow = null; 
                                                       });
       }
Beispiel #3
0
 /// <summary>
 /// Builds default style for data cells in selected rows
 /// </summary>
 public virtual void BuildDefaultSelectedStyle(Style style)
 {
  //  style.HAlignment = HAlignment.Center;
    style.BorderTop = new LineStyle(){ Color = Color.Transparent };
    style.BorderBottom = new LineStyle(){ Color = Color.Silver};
    style.BGKind = BGKind.BackwardDiagonalGradient;//.VerticalGradient;
    style.BGColor = Color.FromArgb(199,199,255);
    style.BGColor2 = Color.FromArgb(250,250,255);
 }
Beispiel #4
0
 /// <summary>
 /// Builds default style for header row cells - column titles
 /// </summary>
 public virtual void BuildDefaultHeaderStyle(Style style)
 {
    style.HAlignment = HAlignment.Center;
    style.BorderLeft = new LineStyle(){ Color = Color.White };
    style.BorderTop = new LineStyle(){ Color = Color.White };
    style.BorderBottom = new LineStyle(){ Color = Color.FromArgb(100,100,100) };
    style.BGKind = BGKind.HorizontalGradient;
    style.BGColor = Color.White;
    style.BGColor2 = Color.Silver;
 }
Beispiel #5
0
 /// <summary>
 /// Builds default style for data cells in non-selected rows
 /// </summary>
 public virtual void BuildDefaultStyle(Style style)
 {
 }
Beispiel #6
0
        private Brush getBrush(Style style)
        {
            switch (style.BGKind)
              {
            case BGKind.Hatched:
            {
              var result = new HatchBrush(style.BGHatchStyle, style.BGHatchColor,
                                      style.BGColor);
              return result;
            }

            case BGKind.VerticalGradient:
            {
              var result = new LinearGradientBrush(Region, style.BGColor, style.BGColor2,
                                               LinearGradientMode.Vertical);
              return result;
            }
            case BGKind.HorizontalGradient:
            {
              var result = new LinearGradientBrush(Region, style.BGColor, style.BGColor2,
                                               LinearGradientMode.Horizontal);
              return result;
            }
            case BGKind.ForwardDiagonalGradient:
            {
              var result = new LinearGradientBrush(Region, style.BGColor, style.BGColor2,
                                               LinearGradientMode.ForwardDiagonal);
              return result;
            }
            case BGKind.BackwardDiagonalGradient:
            {
              var result = new LinearGradientBrush(Region, style.BGColor, style.BGColor2,
                                               LinearGradientMode.BackwardDiagonal);
              return result;
            }

            case BGKind.Solid:
            default:
            {
              var result = new SolidBrush(style.BGColor);
              return result;
            }
              }
        }
Beispiel #7
0
 /// <summary>
 /// Creates a style in a context of control and parent. If an attribute is not defined in this instance it is tried to be fetched from parent.
 /// If parent is not available then control context is used if it is not null for some properties like Font and BGColor. Both context and parent may be null
 /// </summary>
 public Style(Control contextCtl, Style parent)
 {
   m_ContextControl = contextCtl;
   m_Parent = parent;
 }
Beispiel #8
0
  /// <summary>
  /// Copies attributes from another style
  /// </summary>
  public void Assign(Style from)
  {
     m_HAlignment = from.m_HAlignment;
     m_BGKind = from.m_BGKind;
     m_BGColor = from.m_BGColor;
     m_BGColor2 = from.m_BGColor2; 
     m_BGHatchColor = from.m_BGHatchColor;        
     m_BGHatchStyle = from.m_BGHatchStyle;
     m_Padding = from.m_Padding; 
     m_BorderLeft = from.m_BorderLeft;
     m_BorderRight = from.m_BorderRight;
     m_BorderTop = from.m_BorderTop;
     m_BorderBottom = from.m_BorderBottom;
     m_Font = from.m_Font;
 }
Beispiel #9
0
 /// <summary>
 /// Builds default style for data cells in non-selected rows
 /// </summary>
 public virtual void BuildDefaultStyle(Style style)
 {
 }