Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / WinForms / Managed / System / WinForms / DataGridViewAdvancedBorderStyle.cs / 1 / DataGridViewAdvancedBorderStyle.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Windows.Forms { using System; using System.Diagnostics; using System.ComponentModel; ///public sealed class DataGridViewAdvancedBorderStyle : ICloneable { private DataGridView owner; private bool all = true; private DataGridViewAdvancedCellBorderStyle banned1, banned2, banned3; private DataGridViewAdvancedCellBorderStyle top = DataGridViewAdvancedCellBorderStyle.None; private DataGridViewAdvancedCellBorderStyle left = DataGridViewAdvancedCellBorderStyle.None; private DataGridViewAdvancedCellBorderStyle right = DataGridViewAdvancedCellBorderStyle.None; private DataGridViewAdvancedCellBorderStyle bottom = DataGridViewAdvancedCellBorderStyle.None; /// public DataGridViewAdvancedBorderStyle() : this(null, DataGridViewAdvancedCellBorderStyle.NotSet, DataGridViewAdvancedCellBorderStyle.NotSet, DataGridViewAdvancedCellBorderStyle.NotSet) { } internal DataGridViewAdvancedBorderStyle(DataGridView owner) : this(owner, DataGridViewAdvancedCellBorderStyle.NotSet, DataGridViewAdvancedCellBorderStyle.NotSet, DataGridViewAdvancedCellBorderStyle.NotSet) { } /// /// Creates a new DataGridViewAdvancedBorderStyle. The specified owner will /// be notified when the values are changed. /// internal DataGridViewAdvancedBorderStyle(DataGridView owner, DataGridViewAdvancedCellBorderStyle banned1, DataGridViewAdvancedCellBorderStyle banned2, DataGridViewAdvancedCellBorderStyle banned3) { this.owner = owner; this.banned1 = banned1; this.banned2 = banned2; this.banned3 = banned3; } ///public DataGridViewAdvancedCellBorderStyle All { get { return this.all ? this.top : DataGridViewAdvancedCellBorderStyle.NotSet; } set { // Sequential enum. Valid values are 0x0 to 0x7 if (!ClientUtils.IsEnumValid(value, (int)value, (int)DataGridViewAdvancedCellBorderStyle.NotSet, (int)DataGridViewAdvancedCellBorderStyle.OutsetPartial)) { throw new InvalidEnumArgumentException("value", (int)value, typeof(DataGridViewAdvancedCellBorderStyle)); } if (value == DataGridViewAdvancedCellBorderStyle.NotSet || value == this.banned1 || value == this.banned2 || value == this.banned3) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "All")); } if (!this.all || this.top != value) { this.all = true; this.top = this.left = this.right = this.bottom = value; if (this.owner != null) { this.owner.OnAdvancedBorderStyleChanged(this); } } } } /// public DataGridViewAdvancedCellBorderStyle Bottom { get { if (this.all) { return this.top; } return this.bottom; } set { // Sequential enum. Valid values are 0x0 to 0x7 if (!ClientUtils.IsEnumValid(value, (int)value, (int)DataGridViewAdvancedCellBorderStyle.NotSet, (int)DataGridViewAdvancedCellBorderStyle.OutsetPartial)) { throw new InvalidEnumArgumentException("value", (int)value, typeof(DataGridViewAdvancedCellBorderStyle)); } if (value == DataGridViewAdvancedCellBorderStyle.NotSet) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Bottom")); } this.BottomInternal = value; } } internal DataGridViewAdvancedCellBorderStyle BottomInternal { set { //Debug.Assert(Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)); //Debug.Assert(value != DataGridViewAdvancedCellBorderStyle.NotSet); if ((this.all && this.top != value) || (!this.all && this.bottom != value)) { if (this.all) { if (this.right == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.right = DataGridViewAdvancedCellBorderStyle.Outset; } } this.all = false; this.bottom = value; if (this.owner != null) { this.owner.OnAdvancedBorderStyleChanged(this); } } } } /// public DataGridViewAdvancedCellBorderStyle Left { get { if (this.all) { return this.top; } return this.left; } set { // Sequential enum. Valid values are 0x0 to 0x7 if (!ClientUtils.IsEnumValid(value, (int)value, (int)DataGridViewAdvancedCellBorderStyle.NotSet, (int)DataGridViewAdvancedCellBorderStyle.OutsetPartial)) { throw new InvalidEnumArgumentException("value", (int)value, typeof(DataGridViewAdvancedCellBorderStyle)); } if (value == DataGridViewAdvancedCellBorderStyle.NotSet) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Left")); } this.LeftInternal = value; } } internal DataGridViewAdvancedCellBorderStyle LeftInternal { set { //Debug.Assert(Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)); //Debug.Assert(value != DataGridViewAdvancedCellBorderStyle.NotSet); if ((this.all && this.top != value) || (!this.all && this.left != value)) { if ((this.owner != null && this.owner.RightToLeftInternal) && (value == DataGridViewAdvancedCellBorderStyle.InsetDouble || value == DataGridViewAdvancedCellBorderStyle.OutsetDouble)) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Left")); } if (this.all) { if (this.right == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.right = DataGridViewAdvancedCellBorderStyle.Outset; } if (this.bottom == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.bottom = DataGridViewAdvancedCellBorderStyle.Outset; } } this.all = false; this.left = value; if (this.owner != null) { this.owner.OnAdvancedBorderStyleChanged(this); } } } } /// public DataGridViewAdvancedCellBorderStyle Right { get { if (this.all) { return this.top; } return this.right; } set { // Sequential enum. Valid values are 0x0 to 0x7 if (!ClientUtils.IsEnumValid(value, (int)value, (int)DataGridViewAdvancedCellBorderStyle.NotSet, (int)DataGridViewAdvancedCellBorderStyle.OutsetPartial)) { throw new InvalidEnumArgumentException("value", (int)value, typeof(DataGridViewAdvancedCellBorderStyle)); } if (value == DataGridViewAdvancedCellBorderStyle.NotSet) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Right")); } this.RightInternal = value; } } internal DataGridViewAdvancedCellBorderStyle RightInternal { set { //Debug.Assert(Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)); //Debug.Assert(value != DataGridViewAdvancedCellBorderStyle.NotSet); if ((this.all && this.top != value) || (!this.all && this.right != value)) { if ((this.owner != null && !this.owner.RightToLeftInternal) && (value == DataGridViewAdvancedCellBorderStyle.InsetDouble || value == DataGridViewAdvancedCellBorderStyle.OutsetDouble)) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Right")); } if (this.all) { if (this.bottom == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.bottom = DataGridViewAdvancedCellBorderStyle.Outset; } } this.all = false; this.right = value; if (this.owner != null) { this.owner.OnAdvancedBorderStyleChanged(this); } } } } /// public DataGridViewAdvancedCellBorderStyle Top { get { return this.top; } set { // Sequential enum. Valid values are 0x0 to 0x7 if (!ClientUtils.IsEnumValid(value, (int)value, (int)DataGridViewAdvancedCellBorderStyle.NotSet, (int)DataGridViewAdvancedCellBorderStyle.OutsetPartial)) { throw new InvalidEnumArgumentException("value", (int)value, typeof(DataGridViewAdvancedCellBorderStyle)); } if (value == DataGridViewAdvancedCellBorderStyle.NotSet) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Top")); } this.TopInternal = value; } } internal DataGridViewAdvancedCellBorderStyle TopInternal { set { //Debug.Assert(Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)); //Debug.Assert(value != DataGridViewAdvancedCellBorderStyle.NotSet); if ((this.all && this.top != value) || (!this.all && this.top != value)) { if (this.all) { if (this.right == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.right = DataGridViewAdvancedCellBorderStyle.Outset; } if (this.bottom == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.bottom = DataGridViewAdvancedCellBorderStyle.Outset; } } this.all = false; this.top = value; if (this.owner != null) { this.owner.OnAdvancedBorderStyleChanged(this); } } } } /// /// public override bool Equals(object other) { DataGridViewAdvancedBorderStyle dgvabsOther = other as DataGridViewAdvancedBorderStyle; if (dgvabsOther == null) { return false; } return dgvabsOther.all == this.all && dgvabsOther.top == this.top && dgvabsOther.left == this.left && dgvabsOther.bottom == this.bottom && dgvabsOther.right == this.right; } /// /// public override int GetHashCode() { return WindowsFormsUtils.GetCombinedHashCodes((int) this.top, (int) this.left, (int) this.bottom, (int) this.right); } /// /// public override string ToString() { return "DataGridViewAdvancedBorderStyle { All=" + this.All.ToString() + ", Left=" + this.Left.ToString() + ", Right=" + this.Right.ToString() + ", Top=" + this.Top.ToString() + ", Bottom=" + this.Bottom.ToString() + " }"; } /// /// object ICloneable.Clone() { DataGridViewAdvancedBorderStyle dgvabs = new DataGridViewAdvancedBorderStyle(this.owner, this.banned1, this.banned2, this.banned3); dgvabs.all = this.all; dgvabs.top = this.top; dgvabs.right = this.right; dgvabs.bottom = this.bottom; dgvabs.left = this.left; return dgvabs; } } } // 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.Diagnostics; using System.ComponentModel; ///public sealed class DataGridViewAdvancedBorderStyle : ICloneable { private DataGridView owner; private bool all = true; private DataGridViewAdvancedCellBorderStyle banned1, banned2, banned3; private DataGridViewAdvancedCellBorderStyle top = DataGridViewAdvancedCellBorderStyle.None; private DataGridViewAdvancedCellBorderStyle left = DataGridViewAdvancedCellBorderStyle.None; private DataGridViewAdvancedCellBorderStyle right = DataGridViewAdvancedCellBorderStyle.None; private DataGridViewAdvancedCellBorderStyle bottom = DataGridViewAdvancedCellBorderStyle.None; /// public DataGridViewAdvancedBorderStyle() : this(null, DataGridViewAdvancedCellBorderStyle.NotSet, DataGridViewAdvancedCellBorderStyle.NotSet, DataGridViewAdvancedCellBorderStyle.NotSet) { } internal DataGridViewAdvancedBorderStyle(DataGridView owner) : this(owner, DataGridViewAdvancedCellBorderStyle.NotSet, DataGridViewAdvancedCellBorderStyle.NotSet, DataGridViewAdvancedCellBorderStyle.NotSet) { } /// /// Creates a new DataGridViewAdvancedBorderStyle. The specified owner will /// be notified when the values are changed. /// internal DataGridViewAdvancedBorderStyle(DataGridView owner, DataGridViewAdvancedCellBorderStyle banned1, DataGridViewAdvancedCellBorderStyle banned2, DataGridViewAdvancedCellBorderStyle banned3) { this.owner = owner; this.banned1 = banned1; this.banned2 = banned2; this.banned3 = banned3; } ///public DataGridViewAdvancedCellBorderStyle All { get { return this.all ? this.top : DataGridViewAdvancedCellBorderStyle.NotSet; } set { // Sequential enum. Valid values are 0x0 to 0x7 if (!ClientUtils.IsEnumValid(value, (int)value, (int)DataGridViewAdvancedCellBorderStyle.NotSet, (int)DataGridViewAdvancedCellBorderStyle.OutsetPartial)) { throw new InvalidEnumArgumentException("value", (int)value, typeof(DataGridViewAdvancedCellBorderStyle)); } if (value == DataGridViewAdvancedCellBorderStyle.NotSet || value == this.banned1 || value == this.banned2 || value == this.banned3) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "All")); } if (!this.all || this.top != value) { this.all = true; this.top = this.left = this.right = this.bottom = value; if (this.owner != null) { this.owner.OnAdvancedBorderStyleChanged(this); } } } } /// public DataGridViewAdvancedCellBorderStyle Bottom { get { if (this.all) { return this.top; } return this.bottom; } set { // Sequential enum. Valid values are 0x0 to 0x7 if (!ClientUtils.IsEnumValid(value, (int)value, (int)DataGridViewAdvancedCellBorderStyle.NotSet, (int)DataGridViewAdvancedCellBorderStyle.OutsetPartial)) { throw new InvalidEnumArgumentException("value", (int)value, typeof(DataGridViewAdvancedCellBorderStyle)); } if (value == DataGridViewAdvancedCellBorderStyle.NotSet) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Bottom")); } this.BottomInternal = value; } } internal DataGridViewAdvancedCellBorderStyle BottomInternal { set { //Debug.Assert(Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)); //Debug.Assert(value != DataGridViewAdvancedCellBorderStyle.NotSet); if ((this.all && this.top != value) || (!this.all && this.bottom != value)) { if (this.all) { if (this.right == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.right = DataGridViewAdvancedCellBorderStyle.Outset; } } this.all = false; this.bottom = value; if (this.owner != null) { this.owner.OnAdvancedBorderStyleChanged(this); } } } } /// public DataGridViewAdvancedCellBorderStyle Left { get { if (this.all) { return this.top; } return this.left; } set { // Sequential enum. Valid values are 0x0 to 0x7 if (!ClientUtils.IsEnumValid(value, (int)value, (int)DataGridViewAdvancedCellBorderStyle.NotSet, (int)DataGridViewAdvancedCellBorderStyle.OutsetPartial)) { throw new InvalidEnumArgumentException("value", (int)value, typeof(DataGridViewAdvancedCellBorderStyle)); } if (value == DataGridViewAdvancedCellBorderStyle.NotSet) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Left")); } this.LeftInternal = value; } } internal DataGridViewAdvancedCellBorderStyle LeftInternal { set { //Debug.Assert(Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)); //Debug.Assert(value != DataGridViewAdvancedCellBorderStyle.NotSet); if ((this.all && this.top != value) || (!this.all && this.left != value)) { if ((this.owner != null && this.owner.RightToLeftInternal) && (value == DataGridViewAdvancedCellBorderStyle.InsetDouble || value == DataGridViewAdvancedCellBorderStyle.OutsetDouble)) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Left")); } if (this.all) { if (this.right == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.right = DataGridViewAdvancedCellBorderStyle.Outset; } if (this.bottom == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.bottom = DataGridViewAdvancedCellBorderStyle.Outset; } } this.all = false; this.left = value; if (this.owner != null) { this.owner.OnAdvancedBorderStyleChanged(this); } } } } /// public DataGridViewAdvancedCellBorderStyle Right { get { if (this.all) { return this.top; } return this.right; } set { // Sequential enum. Valid values are 0x0 to 0x7 if (!ClientUtils.IsEnumValid(value, (int)value, (int)DataGridViewAdvancedCellBorderStyle.NotSet, (int)DataGridViewAdvancedCellBorderStyle.OutsetPartial)) { throw new InvalidEnumArgumentException("value", (int)value, typeof(DataGridViewAdvancedCellBorderStyle)); } if (value == DataGridViewAdvancedCellBorderStyle.NotSet) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Right")); } this.RightInternal = value; } } internal DataGridViewAdvancedCellBorderStyle RightInternal { set { //Debug.Assert(Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)); //Debug.Assert(value != DataGridViewAdvancedCellBorderStyle.NotSet); if ((this.all && this.top != value) || (!this.all && this.right != value)) { if ((this.owner != null && !this.owner.RightToLeftInternal) && (value == DataGridViewAdvancedCellBorderStyle.InsetDouble || value == DataGridViewAdvancedCellBorderStyle.OutsetDouble)) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Right")); } if (this.all) { if (this.bottom == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.bottom = DataGridViewAdvancedCellBorderStyle.Outset; } } this.all = false; this.right = value; if (this.owner != null) { this.owner.OnAdvancedBorderStyleChanged(this); } } } } /// public DataGridViewAdvancedCellBorderStyle Top { get { return this.top; } set { // Sequential enum. Valid values are 0x0 to 0x7 if (!ClientUtils.IsEnumValid(value, (int)value, (int)DataGridViewAdvancedCellBorderStyle.NotSet, (int)DataGridViewAdvancedCellBorderStyle.OutsetPartial)) { throw new InvalidEnumArgumentException("value", (int)value, typeof(DataGridViewAdvancedCellBorderStyle)); } if (value == DataGridViewAdvancedCellBorderStyle.NotSet) { throw new ArgumentException(SR.GetString(SR.DataGridView_AdvancedCellBorderStyleInvalid, "Top")); } this.TopInternal = value; } } internal DataGridViewAdvancedCellBorderStyle TopInternal { set { //Debug.Assert(Enum.IsDefined(typeof(DataGridViewAdvancedCellBorderStyle), value)); //Debug.Assert(value != DataGridViewAdvancedCellBorderStyle.NotSet); if ((this.all && this.top != value) || (!this.all && this.top != value)) { if (this.all) { if (this.right == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.right = DataGridViewAdvancedCellBorderStyle.Outset; } if (this.bottom == DataGridViewAdvancedCellBorderStyle.OutsetDouble) { this.bottom = DataGridViewAdvancedCellBorderStyle.Outset; } } this.all = false; this.top = value; if (this.owner != null) { this.owner.OnAdvancedBorderStyleChanged(this); } } } } /// /// public override bool Equals(object other) { DataGridViewAdvancedBorderStyle dgvabsOther = other as DataGridViewAdvancedBorderStyle; if (dgvabsOther == null) { return false; } return dgvabsOther.all == this.all && dgvabsOther.top == this.top && dgvabsOther.left == this.left && dgvabsOther.bottom == this.bottom && dgvabsOther.right == this.right; } /// /// public override int GetHashCode() { return WindowsFormsUtils.GetCombinedHashCodes((int) this.top, (int) this.left, (int) this.bottom, (int) this.right); } /// /// public override string ToString() { return "DataGridViewAdvancedBorderStyle { All=" + this.All.ToString() + ", Left=" + this.Left.ToString() + ", Right=" + this.Right.ToString() + ", Top=" + this.Top.ToString() + ", Bottom=" + this.Bottom.ToString() + " }"; } /// /// object ICloneable.Clone() { DataGridViewAdvancedBorderStyle dgvabs = new DataGridViewAdvancedBorderStyle(this.owner, this.banned1, this.banned2, this.banned3); dgvabs.all = this.all; dgvabs.top = this.top; dgvabs.right = this.right; dgvabs.bottom = this.bottom; dgvabs.left = this.left; return dgvabs; } } } // 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
- Matrix3DConverter.cs
- WebServiceEndpoint.cs
- ScopelessEnumAttribute.cs
- FileDialogCustomPlacesCollection.cs
- HttpRequestCacheValidator.cs
- CatalogPartChrome.cs
- HScrollProperties.cs
- Glyph.cs
- CodeNamespaceImport.cs
- XmlArrayItemAttribute.cs
- XMLSyntaxException.cs
- XmlWriter.cs
- IDictionary.cs
- DeclaredTypeElementCollection.cs
- TextContainer.cs
- ClientScriptManagerWrapper.cs
- configsystem.cs
- StrokeFIndices.cs
- HashFinalRequest.cs
- TableRowGroup.cs
- UncommonField.cs
- BinaryObjectInfo.cs
- Inflater.cs
- ObjectDataSourceEventArgs.cs
- VirtualDirectoryMapping.cs
- Attributes.cs
- EventLogRecord.cs
- MimeTypeAttribute.cs
- CalendarDateChangedEventArgs.cs
- ListViewInsertedEventArgs.cs
- UnknownWrapper.cs
- cookie.cs
- ModifierKeysValueSerializer.cs
- TaskFileService.cs
- OLEDB_Enum.cs
- DockEditor.cs
- XmlJsonWriter.cs
- RadioButton.cs
- Int32Animation.cs
- WebConfigurationManager.cs
- QilList.cs
- LoginCancelEventArgs.cs
- TCPListener.cs
- Pair.cs
- EndpointInfoCollection.cs
- OrderingInfo.cs
- ConfigXmlAttribute.cs
- LockRecursionException.cs
- InvokeGenerator.cs
- StorageEntityTypeMapping.cs
- DateTimeParse.cs
- TextAction.cs
- WindowsListViewGroupSubsetLink.cs
- Registry.cs
- AnimatedTypeHelpers.cs
- OleDbConnectionPoolGroupProviderInfo.cs
- SmiMetaData.cs
- WebBrowserHelper.cs
- CompilerCollection.cs
- ActivityStatusChangeEventArgs.cs
- ExpressionBuilderContext.cs
- InterleavedZipPartStream.cs
- Panel.cs
- TextTreeRootTextBlock.cs
- BindingValueChangedEventArgs.cs
- PropertyDescriptorCollection.cs
- ResXResourceSet.cs
- CodeNamespace.cs
- FillErrorEventArgs.cs
- DBConnectionString.cs
- VersionUtil.cs
- LayoutInformation.cs
- QuaternionConverter.cs
- Boolean.cs
- ChangeTracker.cs
- TailPinnedEventArgs.cs
- COM2ComponentEditor.cs
- SoapReflectionImporter.cs
- BuildManagerHost.cs
- RevocationPoint.cs
- MobileControlsSectionHelper.cs
- ReliableSessionBindingElementImporter.cs
- DecimalAnimation.cs
- KeyConstraint.cs
- RelatedView.cs
- SimpleWebHandlerParser.cs
- Point3DValueSerializer.cs
- SymbolMethod.cs
- StateBag.cs
- XmlObjectSerializerReadContextComplexJson.cs
- ConfigurationSectionCollection.cs
- ModelTreeEnumerator.cs
- RegexReplacement.cs
- Win32.cs
- AssociatedControlConverter.cs
- PreviewPageInfo.cs
- BrowserTree.cs
- ProcessModuleDesigner.cs
- DataGridViewControlCollection.cs
- MethodToken.cs