Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / Orcas / NetFXw7 / 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
- LocatorBase.cs
- TryCatchDesigner.xaml.cs
- SecurityCriticalDataForSet.cs
- SqlDataSourceView.cs
- EditorPart.cs
- NativeObjectSecurity.cs
- PeerResolverBindingElement.cs
- CodeArrayCreateExpression.cs
- XPathMultyIterator.cs
- UpdateInfo.cs
- StaticContext.cs
- HtmlHistory.cs
- PersonalizationProviderCollection.cs
- BitArray.cs
- ComponentDispatcherThread.cs
- HttpCapabilitiesBase.cs
- SelectorAutomationPeer.cs
- SerializationException.cs
- SqlCacheDependencyDatabaseCollection.cs
- XmlSchemaInfo.cs
- HtmlFormWrapper.cs
- TableParaClient.cs
- DataGridViewDataConnection.cs
- CommandLibraryHelper.cs
- XmlSerializerFactory.cs
- Monitor.cs
- PersonalizablePropertyEntry.cs
- TextSelectionProcessor.cs
- XmlTextReader.cs
- PointAnimationUsingPath.cs
- KeyManager.cs
- DataMisalignedException.cs
- ApplicationSecurityManager.cs
- LicenseContext.cs
- BoolLiteral.cs
- TrackingMemoryStream.cs
- Viewport3DAutomationPeer.cs
- EditBehavior.cs
- ErrorTableItemStyle.cs
- CommandID.cs
- TextParagraph.cs
- LinkedList.cs
- DesignerRegion.cs
- XPathDescendantIterator.cs
- CopyAction.cs
- JsonEncodingStreamWrapper.cs
- GridSplitter.cs
- DependentList.cs
- DbConnectionOptions.cs
- FormatterConverter.cs
- GZipStream.cs
- BaseParaClient.cs
- ProxyFragment.cs
- columnmapkeybuilder.cs
- ClientRoleProvider.cs
- InputLangChangeEvent.cs
- EncodingInfo.cs
- PostBackTrigger.cs
- IconHelper.cs
- XmlAtomicValue.cs
- RectangleGeometry.cs
- TextMetrics.cs
- SingleTagSectionHandler.cs
- MimeMultiPart.cs
- UserUseLicenseDictionaryLoader.cs
- WebPartTransformer.cs
- X509Certificate.cs
- PropertyGridEditorPart.cs
- CaseInsensitiveComparer.cs
- GenericsNotImplementedException.cs
- HashCodeCombiner.cs
- TextRenderer.cs
- IpcServerChannel.cs
- DataGridTable.cs
- DynamicAttribute.cs
- CornerRadius.cs
- CodeExpressionCollection.cs
- SkinBuilder.cs
- DateTime.cs
- XmlRootAttribute.cs
- IdentityReference.cs
- PairComparer.cs
- AttachInfo.cs
- RowCache.cs
- HyperLink.cs
- GridViewEditEventArgs.cs
- SystemResources.cs
- AVElementHelper.cs
- TargetParameterCountException.cs
- MultilineStringConverter.cs
- CodeLinePragma.cs
- DtrList.cs
- HostedElements.cs
- AlternationConverter.cs
- EventDescriptor.cs
- KnownTypes.cs
- InternalPermissions.cs
- CustomValidator.cs
- wmiprovider.cs
- DefaultHttpHandler.cs