Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewTopRowAccessibleObject.cs / 1 / DataGridViewTopRowAccessibleObject.cs
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System.Security.Permissions;
using System.Drawing;
using System.Diagnostics;
namespace System.Windows.Forms
{
public partial class DataGridView
{
///
[
System.Runtime.InteropServices.ComVisible(true)
]
protected class DataGridViewTopRowAccessibleObject : AccessibleObject
{
DataGridView owner;
///
public DataGridViewTopRowAccessibleObject() : base()
{
}
///
public DataGridViewTopRowAccessibleObject(DataGridView owner) : base()
{
this.owner = owner;
}
///
public override Rectangle Bounds
{
get
{
if (this.owner == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerNotSet));
}
if (this.owner.ColumnHeadersVisible)
{
Rectangle rect = Rectangle.Union(this.owner.layout.ColumnHeaders, this.owner.layout.TopLeftHeader);
return this.owner.RectangleToScreen(rect);
}
else
{
return Rectangle.Empty;
}
}
}
///
public override string Name
{
get
{
return SR.GetString(SR.DataGridView_AccTopRow);
}
}
///
public DataGridView Owner
{
get
{
return this.owner;
}
set
{
if (this.owner != null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerAlreadySet));
}
this.owner = value;
}
}
///
public override AccessibleObject Parent
{
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
get
{
if (this.owner == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerNotSet));
}
return this.owner.AccessibilityObject;
}
}
///
public override AccessibleRole Role
{
get
{
return AccessibleRole.Row;
}
}
///
public override string Value
{
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
get
{
return this.Name;
}
}
///
public override AccessibleObject GetChild(int index)
{
if (this.owner == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerNotSet));
}
if (index < 0)
{
throw new ArgumentOutOfRangeException("index");
}
if (index == 0 && this.owner.RowHeadersVisible)
{
return this.owner.TopLeftHeaderCell.AccessibilityObject;
}
if (this.owner.RowHeadersVisible)
{
// decrement the index because the first child is the top left header cell
index --;
}
Debug.Assert(index >= 0);
if (index < this.owner.Columns.GetColumnCount(DataGridViewElementStates.Visible))
{
int actualColumnIndex = this.owner.Columns.ActualDisplayIndexToColumnIndex(index, DataGridViewElementStates.Visible);
return this.owner.Columns[actualColumnIndex].HeaderCell.AccessibilityObject;
}
else
{
return null;
}
}
///
public override int GetChildCount()
{
if (this.owner == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerNotSet));
}
int result = this.owner.Columns.GetColumnCount(DataGridViewElementStates.Visible);
if (this.owner.RowHeadersVisible)
{
// + 1 is the top left header cell accessibility object
result ++;
}
return result;
}
///
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public override AccessibleObject Navigate(AccessibleNavigation navigationDirection)
{
if (this.owner == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerNotSet));
}
switch (navigationDirection)
{
case AccessibleNavigation.Down:
case AccessibleNavigation.Next:
if (this.owner.AccessibilityObject.GetChildCount() > 1)
{
return this.owner.AccessibilityObject.GetChild(1);
}
else
{
return null;
}
case AccessibleNavigation.FirstChild:
return this.GetChild(0);
case AccessibleNavigation.LastChild:
return this.GetChild(this.GetChildCount() - 1);
default:
return null;
}
}
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//-----------------------------------------------------------------------------
using System.Security.Permissions;
using System.Drawing;
using System.Diagnostics;
namespace System.Windows.Forms
{
public partial class DataGridView
{
///
[
System.Runtime.InteropServices.ComVisible(true)
]
protected class DataGridViewTopRowAccessibleObject : AccessibleObject
{
DataGridView owner;
///
public DataGridViewTopRowAccessibleObject() : base()
{
}
///
public DataGridViewTopRowAccessibleObject(DataGridView owner) : base()
{
this.owner = owner;
}
///
public override Rectangle Bounds
{
get
{
if (this.owner == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerNotSet));
}
if (this.owner.ColumnHeadersVisible)
{
Rectangle rect = Rectangle.Union(this.owner.layout.ColumnHeaders, this.owner.layout.TopLeftHeader);
return this.owner.RectangleToScreen(rect);
}
else
{
return Rectangle.Empty;
}
}
}
///
public override string Name
{
get
{
return SR.GetString(SR.DataGridView_AccTopRow);
}
}
///
public DataGridView Owner
{
get
{
return this.owner;
}
set
{
if (this.owner != null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerAlreadySet));
}
this.owner = value;
}
}
///
public override AccessibleObject Parent
{
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
get
{
if (this.owner == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerNotSet));
}
return this.owner.AccessibilityObject;
}
}
///
public override AccessibleRole Role
{
get
{
return AccessibleRole.Row;
}
}
///
public override string Value
{
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
get
{
return this.Name;
}
}
///
public override AccessibleObject GetChild(int index)
{
if (this.owner == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerNotSet));
}
if (index < 0)
{
throw new ArgumentOutOfRangeException("index");
}
if (index == 0 && this.owner.RowHeadersVisible)
{
return this.owner.TopLeftHeaderCell.AccessibilityObject;
}
if (this.owner.RowHeadersVisible)
{
// decrement the index because the first child is the top left header cell
index --;
}
Debug.Assert(index >= 0);
if (index < this.owner.Columns.GetColumnCount(DataGridViewElementStates.Visible))
{
int actualColumnIndex = this.owner.Columns.ActualDisplayIndexToColumnIndex(index, DataGridViewElementStates.Visible);
return this.owner.Columns[actualColumnIndex].HeaderCell.AccessibilityObject;
}
else
{
return null;
}
}
///
public override int GetChildCount()
{
if (this.owner == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerNotSet));
}
int result = this.owner.Columns.GetColumnCount(DataGridViewElementStates.Visible);
if (this.owner.RowHeadersVisible)
{
// + 1 is the top left header cell accessibility object
result ++;
}
return result;
}
///
[SecurityPermission(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
public override AccessibleObject Navigate(AccessibleNavigation navigationDirection)
{
if (this.owner == null)
{
throw new InvalidOperationException(SR.GetString(SR.DataGridViewTopRowAccessibleObject_OwnerNotSet));
}
switch (navigationDirection)
{
case AccessibleNavigation.Down:
case AccessibleNavigation.Next:
if (this.owner.AccessibilityObject.GetChildCount() > 1)
{
return this.owner.AccessibilityObject.GetChild(1);
}
else
{
return null;
}
case AccessibleNavigation.FirstChild:
return this.GetChild(0);
case AccessibleNavigation.LastChild:
return this.GetChild(this.GetChildCount() - 1);
default:
return null;
}
}
}
}
}
// 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
- SQLDoubleStorage.cs
- EncoderParameter.cs
- BezierSegment.cs
- MobileResource.cs
- OleDbTransaction.cs
- StructuralCache.cs
- ConfigXmlDocument.cs
- ExtensionDataObject.cs
- BindingNavigator.cs
- FileDialog_Vista.cs
- SafeEventHandle.cs
- MarkupCompiler.cs
- DataGridViewSortCompareEventArgs.cs
- Part.cs
- CurrentTimeZone.cs
- OleDbTransaction.cs
- MessageAction.cs
- LogLogRecordEnumerator.cs
- DetailsView.cs
- _Connection.cs
- ACL.cs
- DbResourceAllocator.cs
- HostedTransportConfigurationManager.cs
- BitmapPalettes.cs
- XmlObjectSerializerWriteContext.cs
- DocumentStatusResources.cs
- MethodExpression.cs
- ThemeDirectoryCompiler.cs
- CharAnimationUsingKeyFrames.cs
- ColorComboBox.cs
- ChangesetResponse.cs
- ComboBoxItem.cs
- XsdCachingReader.cs
- InstanceHandleConflictException.cs
- FilteredAttributeCollection.cs
- Metadata.cs
- PolicyValidator.cs
- SmiEventSink_Default.cs
- FontResourceCache.cs
- FormsAuthenticationUserCollection.cs
- Axis.cs
- CompositeScriptReference.cs
- RequestResponse.cs
- NotifyInputEventArgs.cs
- CaseInsensitiveHashCodeProvider.cs
- FontStyle.cs
- EventBuilder.cs
- CacheMemory.cs
- WebPartConnectionCollection.cs
- SqlPersonalizationProvider.cs
- OrderedHashRepartitionEnumerator.cs
- MessageBox.cs
- PeerHelpers.cs
- SimpleMailWebEventProvider.cs
- LinkButton.cs
- HttpNamespaceReservationInstallComponent.cs
- ObjectAnimationUsingKeyFrames.cs
- CipherData.cs
- EncoderNLS.cs
- QueryTaskGroupState.cs
- CompoundFileStorageReference.cs
- ColorKeyFrameCollection.cs
- X509Certificate.cs
- FigureParagraph.cs
- XPathException.cs
- Icon.cs
- DragDeltaEventArgs.cs
- OleDbFactory.cs
- Model3D.cs
- NamespaceInfo.cs
- SByteConverter.cs
- EventPrivateKey.cs
- DataSvcMapFile.cs
- _OSSOCK.cs
- XPathMultyIterator.cs
- StaticContext.cs
- IsolationInterop.cs
- HostProtectionException.cs
- BackgroundFormatInfo.cs
- ObjectDisposedException.cs
- ProfileGroupSettings.cs
- PersonalizationAdministration.cs
- EntityDataSourceSelectedEventArgs.cs
- ProxyManager.cs
- ReadOnlyDictionary.cs
- NoResizeSelectionBorderGlyph.cs
- CompositionTarget.cs
- TrackingMemoryStream.cs
- SqlDataSourceParameterParser.cs
- SiteMapPathDesigner.cs
- XmlWrappingReader.cs
- ToolStripArrowRenderEventArgs.cs
- MsmqElementBase.cs
- ResourceProviderFactory.cs
- CodeAttributeArgumentCollection.cs
- ColorInterpolationModeValidation.cs
- LookupBindingPropertiesAttribute.cs
- X509Extension.cs
- MediaContext.cs
- LineGeometry.cs