Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewRowPostPaintEventArgs.cs / 1 / DataGridViewRowPostPaintEventArgs.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Windows.Forms
{
using System;
using System.Drawing;
using System.ComponentModel;
using System.Diagnostics;
///
public class DataGridViewRowPostPaintEventArgs : EventArgs
{
private DataGridView dataGridView;
private Graphics graphics;
private Rectangle clipBounds;
private Rectangle rowBounds;
private DataGridViewCellStyle inheritedRowStyle;
private int rowIndex;
private DataGridViewElementStates rowState;
private string errorText;
private bool isFirstDisplayedRow;
private bool isLastVisibleRow;
///
public DataGridViewRowPostPaintEventArgs(DataGridView dataGridView,
Graphics graphics,
Rectangle clipBounds,
Rectangle rowBounds,
int rowIndex,
DataGridViewElementStates rowState,
string errorText,
DataGridViewCellStyle inheritedRowStyle,
bool isFirstDisplayedRow,
bool isLastVisibleRow)
{
if (dataGridView == null)
{
throw new ArgumentNullException("dataGridView");
}
if (graphics == null)
{
throw new ArgumentNullException("graphics");
}
if (inheritedRowStyle == null)
{
throw new ArgumentNullException("inheritedRowStyle");
}
this.dataGridView = dataGridView;
this.graphics = graphics;
this.clipBounds = clipBounds;
this.rowBounds = rowBounds;
this.rowIndex = rowIndex;
this.rowState = rowState;
this.errorText = errorText;
this.inheritedRowStyle = inheritedRowStyle;
this.isFirstDisplayedRow = isFirstDisplayedRow;
this.isLastVisibleRow = isLastVisibleRow;
}
internal DataGridViewRowPostPaintEventArgs(DataGridView dataGridView)
{
Debug.Assert(dataGridView != null);
this.dataGridView = dataGridView;
}
///
public Rectangle ClipBounds
{
get
{
return this.clipBounds;
}
set
{
this.clipBounds = value;
}
}
///
public string ErrorText
{
get
{
return this.errorText;
}
}
///
public Graphics Graphics
{
get
{
return this.graphics;
}
}
///
public DataGridViewCellStyle InheritedRowStyle
{
get
{
return this.inheritedRowStyle;
}
}
///
public bool IsFirstDisplayedRow
{
get
{
return this.isFirstDisplayedRow;
}
}
///
public bool IsLastVisibleRow
{
get
{
return this.isLastVisibleRow;
}
}
///
public Rectangle RowBounds
{
get
{
return this.rowBounds;
}
}
///
public int RowIndex
{
get
{
return this.rowIndex;
}
}
///
public DataGridViewElementStates State
{
get
{
return this.rowState;
}
}
///
public void DrawFocus(Rectangle bounds, bool cellsPaintSelectionBackground)
{
if (this.rowIndex < 0 || this.rowIndex >= this.dataGridView.Rows.Count)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewElementPaintingEventArgs_RowIndexOutOfRange));
}
this.dataGridView.Rows.SharedRow(rowIndex).DrawFocus(this.graphics,
this.clipBounds,
bounds,
this.rowIndex,
this.rowState,
this.inheritedRowStyle,
cellsPaintSelectionBackground);
}
///
public void PaintCells(Rectangle clipBounds, DataGridViewPaintParts paintParts)
{
if (this.rowIndex < 0 || this.rowIndex >= this.dataGridView.Rows.Count)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewElementPaintingEventArgs_RowIndexOutOfRange));
}
this.dataGridView.Rows.SharedRow(rowIndex).PaintCells(this.graphics,
clipBounds,
this.rowBounds,
this.rowIndex,
this.rowState,
this.isFirstDisplayedRow,
this.isLastVisibleRow,
paintParts);
}
///
public void PaintCellsBackground(Rectangle clipBounds, bool cellsPaintSelectionBackground)
{
if (this.rowIndex < 0 || this.rowIndex >= this.dataGridView.Rows.Count)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewElementPaintingEventArgs_RowIndexOutOfRange));
}
DataGridViewPaintParts paintParts = DataGridViewPaintParts.Background | DataGridViewPaintParts.Border;
if (cellsPaintSelectionBackground)
{
paintParts |= DataGridViewPaintParts.SelectionBackground;
}
this.dataGridView.Rows.SharedRow(rowIndex).PaintCells(this.graphics,
clipBounds,
this.rowBounds,
this.rowIndex,
this.rowState,
this.isFirstDisplayedRow,
this.isLastVisibleRow,
paintParts);
}
///
public void PaintCellsContent(Rectangle clipBounds)
{
if (this.rowIndex < 0 || this.rowIndex >= this.dataGridView.Rows.Count)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewElementPaintingEventArgs_RowIndexOutOfRange));
}
this.dataGridView.Rows.SharedRow(rowIndex).PaintCells(this.graphics,
clipBounds,
this.rowBounds,
this.rowIndex,
this.rowState,
this.isFirstDisplayedRow,
this.isLastVisibleRow,
DataGridViewPaintParts.ContentBackground | DataGridViewPaintParts.ContentForeground | DataGridViewPaintParts.ErrorIcon);
}
///
public void PaintHeader(bool paintSelectionBackground)
{
DataGridViewPaintParts paintParts = DataGridViewPaintParts.Background | DataGridViewPaintParts.Border | DataGridViewPaintParts.ContentBackground | DataGridViewPaintParts.ContentForeground | DataGridViewPaintParts.ErrorIcon;
if (paintSelectionBackground)
{
paintParts |= DataGridViewPaintParts.SelectionBackground;
}
PaintHeader(paintParts);
}
///
public void PaintHeader(DataGridViewPaintParts paintParts)
{
if (this.rowIndex < 0 || this.rowIndex >= this.dataGridView.Rows.Count)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewElementPaintingEventArgs_RowIndexOutOfRange));
}
this.dataGridView.Rows.SharedRow(rowIndex).PaintHeader(this.graphics,
this.clipBounds,
this.rowBounds,
this.rowIndex,
this.rowState,
this.isFirstDisplayedRow,
this.isLastVisibleRow,
paintParts);
}
internal void SetProperties(Graphics graphics,
Rectangle clipBounds,
Rectangle rowBounds,
int rowIndex,
DataGridViewElementStates rowState,
string errorText,
DataGridViewCellStyle inheritedRowStyle,
bool isFirstDisplayedRow,
bool isLastVisibleRow)
{
Debug.Assert(graphics != null);
Debug.Assert(inheritedRowStyle != null);
this.graphics = graphics;
this.clipBounds = clipBounds;
this.rowBounds = rowBounds;
this.rowIndex = rowIndex;
this.rowState = rowState;
this.errorText = errorText;
this.inheritedRowStyle = inheritedRowStyle;
this.isFirstDisplayedRow = isFirstDisplayedRow;
this.isLastVisibleRow = isLastVisibleRow;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
namespace System.Windows.Forms
{
using System;
using System.Drawing;
using System.ComponentModel;
using System.Diagnostics;
///
public class DataGridViewRowPostPaintEventArgs : EventArgs
{
private DataGridView dataGridView;
private Graphics graphics;
private Rectangle clipBounds;
private Rectangle rowBounds;
private DataGridViewCellStyle inheritedRowStyle;
private int rowIndex;
private DataGridViewElementStates rowState;
private string errorText;
private bool isFirstDisplayedRow;
private bool isLastVisibleRow;
///
public DataGridViewRowPostPaintEventArgs(DataGridView dataGridView,
Graphics graphics,
Rectangle clipBounds,
Rectangle rowBounds,
int rowIndex,
DataGridViewElementStates rowState,
string errorText,
DataGridViewCellStyle inheritedRowStyle,
bool isFirstDisplayedRow,
bool isLastVisibleRow)
{
if (dataGridView == null)
{
throw new ArgumentNullException("dataGridView");
}
if (graphics == null)
{
throw new ArgumentNullException("graphics");
}
if (inheritedRowStyle == null)
{
throw new ArgumentNullException("inheritedRowStyle");
}
this.dataGridView = dataGridView;
this.graphics = graphics;
this.clipBounds = clipBounds;
this.rowBounds = rowBounds;
this.rowIndex = rowIndex;
this.rowState = rowState;
this.errorText = errorText;
this.inheritedRowStyle = inheritedRowStyle;
this.isFirstDisplayedRow = isFirstDisplayedRow;
this.isLastVisibleRow = isLastVisibleRow;
}
internal DataGridViewRowPostPaintEventArgs(DataGridView dataGridView)
{
Debug.Assert(dataGridView != null);
this.dataGridView = dataGridView;
}
///
public Rectangle ClipBounds
{
get
{
return this.clipBounds;
}
set
{
this.clipBounds = value;
}
}
///
public string ErrorText
{
get
{
return this.errorText;
}
}
///
public Graphics Graphics
{
get
{
return this.graphics;
}
}
///
public DataGridViewCellStyle InheritedRowStyle
{
get
{
return this.inheritedRowStyle;
}
}
///
public bool IsFirstDisplayedRow
{
get
{
return this.isFirstDisplayedRow;
}
}
///
public bool IsLastVisibleRow
{
get
{
return this.isLastVisibleRow;
}
}
///
public Rectangle RowBounds
{
get
{
return this.rowBounds;
}
}
///
public int RowIndex
{
get
{
return this.rowIndex;
}
}
///
public DataGridViewElementStates State
{
get
{
return this.rowState;
}
}
///
public void DrawFocus(Rectangle bounds, bool cellsPaintSelectionBackground)
{
if (this.rowIndex < 0 || this.rowIndex >= this.dataGridView.Rows.Count)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewElementPaintingEventArgs_RowIndexOutOfRange));
}
this.dataGridView.Rows.SharedRow(rowIndex).DrawFocus(this.graphics,
this.clipBounds,
bounds,
this.rowIndex,
this.rowState,
this.inheritedRowStyle,
cellsPaintSelectionBackground);
}
///
public void PaintCells(Rectangle clipBounds, DataGridViewPaintParts paintParts)
{
if (this.rowIndex < 0 || this.rowIndex >= this.dataGridView.Rows.Count)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewElementPaintingEventArgs_RowIndexOutOfRange));
}
this.dataGridView.Rows.SharedRow(rowIndex).PaintCells(this.graphics,
clipBounds,
this.rowBounds,
this.rowIndex,
this.rowState,
this.isFirstDisplayedRow,
this.isLastVisibleRow,
paintParts);
}
///
public void PaintCellsBackground(Rectangle clipBounds, bool cellsPaintSelectionBackground)
{
if (this.rowIndex < 0 || this.rowIndex >= this.dataGridView.Rows.Count)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewElementPaintingEventArgs_RowIndexOutOfRange));
}
DataGridViewPaintParts paintParts = DataGridViewPaintParts.Background | DataGridViewPaintParts.Border;
if (cellsPaintSelectionBackground)
{
paintParts |= DataGridViewPaintParts.SelectionBackground;
}
this.dataGridView.Rows.SharedRow(rowIndex).PaintCells(this.graphics,
clipBounds,
this.rowBounds,
this.rowIndex,
this.rowState,
this.isFirstDisplayedRow,
this.isLastVisibleRow,
paintParts);
}
///
public void PaintCellsContent(Rectangle clipBounds)
{
if (this.rowIndex < 0 || this.rowIndex >= this.dataGridView.Rows.Count)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewElementPaintingEventArgs_RowIndexOutOfRange));
}
this.dataGridView.Rows.SharedRow(rowIndex).PaintCells(this.graphics,
clipBounds,
this.rowBounds,
this.rowIndex,
this.rowState,
this.isFirstDisplayedRow,
this.isLastVisibleRow,
DataGridViewPaintParts.ContentBackground | DataGridViewPaintParts.ContentForeground | DataGridViewPaintParts.ErrorIcon);
}
///
public void PaintHeader(bool paintSelectionBackground)
{
DataGridViewPaintParts paintParts = DataGridViewPaintParts.Background | DataGridViewPaintParts.Border | DataGridViewPaintParts.ContentBackground | DataGridViewPaintParts.ContentForeground | DataGridViewPaintParts.ErrorIcon;
if (paintSelectionBackground)
{
paintParts |= DataGridViewPaintParts.SelectionBackground;
}
PaintHeader(paintParts);
}
///
public void PaintHeader(DataGridViewPaintParts paintParts)
{
if (this.rowIndex < 0 || this.rowIndex >= this.dataGridView.Rows.Count)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewElementPaintingEventArgs_RowIndexOutOfRange));
}
this.dataGridView.Rows.SharedRow(rowIndex).PaintHeader(this.graphics,
this.clipBounds,
this.rowBounds,
this.rowIndex,
this.rowState,
this.isFirstDisplayedRow,
this.isLastVisibleRow,
paintParts);
}
internal void SetProperties(Graphics graphics,
Rectangle clipBounds,
Rectangle rowBounds,
int rowIndex,
DataGridViewElementStates rowState,
string errorText,
DataGridViewCellStyle inheritedRowStyle,
bool isFirstDisplayedRow,
bool isLastVisibleRow)
{
Debug.Assert(graphics != null);
Debug.Assert(inheritedRowStyle != null);
this.graphics = graphics;
this.clipBounds = clipBounds;
this.rowBounds = rowBounds;
this.rowIndex = rowIndex;
this.rowState = rowState;
this.errorText = errorText;
this.inheritedRowStyle = inheritedRowStyle;
this.isFirstDisplayedRow = isFirstDisplayedRow;
this.isLastVisibleRow = isLastVisibleRow;
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- AndCondition.cs
- _Semaphore.cs
- LockCookie.cs
- BaseComponentEditor.cs
- FigureParaClient.cs
- RolePrincipal.cs
- Psha1DerivedKeyGenerator.cs
- OdbcConnectionFactory.cs
- EFAssociationProvider.cs
- DataGridRowEventArgs.cs
- EntityDataSource.cs
- UnicastIPAddressInformationCollection.cs
- TextAction.cs
- StrokeNodeOperations2.cs
- RelatedImageListAttribute.cs
- PointCollection.cs
- HttpGetProtocolImporter.cs
- ToolStripGrip.cs
- InheritedPropertyDescriptor.cs
- HttpModuleAction.cs
- MenuItem.cs
- ReliableSessionBindingElementImporter.cs
- _Win32.cs
- ContentFilePart.cs
- ChannelTraceRecord.cs
- XmlMapping.cs
- Type.cs
- WebErrorHandler.cs
- StubHelpers.cs
- NameSpaceEvent.cs
- AstTree.cs
- JournalEntryStack.cs
- ConfigurationCollectionAttribute.cs
- EventData.cs
- AttributeEmitter.cs
- ToolStripPanelSelectionGlyph.cs
- SweepDirectionValidation.cs
- PeerNameRegistration.cs
- JapaneseCalendar.cs
- ValueHandle.cs
- ScrollEventArgs.cs
- Vector3DAnimationBase.cs
- WebPartConnectionsEventArgs.cs
- FlowDocumentView.cs
- ClosureBinding.cs
- LinkUtilities.cs
- FileDetails.cs
- ActivationServices.cs
- XXXInfos.cs
- BindingExpressionUncommonField.cs
- XmlQueryRuntime.cs
- ReachDocumentSequenceSerializerAsync.cs
- Track.cs
- Style.cs
- ObjectTokenCategory.cs
- CapabilitiesRule.cs
- FileLoadException.cs
- HtmlAnchor.cs
- Panel.cs
- FontSizeConverter.cs
- TextParentUndoUnit.cs
- DataGridViewTextBoxEditingControl.cs
- SynchronousChannelMergeEnumerator.cs
- WebScriptMetadataFormatter.cs
- ClientSettings.cs
- MdiWindowListStrip.cs
- RoleService.cs
- XamlBrushSerializer.cs
- TaskFactory.cs
- WebPartRestoreVerb.cs
- PersonalizationAdministration.cs
- PointHitTestResult.cs
- FormParameter.cs
- CalendarButtonAutomationPeer.cs
- ObjectSet.cs
- PackWebResponse.cs
- SHA1Cng.cs
- CodeAccessSecurityEngine.cs
- ObjectQuery_EntitySqlExtensions.cs
- SmtpNtlmAuthenticationModule.cs
- SendMailErrorEventArgs.cs
- DataGridHelper.cs
- CapabilitiesRule.cs
- QueryHandler.cs
- TabletDeviceInfo.cs
- SendKeys.cs
- SelectorAutomationPeer.cs
- WindowsRegion.cs
- sqlstateclientmanager.cs
- TemplatedWizardStep.cs
- EntityModelSchemaGenerator.cs
- HtmlInputButton.cs
- BindingExpression.cs
- WindowsRichEdit.cs
- BindingOperations.cs
- ColorBlend.cs
- RecordConverter.cs
- CatalogPart.cs
- XmlQueryOutput.cs
- DesignerView.xaml.cs