Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewRowPrePaintEventArgs.cs / 1305376 / DataGridViewRowPrePaintEventArgs.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 DataGridViewRowPrePaintEventArgs : HandledEventArgs { 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; private DataGridViewPaintParts paintParts; /// public DataGridViewRowPrePaintEventArgs(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; this.paintParts = DataGridViewPaintParts.All; } internal DataGridViewRowPrePaintEventArgs(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 DataGridViewPaintParts PaintParts { get { return this.paintParts; } set { if ((value & ~DataGridViewPaintParts.All) != 0) { throw new ArgumentException(SR.GetString(SR.DataGridView_InvalidDataGridViewPaintPartsCombination, "value")); } this.paintParts = value; } } /// 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(this.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(this.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(this.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(this.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(this.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; this.paintParts = DataGridViewPaintParts.All; this.Handled = false; } } } // 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 DataGridViewRowPrePaintEventArgs : HandledEventArgs { 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; private DataGridViewPaintParts paintParts; /// public DataGridViewRowPrePaintEventArgs(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; this.paintParts = DataGridViewPaintParts.All; } internal DataGridViewRowPrePaintEventArgs(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 DataGridViewPaintParts PaintParts { get { return this.paintParts; } set { if ((value & ~DataGridViewPaintParts.All) != 0) { throw new ArgumentException(SR.GetString(SR.DataGridView_InvalidDataGridViewPaintPartsCombination, "value")); } this.paintParts = value; } } /// 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(this.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(this.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(this.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(this.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(this.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; this.paintParts = DataGridViewPaintParts.All; this.Handled = false; } } } // 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
- ProtectedConfigurationSection.cs
- CodeGenerator.cs
- SqlTrackingWorkflowInstance.cs
- InkCanvasSelectionAdorner.cs
- AppModelKnownContentFactory.cs
- MimeMapping.cs
- SQLDouble.cs
- ButtonPopupAdapter.cs
- StyleHelper.cs
- EventLogPermissionEntryCollection.cs
- AppSettingsExpressionEditor.cs
- DataGridHeaderBorder.cs
- AnnotationHighlightLayer.cs
- ToolStripDropDown.cs
- DropDownButton.cs
- TextReturnReader.cs
- TextEndOfSegment.cs
- Mappings.cs
- CodeEventReferenceExpression.cs
- XmlBoundElement.cs
- WindowsContainer.cs
- TextTreeInsertUndoUnit.cs
- CqlQuery.cs
- InternalConfirm.cs
- InternalDispatchObject.cs
- StackOverflowException.cs
- WebPartDescriptionCollection.cs
- MethodBuilder.cs
- While.cs
- COAUTHINFO.cs
- VectorKeyFrameCollection.cs
- BasicHttpSecurity.cs
- DataGridViewButtonCell.cs
- AsynchronousChannelMergeEnumerator.cs
- Journal.cs
- XmlAnyElementAttribute.cs
- XmlSchemaSimpleTypeList.cs
- ObjectFullSpanRewriter.cs
- ConfigurationLocationCollection.cs
- WebPartConnectionsEventArgs.cs
- SerializationFieldInfo.cs
- RectangleF.cs
- DiscoveryEndpointValidator.cs
- InheritanceService.cs
- CachedResourceDictionaryExtension.cs
- RequiredFieldValidator.cs
- XAMLParseException.cs
- SpecialNameAttribute.cs
- AppDomainAttributes.cs
- UserControlParser.cs
- ProtocolsInstallComponent.cs
- PointLight.cs
- Cell.cs
- TypeGenericEnumerableViewSchema.cs
- EngineSite.cs
- SmiContextFactory.cs
- ErrorInfoXmlDocument.cs
- Calendar.cs
- StreamGeometry.cs
- HtmlDocument.cs
- BaseTemplateParser.cs
- AsyncMethodInvoker.cs
- AvTraceDetails.cs
- TdsParserSafeHandles.cs
- DefinitionProperties.cs
- DateTimeConverter.cs
- FontNameEditor.cs
- TextWriterTraceListener.cs
- ServicePoint.cs
- log.cs
- DateTimeOffset.cs
- D3DImage.cs
- TextServicesPropertyRanges.cs
- StringOutput.cs
- wmiprovider.cs
- Splitter.cs
- TableRow.cs
- AuthorizationRuleCollection.cs
- TransformValueSerializer.cs
- ZipIOExtraField.cs
- ErrorWrapper.cs
- ResetableIterator.cs
- Dump.cs
- KeyValueConfigurationElement.cs
- configsystem.cs
- XmlSchemaSimpleTypeRestriction.cs
- XmlSchemaSimpleContentRestriction.cs
- DocumentViewerBaseAutomationPeer.cs
- EntitySetBase.cs
- FixedHyperLink.cs
- ItemContainerGenerator.cs
- DbConvert.cs
- TextRangeProviderWrapper.cs
- BitmapEffectGroup.cs
- CollectionEditVerbManager.cs
- MarkerProperties.cs
- BoolLiteral.cs
- TTSVoice.cs
- LabelAutomationPeer.cs
- sqlpipe.cs