Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Documents / ColumnResizeUndoUnit.cs / 1 / 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
- WebEvents.cs
- PersonalizationProviderCollection.cs
- ProviderSettings.cs
- InvalidDocumentContentsException.cs
- HeaderCollection.cs
- SafeWaitHandle.cs
- TimeoutConverter.cs
- FileStream.cs
- CharacterMetricsDictionary.cs
- PageCatalogPart.cs
- GridItem.cs
- Size3D.cs
- BaseCodePageEncoding.cs
- VirtualizingPanel.cs
- TreeViewDesigner.cs
- KoreanLunisolarCalendar.cs
- PassportPrincipal.cs
- ResXFileRef.cs
- Trustee.cs
- ButtonRenderer.cs
- ElementAction.cs
- SectionRecord.cs
- ReadOnlyMetadataCollection.cs
- XhtmlStyleClass.cs
- XPathDocument.cs
- TriggerCollection.cs
- WindowsEditBox.cs
- RecordManager.cs
- DbConnectionInternal.cs
- AttributeCollection.cs
- WebBrowserNavigatingEventHandler.cs
- TargetControlTypeAttribute.cs
- FontCacheUtil.cs
- IpcServerChannel.cs
- CssClassPropertyAttribute.cs
- CompilationLock.cs
- AttachedPropertyBrowsableForTypeAttribute.cs
- DataGridViewComboBoxColumn.cs
- OracleMonthSpan.cs
- AncestorChangedEventArgs.cs
- GifBitmapEncoder.cs
- HashHelper.cs
- SID.cs
- TextElementCollectionHelper.cs
- SuppressMessageAttribute.cs
- QilReplaceVisitor.cs
- XmlSortKey.cs
- EventLogger.cs
- SchemaTableOptionalColumn.cs
- Qualifier.cs
- RangeContentEnumerator.cs
- TextUtf8RawTextWriter.cs
- TimerElapsedEvenArgs.cs
- SrgsElementFactoryCompiler.cs
- InvokeWebServiceDesigner.cs
- AndCondition.cs
- LoginName.cs
- DataGridViewDataErrorEventArgs.cs
- DodSequenceMerge.cs
- ExpressionParser.cs
- SymmetricKey.cs
- ListViewSelectEventArgs.cs
- NotImplementedException.cs
- DiffuseMaterial.cs
- GuidelineCollection.cs
- UserControlDesigner.cs
- DataColumnCollection.cs
- SessionStateContainer.cs
- Byte.cs
- Camera.cs
- ServicePointManager.cs
- PropertyPathConverter.cs
- safesecurityhelperavalon.cs
- HatchBrush.cs
- WebZoneDesigner.cs
- StateInitialization.cs
- DynamicMethod.cs
- OperationAbortedException.cs
- ProfilePropertySettings.cs
- DoubleLink.cs
- RuntimeArgumentHandle.cs
- InputReport.cs
- PasswordRecovery.cs
- DataRow.cs
- AggregateNode.cs
- NamedPipeHostedTransportConfiguration.cs
- Buffer.cs
- EncoderReplacementFallback.cs
- TransactionFlowElement.cs
- VariantWrapper.cs
- TabPageDesigner.cs
- localization.cs
- ObjectParameter.cs
- AsymmetricCryptoHandle.cs
- TextProperties.cs
- Vector3DAnimationBase.cs
- ReadOnlyHierarchicalDataSource.cs
- TraceRecord.cs
- ObjectCloneHelper.cs
- SemaphoreFullException.cs