Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewTopRowAccessibleObject.cs / 1305376 / 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
- CollectionsUtil.cs
- WebPartsSection.cs
- WindowsScrollBar.cs
- DataAdapter.cs
- GridViewCommandEventArgs.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- BevelBitmapEffect.cs
- TextDecorationLocationValidation.cs
- COM2IManagedPerPropertyBrowsingHandler.cs
- ProcessModule.cs
- AttachedPropertyInfo.cs
- DataGridViewCellEventArgs.cs
- ContainerAction.cs
- ImageSourceTypeConverter.cs
- serverconfig.cs
- util.cs
- FontDialog.cs
- TableAutomationPeer.cs
- HostProtectionException.cs
- CodeTypeMember.cs
- QilScopedVisitor.cs
- AtomServiceDocumentSerializer.cs
- TextStore.cs
- LowerCaseStringConverter.cs
- ValidatorCompatibilityHelper.cs
- Configuration.cs
- TextParagraphProperties.cs
- DocumentEventArgs.cs
- CqlIdentifiers.cs
- StrongNameSignatureInformation.cs
- SmtpCommands.cs
- SqlOuterApplyReducer.cs
- ToolStripTextBox.cs
- GcSettings.cs
- PkcsMisc.cs
- StaticFileHandler.cs
- TreeViewItemAutomationPeer.cs
- CorrelationResolver.cs
- FormViewUpdateEventArgs.cs
- XmlAnyElementAttributes.cs
- BaseComponentEditor.cs
- _BasicClient.cs
- CodeConditionStatement.cs
- XmlSchemaValidationException.cs
- TraceListener.cs
- RawStylusInputCustomData.cs
- wgx_commands.cs
- ImmutableDispatchRuntime.cs
- ConfigurationSettings.cs
- DataBoundControl.cs
- ToolboxBitmapAttribute.cs
- PersonalizationProvider.cs
- RequestCache.cs
- ServiceElementCollection.cs
- TextEditorCharacters.cs
- MULTI_QI.cs
- EraserBehavior.cs
- ColumnHeader.cs
- LinqDataView.cs
- COM2ColorConverter.cs
- CodeThrowExceptionStatement.cs
- OdbcCommandBuilder.cs
- TextPointerBase.cs
- SecurityUniqueId.cs
- EntityProviderFactory.cs
- cryptoapiTransform.cs
- GlyphingCache.cs
- QuaternionAnimationBase.cs
- XamlPointCollectionSerializer.cs
- ServerTooBusyException.cs
- SqlErrorCollection.cs
- TextEditorCopyPaste.cs
- WsatEtwTraceListener.cs
- GridViewSelectEventArgs.cs
- wmiprovider.cs
- StatusBarAutomationPeer.cs
- CryptoConfig.cs
- ScriptControlManager.cs
- ModelItem.cs
- Int64AnimationUsingKeyFrames.cs
- Descriptor.cs
- AppearanceEditorPart.cs
- BaseValidator.cs
- BrowserDefinition.cs
- GcSettings.cs
- KnowledgeBase.cs
- InputReportEventArgs.cs
- TextControl.cs
- TextEditorMouse.cs
- OperationParameterInfo.cs
- FormatSettings.cs
- SharedDp.cs
- SecureEnvironment.cs
- MessageRpc.cs
- DifferencingCollection.cs
- TextProperties.cs
- BindingValueChangedEventArgs.cs
- PointCollection.cs
- ReadingWritingEntityEventArgs.cs
- ToolStripSplitButton.cs