Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / View / PrimarySelectionAdorner.cs / 1305376 / PrimarySelectionAdorner.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation.View { using System; using System.Collections.Generic; using System.Text; using System.Windows.Documents; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Runtime; [Fx.Tag.XamlVisible(false)] sealed class PrimarySelectionAdorner : Adorner { public PrimarySelectionAdorner(UIElement adornedElement) : base(adornedElement) { } protected override void OnInitialized(EventArgs e) { this.IsHitTestVisible = false; } protected override void OnRender(DrawingContext drawingContext) { ContentControl contentControl = this.AdornedElement as ContentControl; double height = contentControl.ActualHeight; double width = contentControl.ActualWidth; Rect adornedElementRect = new Rect(this.DesiredSize.Width / 2 - width / 2, 0, width, height);; Pen renderPen = new Pen(SystemColors.HighlightBrush, 3); drawingContext.DrawRoundedRectangle(null, renderPen, adornedElementRect, 5, 5); //Geometry geometry = new RectangleGeometry(new Rect(-1000, -1000, 2000, 2000)); //geometry = Geometry.Combine(geometry, new RectangleGeometry(adornedElementRect, 5, 5), GeometryCombineMode.Exclude,null); //drawingContext.PushClip(geometry); //SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(160, 120, 120, 120)); //drawingContext.DrawRectangle(brush, renderPen, new Rect(-1000, -1000, 2000, 2000)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation.View { using System; using System.Collections.Generic; using System.Text; using System.Windows.Documents; using System.Windows; using System.Windows.Controls; using System.Windows.Media; using System.Runtime; [Fx.Tag.XamlVisible(false)] sealed class PrimarySelectionAdorner : Adorner { public PrimarySelectionAdorner(UIElement adornedElement) : base(adornedElement) { } protected override void OnInitialized(EventArgs e) { this.IsHitTestVisible = false; } protected override void OnRender(DrawingContext drawingContext) { ContentControl contentControl = this.AdornedElement as ContentControl; double height = contentControl.ActualHeight; double width = contentControl.ActualWidth; Rect adornedElementRect = new Rect(this.DesiredSize.Width / 2 - width / 2, 0, width, height);; Pen renderPen = new Pen(SystemColors.HighlightBrush, 3); drawingContext.DrawRoundedRectangle(null, renderPen, adornedElementRect, 5, 5); //Geometry geometry = new RectangleGeometry(new Rect(-1000, -1000, 2000, 2000)); //geometry = Geometry.Combine(geometry, new RectangleGeometry(adornedElementRect, 5, 5), GeometryCombineMode.Exclude,null); //drawingContext.PushClip(geometry); //SolidColorBrush brush = new SolidColorBrush(Color.FromArgb(160, 120, 120, 120)); //drawingContext.DrawRectangle(brush, renderPen, new Rect(-1000, -1000, 2000, 2000)); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DeflateEmulationStream.cs
- ResourceExpressionBuilder.cs
- StrongNameUtility.cs
- ExceptQueryOperator.cs
- TextEditorTables.cs
- HttpCacheVaryByContentEncodings.cs
- BufferModesCollection.cs
- ReflectionHelper.cs
- SymbolTable.cs
- WarningException.cs
- DataReaderContainer.cs
- ZipIOModeEnforcingStream.cs
- GridViewColumnCollection.cs
- Scripts.cs
- TableItemProviderWrapper.cs
- SQLBytesStorage.cs
- BookmarkWorkItem.cs
- FontStretchConverter.cs
- OdbcCommandBuilder.cs
- DefaultIfEmptyQueryOperator.cs
- GlyphsSerializer.cs
- DesignerWidgets.cs
- GetPageCompletedEventArgs.cs
- SyndicationItemFormatter.cs
- WebBrowserProgressChangedEventHandler.cs
- PenThreadPool.cs
- LineUtil.cs
- HttpProtocolImporter.cs
- OrderablePartitioner.cs
- BitmapSizeOptions.cs
- PhysicalFontFamily.cs
- StyleModeStack.cs
- HttpCookiesSection.cs
- Light.cs
- TimeSpanConverter.cs
- ListenerConnectionModeReader.cs
- BmpBitmapEncoder.cs
- ObjectView.cs
- DataObjectEventArgs.cs
- SubMenuStyle.cs
- GenericUriParser.cs
- SwitchLevelAttribute.cs
- Duration.cs
- FontStretch.cs
- BuildProviderAppliesToAttribute.cs
- ComboBoxRenderer.cs
- CompModSwitches.cs
- DiagnosticsElement.cs
- EntityDataSourceWizardForm.cs
- XsltInput.cs
- DataListItem.cs
- DoubleCollection.cs
- Comparer.cs
- ObjectParameter.cs
- IpcChannel.cs
- UnknownBitmapDecoder.cs
- StorageFunctionMapping.cs
- ConfigsHelper.cs
- CompilerErrorCollection.cs
- filewebrequest.cs
- ErrorFormatter.cs
- IgnorePropertiesAttribute.cs
- _SingleItemRequestCache.cs
- SamlConditions.cs
- BindUriHelper.cs
- EpmSyndicationContentDeSerializer.cs
- UnionQueryOperator.cs
- CTreeGenerator.cs
- TextEffect.cs
- XmlCountingReader.cs
- VectorCollection.cs
- EndPoint.cs
- ExpressionLink.cs
- DesignerDataConnection.cs
- ItemChangedEventArgs.cs
- TraceEventCache.cs
- RIPEMD160.cs
- PowerModeChangedEventArgs.cs
- WindowsToolbar.cs
- MetadataCache.cs
- ScrollChrome.cs
- MouseGestureConverter.cs
- ExitEventArgs.cs
- ListItemParagraph.cs
- TextBoxLine.cs
- SelectionList.cs
- ReadOnlyCollection.cs
- NetworkInformationException.cs
- InputLangChangeRequestEvent.cs
- DatasetMethodGenerator.cs
- Collection.cs
- EdmSchemaAttribute.cs
- HttpConfigurationContext.cs
- Point4D.cs
- BinaryUtilClasses.cs
- sqlnorm.cs
- _AuthenticationState.cs
- TaskExceptionHolder.cs
- XslAst.cs
- XPathBinder.cs