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
- ProcessHostMapPath.cs
- CompModSwitches.cs
- _PooledStream.cs
- HtmlInputSubmit.cs
- ConnectionDemuxer.cs
- MultiDataTrigger.cs
- QueryCacheEntry.cs
- ValueExpressions.cs
- DataSourceHelper.cs
- CmsUtils.cs
- RangeValuePatternIdentifiers.cs
- ResXFileRef.cs
- QueryTaskGroupState.cs
- TextEditorTyping.cs
- TableLayoutStyleCollection.cs
- DataMemberListEditor.cs
- MouseCaptureWithinProperty.cs
- SqlVisitor.cs
- CannotUnloadAppDomainException.cs
- InternalSafeNativeMethods.cs
- ServiceDescriptionSerializer.cs
- PipelineDeploymentState.cs
- CalendarDay.cs
- DataPagerFieldCommandEventArgs.cs
- PerformanceCounterPermissionEntry.cs
- JsonQNameDataContract.cs
- MsmqIntegrationValidationBehavior.cs
- MemberAccessException.cs
- DataGridColumnHeaderItemAutomationPeer.cs
- FileUtil.cs
- DateTimeSerializationSection.cs
- ScrollChangedEventArgs.cs
- Thread.cs
- WindowsEditBox.cs
- Vector3DCollectionConverter.cs
- ClientBuildManagerCallback.cs
- SqlDataSourceStatusEventArgs.cs
- DataGridViewAccessibleObject.cs
- XmlHierarchicalDataSourceView.cs
- LifetimeManager.cs
- StaticResourceExtension.cs
- ReadOnlyDictionary.cs
- PointLight.cs
- DebugView.cs
- DescendantBaseQuery.cs
- CFStream.cs
- SqlCacheDependency.cs
- WriteableBitmap.cs
- DataServiceCollectionOfT.cs
- MeasureData.cs
- SqlDataReaderSmi.cs
- DataGridItemEventArgs.cs
- ExpressionEditorAttribute.cs
- RuntimeWrappedException.cs
- SrgsSubset.cs
- EventProviderTraceListener.cs
- PageCodeDomTreeGenerator.cs
- UserPreferenceChangingEventArgs.cs
- OperationInvokerTrace.cs
- DesignBindingPropertyDescriptor.cs
- InputMethod.cs
- BitmapEffectGroup.cs
- ClientBuildManager.cs
- RichTextBoxConstants.cs
- Monitor.cs
- ExtensionSimplifierMarkupObject.cs
- DrawingCollection.cs
- TypeConverterHelper.cs
- AsyncPostBackTrigger.cs
- IpcClientChannel.cs
- DnsPermission.cs
- EmptyReadOnlyDictionaryInternal.cs
- BitmapEncoder.cs
- MembershipUser.cs
- TypedDataSetSchemaImporterExtensionFx35.cs
- AssemblyGen.cs
- updateconfighost.cs
- Set.cs
- ButtonFieldBase.cs
- DoubleAnimationBase.cs
- IntersectQueryOperator.cs
- CollectionViewGroup.cs
- TemplateControlParser.cs
- PageAdapter.cs
- RegexMatch.cs
- GeneralTransform2DTo3D.cs
- EmptyEnumerable.cs
- GetImportedCardRequest.cs
- ToolStripStatusLabel.cs
- MSAAWinEventWrap.cs
- SmtpMail.cs
- ConfigErrorGlyph.cs
- XmlAtomErrorReader.cs
- TextRangeSerialization.cs
- mediaeventargs.cs
- OperationDescription.cs
- assemblycache.cs
- PerformanceCounterManager.cs
- RemoteCryptoRsaServiceProvider.cs
- XmlNullResolver.cs