Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Controls / Primitives / ResizeGrip.cs / 1305600 / ResizeGrip.cs
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
// Description: Implements the ResizeGrip control
//
// History
// 10/24/03 hamidm Created
//
//---------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Threading;
using System.Windows.Media;
using System.Windows.Shapes;
#if OLD_AUTOMATION
using System.Windows.Automation.Provider;
#endif
namespace System.Windows.Controls.Primitives
{
///
/// The ResizeGrip control enables the Window object to have a resize grip. This control should be
/// made part of the Window's style visual tree.
///
///
///
///
#if OLD_AUTOMATION
[Automation(AccessibilityControlType = "Thumb")]
#endif
public class ResizeGrip : Control
{
//----------------------------------------------
//
// Constructors
//
//----------------------------------------------
#region Constructors
static ResizeGrip()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ResizeGrip), new FrameworkPropertyMetadata(typeof(ResizeGrip)));
_dType = DependencyObjectType.FromSystemTypeInternal(typeof(ResizeGrip));
Window.IWindowServiceProperty.OverrideMetadata(
typeof(ResizeGrip),
new FrameworkPropertyMetadata(new PropertyChangedCallback(_OnWindowServiceChanged)));
}
///
/// Default ResizeGrip constructor
///
///
/// Automatic determination of current Dispatcher. Use alternative constructor
/// that accepts a Dispatcher for best performance.
///
public ResizeGrip() : base()
{
}
#endregion Constructors
//----------------------------------------------
//
// Private Methods
//
//----------------------------------------------
#region Private Methods
private static void _OnWindowServiceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
ResizeGrip rg = d as ResizeGrip;
Debug.Assert(rg != null, "DependencyObject must be of type ResizeGrip.");
rg.OnWindowServiceChanged(e.OldValue as Window, e.NewValue as Window);
}
///
/// When IWindowService is invalidated, it means that this control is either placed into
/// a window's visual tree or taken out. If we are in a new Window's visual tree, we
/// want to set the reference to this object inside the Window. Window uses this
/// reference in its WM_NCHITTEST code
///
private void OnWindowServiceChanged(Window oldWindow, Window newWindow)
{
if ((oldWindow != null) && (oldWindow != newWindow))
{
oldWindow.ClearResizeGripControl(this);
}
if (newWindow != null)
{
newWindow.SetResizeGripControl(this);
}
}
#region DTypeThemeStyleKey
// Returns the DependencyObjectType for the registered ThemeStyleKey's default
// value. Controls will override this method to return approriate types.
internal override DependencyObjectType DTypeThemeStyleKey
{
get { return _dType; }
}
private static DependencyObjectType _dType;
#endregion DTypeThemeStyleKey
//
// This property
// 1. Finds the correct initial size for the _effectiveValues store on the current DependencyObject
// 2. This is a performance optimization
//
internal override int EffectiveValuesInitialSize
{
get { return 28; }
}
#endregion Private Methods
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
//
//
// Copyright (C) Microsoft Corporation. All rights reserved.
//
//
// Description: Implements the ResizeGrip control
//
// History
// 10/24/03 hamidm Created
//
//---------------------------------------------------------------------------
using System;
using System.Diagnostics;
using System.Windows;
using System.Windows.Threading;
using System.Windows.Media;
using System.Windows.Shapes;
#if OLD_AUTOMATION
using System.Windows.Automation.Provider;
#endif
namespace System.Windows.Controls.Primitives
{
///
/// The ResizeGrip control enables the Window object to have a resize grip. This control should be
/// made part of the Window's style visual tree.
///
///
///
///
#if OLD_AUTOMATION
[Automation(AccessibilityControlType = "Thumb")]
#endif
public class ResizeGrip : Control
{
//----------------------------------------------
//
// Constructors
//
//----------------------------------------------
#region Constructors
static ResizeGrip()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(ResizeGrip), new FrameworkPropertyMetadata(typeof(ResizeGrip)));
_dType = DependencyObjectType.FromSystemTypeInternal(typeof(ResizeGrip));
Window.IWindowServiceProperty.OverrideMetadata(
typeof(ResizeGrip),
new FrameworkPropertyMetadata(new PropertyChangedCallback(_OnWindowServiceChanged)));
}
///
/// Default ResizeGrip constructor
///
///
/// Automatic determination of current Dispatcher. Use alternative constructor
/// that accepts a Dispatcher for best performance.
///
public ResizeGrip() : base()
{
}
#endregion Constructors
//----------------------------------------------
//
// Private Methods
//
//----------------------------------------------
#region Private Methods
private static void _OnWindowServiceChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
ResizeGrip rg = d as ResizeGrip;
Debug.Assert(rg != null, "DependencyObject must be of type ResizeGrip.");
rg.OnWindowServiceChanged(e.OldValue as Window, e.NewValue as Window);
}
///
/// When IWindowService is invalidated, it means that this control is either placed into
/// a window's visual tree or taken out. If we are in a new Window's visual tree, we
/// want to set the reference to this object inside the Window. Window uses this
/// reference in its WM_NCHITTEST code
///
private void OnWindowServiceChanged(Window oldWindow, Window newWindow)
{
if ((oldWindow != null) && (oldWindow != newWindow))
{
oldWindow.ClearResizeGripControl(this);
}
if (newWindow != null)
{
newWindow.SetResizeGripControl(this);
}
}
#region DTypeThemeStyleKey
// Returns the DependencyObjectType for the registered ThemeStyleKey's default
// value. Controls will override this method to return approriate types.
internal override DependencyObjectType DTypeThemeStyleKey
{
get { return _dType; }
}
private static DependencyObjectType _dType;
#endregion DTypeThemeStyleKey
//
// This property
// 1. Finds the correct initial size for the _effectiveValues store on the current DependencyObject
// 2. This is a performance optimization
//
internal override int EffectiveValuesInitialSize
{
get { return 28; }
}
#endregion Private Methods
}
}
// 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
- Polyline.cs
- SafeHGlobalHandleCritical.cs
- SoapTypeAttribute.cs
- SparseMemoryStream.cs
- GridLength.cs
- SchemaTableColumn.cs
- PeerCollaboration.cs
- CodeAccessPermission.cs
- TableRowCollection.cs
- DataGridViewCellStyleConverter.cs
- EventSchemaTraceListener.cs
- SystemSounds.cs
- ProfilePropertySettingsCollection.cs
- ValueUnavailableException.cs
- ListBoxChrome.cs
- EventLogPermissionEntryCollection.cs
- SchemaMerger.cs
- FieldNameLookup.cs
- RemotingAttributes.cs
- BitmapDownload.cs
- Interfaces.cs
- FontWeight.cs
- ScrollBar.cs
- WebDescriptionAttribute.cs
- PeerNeighborManager.cs
- DBCSCodePageEncoding.cs
- WebPartConnectionsConfigureVerb.cs
- SafeSecurityHandles.cs
- ValueTable.cs
- ApplicationContext.cs
- MissingManifestResourceException.cs
- BasePropertyDescriptor.cs
- PersonalizationProviderHelper.cs
- XmlObjectSerializerWriteContextComplexJson.cs
- MenuItemStyleCollection.cs
- GradientStop.cs
- MultiSelectRootGridEntry.cs
- ConditionalAttribute.cs
- XamlValidatingReader.cs
- SystemIPInterfaceStatistics.cs
- ExpandedProjectionNode.cs
- XmlStringTable.cs
- ListenerChannelContext.cs
- CodeThrowExceptionStatement.cs
- CharStorage.cs
- ClientBuildManager.cs
- NameScope.cs
- RtfToXamlReader.cs
- OperationContext.cs
- SchemaImporterExtension.cs
- IsolatedStorageFileStream.cs
- MailBnfHelper.cs
- XamlSerializerUtil.cs
- Icon.cs
- PropertyKey.cs
- SendMessageRecord.cs
- AutoScrollHelper.cs
- ServiceOperationParameter.cs
- Tile.cs
- TemplateBindingExtension.cs
- odbcmetadatacolumnnames.cs
- XmlResolver.cs
- Gdiplus.cs
- HtmlTable.cs
- OutArgumentConverter.cs
- DerivedKeySecurityToken.cs
- CollectionChangedEventManager.cs
- EncoderBestFitFallback.cs
- SoapRpcMethodAttribute.cs
- IncrementalCompileAnalyzer.cs
- Line.cs
- CmsUtils.cs
- TimerEventSubscription.cs
- ClientApiGenerator.cs
- ListViewGroupConverter.cs
- PathData.cs
- WebSysDisplayNameAttribute.cs
- SRDisplayNameAttribute.cs
- EnumBuilder.cs
- MulticastDelegate.cs
- ExpandCollapsePattern.cs
- WindowsTokenRoleProvider.cs
- FlowDocumentPage.cs
- hwndwrapper.cs
- ManualResetEventSlim.cs
- Binding.cs
- IssuanceLicense.cs
- BamlReader.cs
- DataRelation.cs
- SqlErrorCollection.cs
- QueryStringParameter.cs
- MetaType.cs
- EnlistmentTraceIdentifier.cs
- TextEffect.cs
- PolicyValidationException.cs
- DatePickerDateValidationErrorEventArgs.cs
- PolicyManager.cs
- WebAdminConfigurationHelper.cs
- WindowsTreeView.cs
- FrameworkElementFactoryMarkupObject.cs