Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Documents / ColumnResizeUndoUnit.cs / 1305600 / ColumnResizeUndoUnit.cs
//---------------------------------------------------------------------------- // // File: ColumnResizeUndoUnit.cs // // Description: Undo unit for resizing columns // // History: // 01/27/2005 : GHermann - Created // //--------------------------------------------------------------------------- using MS.Internal.Documents; namespace System.Windows.Documents { internal class ColumnResizeUndoUnit : ParentUndoUnit { #region Constructors internal ColumnResizeUndoUnit(TextPointer textPointerTable, int columnIndex, double[] columnWidths, double resizeAmount) : base("ColumnResize") { _textContainer = textPointerTable.TextContainer; _cpTable = _textContainer.Start.GetOffsetToPosition(textPointerTable); _columnWidths = columnWidths; _columnIndex = columnIndex; _resizeAmount = resizeAmount; } #endregion Constructors #region Public Methods ////// Perform the appropriate action for this unit. If this is a parent undo unit, the /// parent must create an appropriate parent undo unit to contain the redo units. /// public override void Do() { UndoManager undoManager; IParentUndoUnit redo; TextPointer textPointerTable; Table table; undoManager = TopContainer as UndoManager; redo = null; textPointerTable = new TextPointer(_textContainer.Start, _cpTable, LogicalDirection.Forward); table = (Table) textPointerTable.Parent; _columnWidths[_columnIndex] -= _resizeAmount; if(_columnIndex < table.ColumnCount - 1) { _columnWidths[_columnIndex + 1] += _resizeAmount; } if(undoManager != null && undoManager.IsEnabled) { redo = new ColumnResizeUndoUnit(textPointerTable, _columnIndex, _columnWidths, -_resizeAmount); undoManager.Open(redo); } TextRangeEditTables.EnsureTableColumnsAreFixedSize(table, _columnWidths); if(redo != null) { undoManager.Close(redo, UndoCloseAction.Commit); } } #endregion Public Methods #region Private Data private TextContainer _textContainer; private double[] _columnWidths; private int _cpTable; private int _columnIndex; private double _resizeAmount; #endregion Private Data } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved. //---------------------------------------------------------------------------- // // File: ColumnResizeUndoUnit.cs // // Description: Undo unit for resizing columns // // History: // 01/27/2005 : GHermann - Created // //--------------------------------------------------------------------------- using MS.Internal.Documents; namespace System.Windows.Documents { internal class ColumnResizeUndoUnit : ParentUndoUnit { #region Constructors internal ColumnResizeUndoUnit(TextPointer textPointerTable, int columnIndex, double[] columnWidths, double resizeAmount) : base("ColumnResize") { _textContainer = textPointerTable.TextContainer; _cpTable = _textContainer.Start.GetOffsetToPosition(textPointerTable); _columnWidths = columnWidths; _columnIndex = columnIndex; _resizeAmount = resizeAmount; } #endregion Constructors #region Public Methods ////// Perform the appropriate action for this unit. If this is a parent undo unit, the /// parent must create an appropriate parent undo unit to contain the redo units. /// public override void Do() { UndoManager undoManager; IParentUndoUnit redo; TextPointer textPointerTable; Table table; undoManager = TopContainer as UndoManager; redo = null; textPointerTable = new TextPointer(_textContainer.Start, _cpTable, LogicalDirection.Forward); table = (Table) textPointerTable.Parent; _columnWidths[_columnIndex] -= _resizeAmount; if(_columnIndex < table.ColumnCount - 1) { _columnWidths[_columnIndex + 1] += _resizeAmount; } if(undoManager != null && undoManager.IsEnabled) { redo = new ColumnResizeUndoUnit(textPointerTable, _columnIndex, _columnWidths, -_resizeAmount); undoManager.Open(redo); } TextRangeEditTables.EnsureTableColumnsAreFixedSize(table, _columnWidths); if(redo != null) { undoManager.Close(redo, UndoCloseAction.Commit); } } #endregion Public Methods #region Private Data private TextContainer _textContainer; private double[] _columnWidths; private int _cpTable; private int _columnIndex; private double _resizeAmount; #endregion Private Data } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DataControlImageButton.cs
- OdbcConnectionPoolProviderInfo.cs
- ManagedWndProcTracker.cs
- CipherData.cs
- StrongName.cs
- LazyTextWriterCreator.cs
- BamlTreeMap.cs
- CachedTypeface.cs
- PerformanceCounterLib.cs
- GroupAggregateExpr.cs
- AdvancedBindingPropertyDescriptor.cs
- X509SecurityTokenAuthenticator.cs
- Message.cs
- XmlUrlResolver.cs
- ObjectDataSourceEventArgs.cs
- ToolStripButton.cs
- DetailsViewUpdatedEventArgs.cs
- ViewGenResults.cs
- CryptoKeySecurity.cs
- CompositeCollectionView.cs
- WebHttpDispatchOperationSelector.cs
- NameScope.cs
- MouseButton.cs
- PageStatePersister.cs
- TraceSection.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- CodeExpressionCollection.cs
- EventSetter.cs
- LineSegment.cs
- SerTrace.cs
- OrderedDictionary.cs
- SingletonChannelAcceptor.cs
- ObjectIDGenerator.cs
- XmlHierarchicalDataSourceView.cs
- FloaterParagraph.cs
- IList.cs
- DiagnosticTrace.cs
- BinarySerializer.cs
- httpstaticobjectscollection.cs
- VariableQuery.cs
- ResourcePart.cs
- SafeNativeMethodsMilCoreApi.cs
- storepermission.cs
- StylusPointCollection.cs
- SmtpNegotiateAuthenticationModule.cs
- DataGridCommandEventArgs.cs
- PasswordRecovery.cs
- TaskResultSetter.cs
- PartialCachingAttribute.cs
- _AutoWebProxyScriptHelper.cs
- SchemaManager.cs
- TableParagraph.cs
- DataColumnPropertyDescriptor.cs
- DbParameterCollectionHelper.cs
- LockCookie.cs
- FixedSOMImage.cs
- safesecurityhelperavalon.cs
- OleDbRowUpdatedEvent.cs
- WindowsFormsHost.cs
- Debugger.cs
- PageParser.cs
- DesignerValidationSummaryAdapter.cs
- XmlDomTextWriter.cs
- MessageSecurityProtocolFactory.cs
- EmbeddedMailObjectsCollection.cs
- DesignerSerializerAttribute.cs
- ContextMenu.cs
- BaseCAMarshaler.cs
- ReflectionTypeLoadException.cs
- HostProtectionException.cs
- AssertValidation.cs
- BitmapData.cs
- HtmlInputFile.cs
- DataSourceXmlElementAttribute.cs
- CharacterHit.cs
- ReferentialConstraint.cs
- GPPOINT.cs
- Clipboard.cs
- XmlCharCheckingWriter.cs
- ProtocolsConfigurationEntry.cs
- DataGridViewToolTip.cs
- User.cs
- FileStream.cs
- ContextBase.cs
- HandleRef.cs
- OdbcParameter.cs
- DockAndAnchorLayout.cs
- SingleAnimationBase.cs
- SafeEventLogWriteHandle.cs
- SelectionEditingBehavior.cs
- ItemChangedEventArgs.cs
- FileLevelControlBuilderAttribute.cs
- LogicalExpr.cs
- RelationshipFixer.cs
- Empty.cs
- assertwrapper.cs
- MatrixAnimationBase.cs
- SystemColors.cs
- MappingSource.cs
- UnsafeNativeMethodsTablet.cs