Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- COM2IPerPropertyBrowsingHandler.cs
- DataListItem.cs
- SerTrace.cs
- TypeGeneratedEventArgs.cs
- AdornerDecorator.cs
- DataSourceControl.cs
- ElementAtQueryOperator.cs
- ErrorFormatter.cs
- SubclassTypeValidator.cs
- PropertyValueUIItem.cs
- NumberAction.cs
- ButtonAutomationPeer.cs
- ContentTextAutomationPeer.cs
- EncoderBestFitFallback.cs
- DiscoveryViaBehavior.cs
- RegexGroupCollection.cs
- DecoderReplacementFallback.cs
- Wizard.cs
- HtmlFormWrapper.cs
- HtmlListAdapter.cs
- FlowLayout.cs
- BehaviorEditorPart.cs
- BrowserDefinitionCollection.cs
- EdmProviderManifest.cs
- DispatcherSynchronizationContext.cs
- IRCollection.cs
- BatchParser.cs
- PlainXmlDeserializer.cs
- SchemaNames.cs
- TimeoutException.cs
- BooleanFacetDescriptionElement.cs
- RoleGroupCollection.cs
- FontFamilyIdentifier.cs
- ColorPalette.cs
- WebPartEditorCancelVerb.cs
- Socket.cs
- BaseDataListDesigner.cs
- InheritedPropertyChangedEventArgs.cs
- AttachedPropertyMethodSelector.cs
- HierarchicalDataBoundControlAdapter.cs
- AutoGeneratedFieldProperties.cs
- TypeGeneratedEventArgs.cs
- SortedDictionary.cs
- RequestStatusBarUpdateEventArgs.cs
- SafeProcessHandle.cs
- XmlComment.cs
- BamlResourceContent.cs
- XmlArrayItemAttributes.cs
- PointCollectionConverter.cs
- RequestQueue.cs
- ObjectReaderCompiler.cs
- StylusTip.cs
- BrowserDefinition.cs
- RouteItem.cs
- ScrollChrome.cs
- GenerateTemporaryTargetAssembly.cs
- ConfigUtil.cs
- BrowserInteropHelper.cs
- ReadOnlyCollection.cs
- JobDuplex.cs
- HierarchicalDataBoundControlAdapter.cs
- precedingsibling.cs
- XmlSchemaAppInfo.cs
- GenerateHelper.cs
- MenuBase.cs
- PointLightBase.cs
- FacetDescriptionElement.cs
- DES.cs
- TypeReference.cs
- ParentControlDesigner.cs
- ParsedRoute.cs
- UInt16Converter.cs
- DocumentOrderQuery.cs
- SortKey.cs
- DocumentPageHost.cs
- oledbmetadatacolumnnames.cs
- Margins.cs
- SystemUdpStatistics.cs
- LicenseException.cs
- SessionStateContainer.cs
- PostBackOptions.cs
- InternalReceiveMessage.cs
- UnsafeNativeMethods.cs
- ISO2022Encoding.cs
- AssemblyHash.cs
- ViewPort3D.cs
- AsymmetricKeyExchangeDeformatter.cs
- BuildDependencySet.cs
- ValueOfAction.cs
- QueryCacheKey.cs
- _UriTypeConverter.cs
- GlyphManager.cs
- XsltQilFactory.cs
- HttpPostedFile.cs
- Rule.cs
- ConvertEvent.cs
- ConfigurationLockCollection.cs
- MetadataCollection.cs
- ResourceReader.cs
- EncoderBestFitFallback.cs