Code:
/ 4.0 / 4.0 / untmp / 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.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- UInt32Converter.cs
- RTLAwareMessageBox.cs
- Geometry.cs
- BasicCommandTreeVisitor.cs
- ProtocolsSection.cs
- XamlSerializationHelper.cs
- BinaryObjectReader.cs
- XsdDateTime.cs
- EventProperty.cs
- ZipIORawDataFileBlock.cs
- QuadraticBezierSegment.cs
- RelationshipDetailsRow.cs
- TypeConverterHelper.cs
- DataGridLinkButton.cs
- TraceLevelStore.cs
- SQLBytesStorage.cs
- ClientUrlResolverWrapper.cs
- SmtpAuthenticationManager.cs
- TypeBuilder.cs
- ComboBoxRenderer.cs
- WebResponse.cs
- SystemPens.cs
- ISessionStateStore.cs
- HtmlHead.cs
- EffectiveValueEntry.cs
- RoleGroup.cs
- NamespaceList.cs
- DecodeHelper.cs
- PinnedBufferMemoryStream.cs
- SystemFonts.cs
- RSAPKCS1SignatureFormatter.cs
- TemplatePropertyEntry.cs
- VersionConverter.cs
- ForceCopyBuildProvider.cs
- safelinkcollection.cs
- FaultCallbackWrapper.cs
- DrawingGroup.cs
- BeginStoryboard.cs
- DoubleStorage.cs
- WeakReferenceKey.cs
- XamlSerializerUtil.cs
- XslAst.cs
- ConnectorSelectionGlyph.cs
- TreeViewBindingsEditorForm.cs
- SafePointer.cs
- JavaScriptSerializer.cs
- SQLUtility.cs
- BaseTreeIterator.cs
- MetadataItemEmitter.cs
- HttpPostedFile.cs
- ETagAttribute.cs
- RuntimeCompatibilityAttribute.cs
- NavigationCommands.cs
- XmlRootAttribute.cs
- DataObjectMethodAttribute.cs
- TransformCryptoHandle.cs
- CompiledAction.cs
- ApplicationId.cs
- HTMLTextWriter.cs
- DispatcherOperation.cs
- UdpMessageProperty.cs
- ValidatingCollection.cs
- ScalarType.cs
- SpanIndex.cs
- EventManager.cs
- ContentHostHelper.cs
- XmlSchemaAttributeGroupRef.cs
- _HeaderInfo.cs
- AnnotationResourceChangedEventArgs.cs
- XmlSchemaException.cs
- ColorKeyFrameCollection.cs
- DoWhileDesigner.xaml.cs
- XmlAnyAttributeAttribute.cs
- Registry.cs
- _OverlappedAsyncResult.cs
- MethodRental.cs
- RenderCapability.cs
- BaseResourcesBuildProvider.cs
- UITypeEditor.cs
- DurableOperationAttribute.cs
- SystemFonts.cs
- BooleanAnimationUsingKeyFrames.cs
- ValidatorCollection.cs
- XmlAttributes.cs
- NullExtension.cs
- ToolStripRenderEventArgs.cs
- PersonalizationStateInfoCollection.cs
- XmlHierarchyData.cs
- Image.cs
- util.cs
- XmlJsonWriter.cs
- FixUpCollection.cs
- InkCanvasSelectionAdorner.cs
- IntegrationExceptionEventArgs.cs
- SplitterPanel.cs
- SqlPersonalizationProvider.cs
- XPathSelectionIterator.cs
- FocusWithinProperty.cs
- DecimalConverter.cs
- SecurityRuntime.cs