当前位置: 首页>>代码示例>>C#>>正文


C# Events.PaintCellEventArgs类代码示例

本文整理汇总了C#中XPTable.Events.PaintCellEventArgs的典型用法代码示例。如果您正苦于以下问题:C# PaintCellEventArgs类的具体用法?C# PaintCellEventArgs怎么用?C# PaintCellEventArgs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


PaintCellEventArgs类属于XPTable.Events命名空间,在下文中一共展示了PaintCellEventArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnPaint

		/// <summary>
		/// Raises the Paint event
		/// </summary>
		/// <param name="e">A PaintCellEventArgs that contains the event data</param>
		protected override void OnPaint(PaintCellEventArgs e)
		{
			base.OnPaint(e);
			
			// don't bother going any further if the Cell is null 
			if (e.Cell == null)
			{
				return;
			}

			string text = e.Cell.Text;

			if (text != null && text.Length != 0)
			{
				// v1.1.1 fix - removed hardcoded alignment

				if (e.Enabled)
				{
					e.Graphics.DrawString(text, this.Font, this.ForeBrush, this.ClientRectangle, this.StringFormat);
				}
				else
				{
					e.Graphics.DrawString(text, this.Font, this.GrayTextBrush, this.ClientRectangle, this.StringFormat);
				}
			}
			
			if (e.Focused && e.Enabled)
			{
				ControlPaint.DrawFocusRectangle(e.Graphics, this.ClientRectangle);
			}
		}
开发者ID:samuraitruong,项目名称:comitdownloader,代码行数:35,代码来源:TextCellRenderer.cs

示例2: OnPaint

        /// <summary>
        /// Raises the Paint event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        protected override void OnPaint(PaintCellEventArgs e)
        {
            base.OnPaint(e);

            // don't bother going any further if the Cell is null
            if (e.Cell == null)
            {
                return;
            }

            Rectangle buttonRect = this.CalcDropDownButtonBounds();
            Rectangle textRect = this.ClientRectangle;

            if (this.ShowDropDownButton)
            {
                textRect.Width -= buttonRect.Width - 1;
            }

            // draw the text
            if (!string.IsNullOrEmpty(e.Cell.Text))
            {
                if (e.Enabled)
                {
                    this.DrawString(e.Graphics, e.Cell.Text, this.Font, this.ForeBrush, textRect, e.Cell.WordWrap);
                }
                else
                {
                    this.DrawString(e.Graphics, e.Cell.Text, this.Font, this.GrayTextBrush, textRect, e.Cell.WordWrap);
                }

                if (e.Cell.WidthNotSet)
                {
                    SizeF size = e.Graphics.MeasureString(e.Cell.Text, this.Font);
                    e.Cell.ContentWidth = (int)Math.Ceiling(size.Width) + (this.ShowDropDownButton ? buttonRect.Width : 0);
                }
            }
            else
            {
                if (e.Cell.WidthNotSet)
                {
                    e.Cell.ContentWidth = this.ShowDropDownButton ? buttonRect.Width : 0;
                }
            }

            // only if we want to show selection rectangle
            if (e.Focused && e.Enabled && e.Table.ShowSelectionRectangle)
            {
                Rectangle focusRect = this.ClientRectangle;

                if (this.ShowDropDownButton)
                {
                    focusRect.Width -= buttonRect.Width;
                }

                ControlPaint.DrawFocusRectangle(e.Graphics, focusRect);
            }
        }
开发者ID:adarmus,项目名称:XPTable,代码行数:61,代码来源:ComboBoxCellRenderer.cs

示例3: OnPaint

        /// <summary>
        /// Raises the Paint event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        protected override void OnPaint(PaintCellEventArgs e)
        {
            base.OnPaint(e);

            // don't bother going any further if the Cell is null
            if (e.Cell == null)
                return;

            Cell c = e.Cell;

            //////////////////
            if (c.WidthNotSet)
            {
                int w = GetCellWidth(e.Graphics, c);
                c.ContentWidth = w;
            }
            //////////////////

            string text = c.Text;

            if (!string.IsNullOrEmpty(text))
            {
                if (e.Enabled)
                {
                    this.DrawString(e.Graphics, text, this.Font, this.ForeBrush, this.ClientRectangle, c.WordWrap);
                }
                else
                {
                    this.DrawString(e.Graphics, text, this.Font, this.GrayTextBrush, this.ClientRectangle, c.WordWrap);
                }

                // Also, determine whether we need a tooltip, if the text was truncated.
                if (c.WordWrap)
                {
                    c.InternalIsTextTrimmed = false;
                }
                else if (e.Table.EnableToolTips)
                {
                    c.InternalIsTextTrimmed = this.IsTextTrimmed(e.Graphics, c.Text);
                }
            }

            if ((e.Focused && e.Enabled)
                // only if we want to show selection rectangle
                && (e.Table.ShowSelectionRectangle))
            {
                ControlPaint.DrawFocusRectangle(e.Graphics, this.ClientRectangle);
            }
        }
开发者ID:adarmus,项目名称:XPTable,代码行数:53,代码来源:TextCellRenderer.cs

示例4: OnPaintCell

        /// <summary>
        /// Raises the PaintCell event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        public override void OnPaintCell(PaintCellEventArgs e)
        {
            if (e.Table.ColumnModel.Columns[e.Column] is ControlColumn)
            {
                ControlColumn column = (ControlColumn) e.Table.ColumnModel.Columns[e.Column];

                this.controlSize = column.ControlSize;
                this.controlFactory = column.ControlFactory;
            }
            else
            {
                this.controlSize = new Size(13, 13);
            }

            base.OnPaintCell(e);
        }
开发者ID:antiduh,项目名称:XPTable,代码行数:20,代码来源:ControlCellRenderer.cs

示例5: OnPaint

		/// <summary>
		/// Raises the Paint event
		/// </summary>
		/// <param name="e">A PaintCellEventArgs that contains the event data</param>
		protected override void OnPaint(PaintCellEventArgs e)
		{
			base.OnPaint(e);

			// don't bother going any further if the Cell is null 
			if (e.Cell == null)
			{
				return;
			}

			Rectangle buttonRect = this.CalcDropDownButtonBounds();

			Rectangle textRect = this.ClientRectangle;

			if (this.ShowDropDownButton)
			{
				textRect.Width -= buttonRect.Width - 1;
			}

			// draw the text
			if (e.Cell.Text != null && e.Cell.Text.Length != 0)
			{
				if (e.Enabled)
				{
					e.Graphics.DrawString(e.Cell.Text, this.Font, this.ForeBrush, textRect, this.StringFormat);
				}
				else
				{
					e.Graphics.DrawString(e.Cell.Text, this.Font, this.GrayTextBrush, textRect, this.StringFormat);
				}
			}
			
			if (e.Focused && e.Enabled)
			{
				Rectangle focusRect = this.ClientRectangle;

				if (this.ShowDropDownButton)
				{
					focusRect.Width -= buttonRect.Width;
				}
				
				ControlPaint.DrawFocusRectangle(e.Graphics, focusRect);
			}
		}
开发者ID:samuraitruong,项目名称:comitdownloader,代码行数:48,代码来源:ComboBoxCellRenderer.cs

示例6: OnPaint

        protected override void OnPaint(PaintCellEventArgs e)
        {
            base.OnPaint(e);

            // don't bother going any further if the Cell is null
            if (e.Cell == null)
                return;

            // make sure we have some Text to draw
            if (e.Cell.Text != null && e.Cell.Text.Length != 0)
            {
                // check whether the cell is enabled
                if (e.Enabled)
                {
                    TextRenderer.DrawText(e.Graphics, e.Cell.Text, base.Font, base.ClientRectangle, base.ForeColor, formatFlags);
                }
                else
                {
                    Color GrayColor = Color.Gray;
                    try
                    {
                        GrayColor = (base.GrayTextBrush as SolidBrush).Color;
                    }
                    catch { }

                    TextRenderer.DrawText(e.Graphics, e.Cell.Text, base.Font, base.ClientRectangle, GrayColor, formatFlags);
                }
            }

            // draw a focus rect around the cell if it is
            // enabled and has focus
            if (e.Focused && e.Enabled)
            {
                ControlPaint.DrawFocusRectangle(e.Graphics,
                                              base.ClientRectangle);
            }
        }
开发者ID:Stoner19,项目名称:Memory-Lifter,代码行数:37,代码来源:XPTableRenderers.cs

示例7: OnPaint

        /// <summary>
        /// Raises the Paint event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        protected override void OnPaint(PaintCellEventArgs e)
        {
            base.OnPaint(e);

            // don't bother going any further if the Cell is null
            if (e.Cell == null)
            {
                return;
            }

            Rectangle textRect = this.CalcButtonBounds();
            textRect.Inflate(-4, -2);

            int imageWidth = 0;
            int textWidth = 0;

            if (e.Cell.Image != null)
            {
                Rectangle imageRect = this.CalcImageRect(e.Cell.Image, this.ImageAlignment);

                if (this.GetButtonRendererData(e.Cell).ButtonState == PushButtonState.Pressed && !ThemeManager.VisualStylesEnabled)
                {
                    imageRect.X += 1;
                    imageRect.Y += 1;
                }

                this.DrawImage(e.Graphics, e.Cell.Image, imageRect, e.Enabled);
                imageWidth = imageRect.Width;
            }

            // draw the text
            if (e.Cell.Text != null && e.Cell.Text.Length != 0)
            {
                if (e.Enabled)
                {
                    if (!ThemeManager.VisualStylesEnabled && this.GetButtonRendererData(e.Cell).ButtonState == PushButtonState.Pressed)
                    {
                        textRect.X += 1;
                        textRect.Y += 1;
                    }

                    // if the cell or the row it is in is selected
                    // our forecolor will be the selection forecolor.
                    // we'll ignore this and reset our forecolor to
                    // that of the cell being rendered
                    if (e.Selected)
                    {
                        this.ForeColor = e.Cell.ForeColor;
                    }

                    e.Graphics.DrawString(e.Cell.Text, this.Font, this.ForeBrush, textRect, this.StringFormat);
                }
                else
                {
                    e.Graphics.DrawString(e.Cell.Text, this.Font, this.GrayTextBrush, textRect, this.StringFormat);
                }

                if (e.Cell.WidthNotSet)
                {
                    SizeF size = e.Graphics.MeasureString(e.Cell.Text, this.Font);
                    textWidth = (int)Math.Ceiling(size.Width);
                }
            }

            if (e.Cell.WidthNotSet)
            {
                e.Cell.ContentWidth = imageWidth + textWidth;
            }

            // draw focus
            if( (e.Focused && e.Enabled)
                // only if we want to show selection rectangle
                && ( e.Table.ShowSelectionRectangle ) )
            {
                Rectangle focusRect = this.CalcButtonBounds();

                if (ThemeManager.VisualStylesEnabled)
                {
                    focusRect.Inflate(-3, -3);

                    if (this.GetButtonRendererData(e.Cell).ButtonState != PushButtonState.Pressed)
                    {
                        ControlPaint.DrawFocusRectangle(e.Graphics, focusRect);
                    }
                }
                else
                {
                    focusRect.Inflate(-4, -4);

                    ControlPaint.DrawFocusRectangle(e.Graphics, focusRect);
                }
            }
        }
开发者ID:antiduh,项目名称:XPTable,代码行数:97,代码来源:ButtonCellRenderer.cs

示例8: OnPaint

		/// <summary>
		/// Raises the Paint event
		/// </summary>
		/// <param name="e">A PaintCellEventArgs that contains the event data</param>
		protected override void OnPaint(PaintCellEventArgs e)
		{
			base.OnPaint(e);

			// don't bother if the Cell is null
			if (e.Cell == null)
			{
				return;
			}
			
			// get the Cells value
			int intVal = 0;

			if (e.Cell.Data != null && e.Cell.Data is int)
			{
				intVal = (int) e.Cell.Data;
			}

			if (intVal < 0)
			{
				intVal = 0;
			}
			else if (intVal > 100)
			{
				intVal = 100;
			}

			// adjust the chunk rect so we don't draw over the
			// progress bars borders
			Rectangle chunkRect = this.ClientRectangle;
			chunkRect.Inflate(-2, -2);

			// if xp themes are enabled, shrink the size of the 
			// progress bar as otherwise the focus rect appears 
			// to go awol if the cell has focus
			if (ThemeManager.VisualStylesEnabled)
			{
				chunkRect.Inflate(-1, -1);
			}

			chunkRect.Width = (int) ((((double) intVal) / 100d) * ((double) chunkRect.Width));

			if (e.Enabled)
			{
				ThemeManager.DrawProgressBarChunks(e.Graphics, chunkRect);
			}
			else
			{
				using (Bitmap b = new Bitmap(chunkRect.Width, chunkRect.Height))
				{
					using (Graphics g = Graphics.FromImage(b))
					{
						ThemeManager.DrawProgressBarChunks(g, new Rectangle(0, 0, chunkRect.Width, chunkRect.Height));
					}

					ControlPaint.DrawImageDisabled(e.Graphics, b, chunkRect.X, chunkRect.Y, this.BackBrush.Color);
				}
			}

			if (this.DrawPercentageText)
			{
				this.Alignment = ColumnAlignment.Center;
				this.LineAlignment = RowAlignment.Center;

				Font font = new Font(this.Font.FontFamily, this.Font.SizeInPoints, FontStyle.Bold);

				if (e.Enabled)
				{
					e.Graphics.DrawString("" + intVal + "%", font, SystemBrushes.ControlText, this.ClientRectangle, this.StringFormat);
				}
				else
				{
					e.Graphics.DrawString("" + intVal + "%", font, Brushes.White, this.ClientRectangle, this.StringFormat);
				}
				
				if (!ThemeManager.VisualStylesEnabled)
				{
					// remember the old clip area
					Region oldClip = e.Graphics.Clip;
					
					Rectangle clipRect = this.ClientRectangle;
					clipRect.Width = chunkRect.Width + 2;
					e.Graphics.SetClip(clipRect);

					if (e.Table.Enabled)
					{
						e.Graphics.DrawString("" + intVal + "%", font, SystemBrushes.HighlightText, this.ClientRectangle, this.StringFormat);
					}
					else
					{
						e.Graphics.DrawString("" + intVal + "%", font, Brushes.White, this.ClientRectangle, this.StringFormat);
					}

					// restore the old clip area
					e.Graphics.SetClip(oldClip, CombineMode.Replace);
				}
//.........这里部分代码省略.........
开发者ID:samuraitruong,项目名称:comitdownloader,代码行数:101,代码来源:ProgressBarCellRenderer.cs

示例9: OnPaintCell

		/// <summary>
		/// Raises the PaintCell event
		/// </summary>
		/// <param name="e">A PaintCellEventArgs that contains the event data</param>
		public override void OnPaintCell(PaintCellEventArgs e)
		{
			if (e.Table.ColumnModel.Columns[e.Column] is ProgressBarColumn)
			{
				this.drawPercentageText = ((ProgressBarColumn) e.Table.ColumnModel.Columns[e.Column]).DrawPercentageText;
			}
			else
			{
				this.drawPercentageText = false;
			}
			
			base.OnPaintCell(e);
		}
开发者ID:samuraitruong,项目名称:comitdownloader,代码行数:17,代码来源:ProgressBarCellRenderer.cs

示例10: OnPaint

        /// <summary>
        /// Raises the Paint event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        protected override void OnPaint(PaintCellEventArgs e)
        {
            //base.OnPaint(e);

            // don't bother if the Cell is null or doesn't have an image
            if (e.Cell == null)
            {
                return;
            }

            if (e.Cell.Icon != null)
            {
                // work out the size and location of the image
                Rectangle imageRect = this.CalcImageRect(e.Cell.Image, e.Cell.ImageSizeMode, this.LineAlignment, this.Alignment);
                //imageRect.Y -= 1;
                imageRect.X += 1;
                imageRect.Width = 16;
                imageRect.Height = 16;

                e.Graphics.DrawIconUnstretched(e.Cell.Icon, imageRect);
            }
            //else if (e.Cell.Image!=null)
            //{
            //    // work out the size and location of the image
            //    Rectangle imageRect = this.CalcImageRect(e.Cell.Image, e.Cell.ImageSizeMode, this.LineAlignment, this.Alignment);
            //    //imageRect.Y -= 1;
            //    imageRect.X += 1;
            //    imageRect.Width = 16;
            //    imageRect.Height = 16;

            //    // draw the image
            //    bool scaled = false; // (this.DrawText || e.Cell.ImageSizeMode != ImageSizeMode.Normal);
            //    this.DrawImage(e.Graphics, e.Cell.Image, imageRect, scaled, e.Table.Enabled);
            //}

            // check if we need to draw any text
            if (this.DrawText)
            {
                if (e.Cell.Text != null && e.Cell.Text.Length != 0)
                {
                    // rectangle the text will be drawn in
                    Rectangle textRect = this.ClientRectangle;

                    // take the imageRect into account so we don't
                    // draw over it
                    textRect.X += 18;//imageRect.Width;
                    textRect.Width -= 18; // imageRect.Width;
                    textRect.Y += 1;

                    // check that we will be able to see the text
                    if (textRect.Width > 0)
                    {
                        // draw the text
                        if (e.Enabled)
                        {
                            TextRenderer.DrawText(e.Graphics, e.Cell.Text, this.Font, textRect, this.ForeBrush.Color, TextFormatFlags.Left);
                        }
                        else
                        {
                            TextRenderer.DrawText(e.Graphics, e.Cell.Text, this.Font, textRect, SystemColors.GrayText, TextFormatFlags.Left);
                        }
                    }
                }
            }

            if (e.Focused && e.Enabled)
            {
                Rectangle rect = this.ClientRectangle;
                rect.X += 19;
                rect.Width -= 19;
                ControlPaint.DrawFocusRectangle(e.Graphics, rect);
            }
        }
开发者ID:chzh,项目名称:xrefresh,代码行数:77,代码来源:XPTableTweaks.cs

示例11: OnPaintCell

        /// <summary>
        /// Raises the PaintCell event
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        public override void OnPaintCell(PaintCellEventArgs e)
        {
            if (e.Table.ColumnModel.Columns[e.Column] is DropDownColumn)
            {
                this.showButton = ((DropDownColumn)e.Table.ColumnModel.Columns[e.Column]).ShowDropDownButton;
            }
            else
            {
                this.showButton = true;
            }

            base.OnPaintCell(e);
        }
开发者ID:chzh,项目名称:xrefresh,代码行数:17,代码来源:XPTableTweaks.cs

示例12: OnAfterPaintCell

		/// <summary>
		/// Raises the AfterPaintCell event
		/// </summary>
		/// <param name="e">A PaintCellEventArgs that contains the event data</param>
		protected virtual void OnAfterPaintCell(PaintCellEventArgs e)
		{
			if (AfterPaintCell != null)
			{
				AfterPaintCell(this, e);
			}
		}
开发者ID:nithinphilips,项目名称:SMOz,代码行数:11,代码来源:Table.cs

示例13: OnBeforePaintCell

		/// <summary>
		/// Raises the BeforePaintCell event
		/// </summary>
		/// <param name="e">A PaintCellEventArgs that contains the event data</param>
		protected virtual void OnBeforePaintCell(PaintCellEventArgs e)
		{
			if (BeforePaintCell != null)
			{
				BeforePaintCell(this, e);
			}
		}
开发者ID:nithinphilips,项目名称:SMOz,代码行数:11,代码来源:Table.cs

示例14: OnPaintCell

		/// <summary>
		/// Paints the Cell at the specified row and column indexes
		/// </summary>
		/// <param name="e">A PaintEventArgs that contains the event data</param>
		/// <param name="row">The index of the row that contains the cell to be painted</param>
		/// <param name="column">The index of the column that contains the cell to be painted</param>
		/// <param name="cellRect">The bounding Rectangle of the Cell</param>
		protected void OnPaintCell(PaintEventArgs e, int row, int column, Rectangle cellRect)
		{
			if (row == 0 && column == 1)
			{
				column = 1;
			}
			
			// get the renderer for the cells column
			ICellRenderer renderer = this.ColumnModel.Columns[column].Renderer;
			if (renderer == null)
			{
				// get the default renderer for the column
				renderer = this.ColumnModel.GetCellRenderer(this.ColumnModel.Columns[column].GetDefaultRendererName());
			}

			// if the renderer is still null (which it shouldn't)
			// the get out of here
			if (renderer == null)
			{
				return;
			}

			PaintCellEventArgs pcea = new PaintCellEventArgs(e.Graphics, cellRect);
			pcea.Graphics.SetClip(Rectangle.Intersect(e.ClipRectangle, cellRect));

			if (column < this.TableModel.Rows[row].Cells.Count)
			{
				// is the cell selected
				bool selected = false;

				if (this.FullRowSelect)
				{
					selected = this.TableModel.Selections.IsRowSelected(row);
				}
				else
				{
					if (this.SelectionStyle == SelectionStyle.ListView)
					{
						if (this.TableModel.Selections.IsRowSelected(row) && this.ColumnModel.PreviousVisibleColumn(column) == -1)
						{
							selected = true;
						}
					}
					else if (this.SelectionStyle == SelectionStyle.Grid)
					{
						if (this.TableModel.Selections.IsCellSelected(row, column))
						{
							selected = true;
						}
					}
				}

				//
				bool editable = this.TableModel[row, column].Editable && this.TableModel.Rows[row].Editable && this.ColumnModel.Columns[column].Editable;
				bool enabled = this.TableModel[row, column].Enabled && this.TableModel.Rows[row].Enabled && this.ColumnModel.Columns[column].Enabled;

				// draw the cell
				pcea.SetCell(this.TableModel[row, column]);
				pcea.SetRow(row);
				pcea.SetColumn(column);
				pcea.SetTable(this);
				pcea.SetSelected(selected);
				pcea.SetFocused(this.Focused && this.FocusedCell.Row == row && this.FocusedCell.Column == column);
				pcea.SetSorted(column == this.lastSortedColumn);
				pcea.SetEditable(editable);
				pcea.SetEnabled(enabled);
				pcea.SetCellRect(cellRect);
			}
			else
			{
				// there isn't a cell for this column, so send a 
				// null value for the cell and the renderer will 
				// take care of the rest (it should draw an empty cell)

				pcea.SetCell(null);
				pcea.SetRow(row);
				pcea.SetColumn(column);
				pcea.SetTable(this);
				pcea.SetSelected(false);
				pcea.SetFocused(false);
				pcea.SetSorted(false);
				pcea.SetEditable(false);
				pcea.SetEnabled(false);
				pcea.SetCellRect(cellRect);
			}

			// let the user get the first crack at painting the cell
			this.OnBeforePaintCell(pcea);
			
			// only send to the renderer if the user hasn't 
			// set the handled property
			if (!pcea.Handled)
			{
//.........这里部分代码省略.........
开发者ID:nithinphilips,项目名称:SMOz,代码行数:101,代码来源:Table.cs

示例15: OnPaintBackground

        /// <summary>
        /// Paints the Cells background
        /// </summary>
        /// <param name="e">A PaintCellEventArgs that contains the event data</param>
        protected override void OnPaintBackground(PaintCellEventArgs e)
        {
            base.OnPaintBackground(e);

            // don't bother going any further if the Cell is null
            if (e.Cell == null)
            {
                return;
            }

            if (this.ShowDropDownButton || (e.Table.IsEditing && e.CellPos == e.Table.EditingCell))
            {
                ComboBoxStates state = this.GetDropDownRendererData(e.Cell).ButtonState;

                if (!e.Enabled)
                {
                    state = ComboBoxStates.Disabled;
                }

                ThemeManager.DrawComboBoxButton(e.Graphics, this.CalcDropDownButtonBounds(), state);
            }
        }
开发者ID:chzh,项目名称:xrefresh,代码行数:26,代码来源:DropDownCellRenderer.cs


注:本文中的XPTable.Events.PaintCellEventArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。