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
- BuildManagerHost.cs
- OrderingQueryOperator.cs
- ChannelSinkStacks.cs
- ZipIOLocalFileBlock.cs
- altserialization.cs
- COM2PropertyPageUITypeConverter.cs
- ByteArrayHelperWithString.cs
- XmlUTF8TextWriter.cs
- GenerateScriptTypeAttribute.cs
- Processor.cs
- InvalidCommandTreeException.cs
- MenuItemStyle.cs
- StringFreezingAttribute.cs
- NumericUpDownAcceleration.cs
- ConfigXmlWhitespace.cs
- SqlDataSourceFilteringEventArgs.cs
- SingleStorage.cs
- DataSvcMapFile.cs
- ScopelessEnumAttribute.cs
- DbReferenceCollection.cs
- EventDescriptor.cs
- NavigateEvent.cs
- SectionVisual.cs
- CharEnumerator.cs
- ChtmlSelectionListAdapter.cs
- SpecularMaterial.cs
- DoubleAnimation.cs
- NativeRightsManagementAPIsStructures.cs
- FixedSOMImage.cs
- HttpRuntimeSection.cs
- DateTimeConverter.cs
- ResizeBehavior.cs
- CacheEntry.cs
- DataAccessException.cs
- TreeViewAutomationPeer.cs
- columnmapfactory.cs
- RegionIterator.cs
- BaseUriWithWildcard.cs
- ConnectionStringSettings.cs
- Process.cs
- TemplateInstanceAttribute.cs
- UniqueIdentifierService.cs
- SiteMapDataSource.cs
- XmlSerializer.cs
- JsonQNameDataContract.cs
- MaskedTextBoxTextEditor.cs
- ContainerControlDesigner.cs
- SessionSwitchEventArgs.cs
- RootBrowserWindow.cs
- NamedObject.cs
- StringAttributeCollection.cs
- RegexMatchCollection.cs
- SurrogateEncoder.cs
- GridViewRowPresenterBase.cs
- SqlBooleanizer.cs
- MatrixUtil.cs
- TextHidden.cs
- ApplicationFileParser.cs
- FactoryMaker.cs
- DeviceContext2.cs
- TraceUtils.cs
- SHA1CryptoServiceProvider.cs
- Encoding.cs
- HttpFileCollection.cs
- _LocalDataStoreMgr.cs
- DatatypeImplementation.cs
- XamlReaderHelper.cs
- AssemblyAttributesGoHere.cs
- PlanCompilerUtil.cs
- WebPartDisplayModeEventArgs.cs
- TdsParameterSetter.cs
- ThrowHelper.cs
- RuleSettingsCollection.cs
- StorageConditionPropertyMapping.cs
- TextModifier.cs
- DocumentViewerHelper.cs
- ControllableStoryboardAction.cs
- DataExchangeServiceBinder.cs
- ClientSettingsProvider.cs
- QilExpression.cs
- FormCollection.cs
- BaseHashHelper.cs
- login.cs
- TextBoxRenderer.cs
- ConstructorExpr.cs
- SlipBehavior.cs
- BinaryObjectReader.cs
- StrongTypingException.cs
- DataTemplate.cs
- Vector3DKeyFrameCollection.cs
- PreviewKeyDownEventArgs.cs
- SrgsGrammar.cs
- HwndKeyboardInputProvider.cs
- ToolStripContentPanelDesigner.cs
- CachedFontFamily.cs
- WinCategoryAttribute.cs
- DataGridToolTip.cs
- DBNull.cs
- ImageAttributes.cs
- DataGridHelper.cs