Beispiel #1
0
 private void DrawYAxisGrid(Graphics g, BrushesStorage brushes)
 {
     if (GridLineVisible || GridBandVisible)
     {
         Rectangle  canvasRect = Owner.CanvasRect;
         RectangleD worldRect  = Owner.WorldRect;
         var        pen        = new Pen(GridLineColor);
         var        brush      = brushes.GetBrush(GridBandColor);
         pen.DashStyle = (DashStyle)Enum.Parse(typeof(DashStyle), GridLineStyle.ToString());
         using (pen)
         {
             var ef =
                 (SizeF)Conversion.WorldToScreen(new SizeD(0.0, LabelInfo.MajorStep), worldRect, canvasRect);
             float left  = canvasRect.Left;
             float right = canvasRect.Right;
             right = (right < left) ? left : right;
             double max  = LabelInfo.Max;
             bool   flag = true;
             while (max > LabelInfo.Min)
             {
                 var tf = (PointF)Conversion.WorldToScreen(new PointD(0.0, max), worldRect, canvasRect);
                 if ((GridBandVisible && (GridBandColor != Color.Empty)) && flag)
                 {
                     g.FillRectangle(brush, canvasRect.Left, tf.Y, canvasRect.Width, ef.Height);
                 }
                 if (GridLineVisible)
                 {
                     g.DrawLine(pen, left, tf.Y, right, tf.Y);
                 }
                 flag = !flag;
                 max -= LabelInfo.MajorStep;
             }
         }
     }
 }
Beispiel #2
0
		/*/// <summary>
		/// Specifies whether pressing the Tab key while editing moves the 
		/// editor to the next available cell
		/// </summary>
		private bool tabMovesEditor;*/

		#endregion

		#endregion


		#region Constructor

		/// <summary>
		/// Initializes a new instance of the Table class with default settings
		/// </summary>
		public Table()
		{
			// starting setup
			this.init = true;
			
			// This call is required by the Windows.Forms Form Designer.
			components = new System.ComponentModel.Container();

			//
			this.SetStyle(ControlStyles.UserPaint, true);
			this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			this.SetStyle(ControlStyles.DoubleBuffer, true);
			this.SetStyle(ControlStyles.ResizeRedraw, true);
			this.SetStyle(ControlStyles.Selectable, true);
			this.TabStop = true;

			this.Size = new Size(150, 150);

			this.BackColor = Color.White;

			//
			this.columnModel = null;
			this.tableModel = null;

			// header
			this.headerStyle = ColumnHeaderStyle.Clickable;
			this.headerFont = this.Font;
			this.headerRenderer = new XPHeaderRenderer();
			//this.headerRenderer = new GradientHeaderRenderer();
			//this.headerRenderer = new FlatHeaderRenderer();
			this.headerRenderer.Font = this.headerFont;
			this.headerContextMenu = new HeaderContextMenu();
			
			this.columnResizing = true;
			this.resizingColumnIndex = -1;
			this.resizingColumnWidth = -1;
			this.hotColumn = -1;
			this.pressedColumn = -1;
			this.lastSortedColumn = -1;
			this.sortedColumnBackColor = Color.WhiteSmoke;

			// borders
			this.borderStyle = BorderStyle.Fixed3D;

			// scrolling
			this.scrollable = true;

			this.hScrollBar = new HScrollBar();
			this.hScrollBar.Visible = false;
			this.hScrollBar.Location = new Point(this.BorderWidth, this.Height - this.BorderWidth - SystemInformation.HorizontalScrollBarHeight);
			this.hScrollBar.Width = this.Width - (this.BorderWidth * 2) - SystemInformation.VerticalScrollBarWidth;
			this.hScrollBar.Scroll += new ScrollEventHandler(this.OnHorizontalScroll);
			this.Controls.Add(this.hScrollBar);

			this.vScrollBar = new VScrollBar();
			this.vScrollBar.Visible = false;
			this.vScrollBar.Location = new Point(this.Width - this.BorderWidth - SystemInformation.VerticalScrollBarWidth, this.BorderWidth);
			this.vScrollBar.Height = this.Height - (this.BorderWidth * 2) - SystemInformation.HorizontalScrollBarHeight;
			this.vScrollBar.Scroll += new ScrollEventHandler(this.OnVerticalScroll);
			this.Controls.Add(this.vScrollBar);

			//
			this.gridLines = GridLines.None;;
			this.gridColor = SystemColors.Control;
			this.gridLineStyle = GridLineStyle.Solid;

			this.allowSelection = true;
			this.multiSelect = false;
			this.fullRowSelect = false;
			this.hideSelection = false;
			this.selectionBackColor = SystemColors.Highlight;
			this.selectionForeColor = SystemColors.HighlightText;
			this.unfocusedSelectionBackColor = SystemColors.Control;
			this.unfocusedSelectionForeColor = SystemColors.ControlText;
			this.selectionStyle = SelectionStyle.ListView;
			this.alternatingRowColor = Color.Transparent;

			// current table state
			this.tableState = TableState.Normal;

			this.lastMouseCell = new CellPos(-1, -1);
			this.lastMouseDownCell = new CellPos(-1, -1);
			this.focusedCell = new CellPos(-1, -1);
			this.hoverTime = 1000;
			this.trackMouseEvent = null;
			this.ResetMouseEventArgs();

			this.toolTip = new ToolTip(this.components);
			this.toolTip.Active = false;
			this.toolTip.InitialDelay = 1000;

			this.noItemsText = "There are no items in this view";

			this.editingCell = new CellPos(-1, -1);
			this.curentCellEditor = null;
			this.editStartAction = EditStartAction.DoubleClick;
			this.customEditKey = Keys.F5;
			//this.tabMovesEditor = true;

			// finished setting up
			this.beginUpdateCount = 0;
			this.init = false;
			this.preview = false;
		}