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
- ListItemViewControl.cs
- DataFieldEditor.cs
- XsltContext.cs
- VSWCFServiceContractGenerator.cs
- Accessible.cs
- MatrixCamera.cs
- CodeDomConfigurationHandler.cs
- COM2IDispatchConverter.cs
- XmlAtomErrorReader.cs
- DocumentEventArgs.cs
- DateTimeFormatInfo.cs
- XMLSyntaxException.cs
- FrameAutomationPeer.cs
- StrokeSerializer.cs
- XmlDomTextWriter.cs
- QueryLifecycle.cs
- SpecialFolderEnumConverter.cs
- EventListenerClientSide.cs
- SqlDependencyListener.cs
- mongolianshape.cs
- DataBinder.cs
- FontFamilyValueSerializer.cs
- PlaceHolder.cs
- FixedDocumentPaginator.cs
- AnnotationResourceChangedEventArgs.cs
- SmtpReplyReader.cs
- ImageMetadata.cs
- JsonWriterDelegator.cs
- sqlinternaltransaction.cs
- SecurityDocument.cs
- RtfToXamlReader.cs
- LinearGradientBrush.cs
- RandomNumberGenerator.cs
- HostedHttpRequestAsyncResult.cs
- ColumnPropertiesGroup.cs
- externdll.cs
- PtsContext.cs
- Win32.cs
- HTMLTextWriter.cs
- DynamicUpdateCommand.cs
- BordersPage.cs
- LinkAreaEditor.cs
- ElementFactory.cs
- BufferedWebEventProvider.cs
- BypassElement.cs
- CategoryNameCollection.cs
- BoolExpressionVisitors.cs
- CharacterShapingProperties.cs
- IRCollection.cs
- RealizationContext.cs
- WorkflowServiceHostFactory.cs
- ListBoxItemWrapperAutomationPeer.cs
- GenerateTemporaryTargetAssembly.cs
- FixedDSBuilder.cs
- Socket.cs
- HttpPostProtocolReflector.cs
- FormatControl.cs
- configsystem.cs
- RolePrincipal.cs
- ThaiBuddhistCalendar.cs
- TreeNodeSelectionProcessor.cs
- WorkflowInstanceTerminatedRecord.cs
- ConfigurationSectionCollection.cs
- DataGridViewComboBoxCell.cs
- HtmlSelect.cs
- VariableAction.cs
- InitializingNewItemEventArgs.cs
- PolyBezierSegmentFigureLogic.cs
- DataServiceRequestOfT.cs
- AsymmetricKeyExchangeDeformatter.cs
- MultipleViewProviderWrapper.cs
- SqlErrorCollection.cs
- SqlNodeTypeOperators.cs
- SQLChars.cs
- CompositeActivityTypeDescriptor.cs
- SessionPageStateSection.cs
- GenericParameterDataContract.cs
- XmlSchema.cs
- MediaCommands.cs
- WsiProfilesElementCollection.cs
- MarshalByRefObject.cs
- TogglePatternIdentifiers.cs
- StoryFragments.cs
- DocComment.cs
- XmlWhitespace.cs
- StorageEndPropertyMapping.cs
- OdbcConnection.cs
- SingleAnimation.cs
- ToolboxItemWrapper.cs
- SingleResultAttribute.cs
- GroupStyle.cs
- DependencyStoreSurrogate.cs
- PrintDocument.cs
- CqlQuery.cs
- ImageClickEventArgs.cs
- Equal.cs
- AttachedPropertyBrowsableAttribute.cs
- DeobfuscatingStream.cs
- SqlNotificationEventArgs.cs
- NameObjectCollectionBase.cs