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
- Scheduler.cs
- WebColorConverter.cs
- ZoomPercentageConverter.cs
- Permission.cs
- AttributeCollection.cs
- RelationshipSet.cs
- NavigationFailedEventArgs.cs
- _Rfc2616CacheValidators.cs
- DataRow.cs
- EventMappingSettingsCollection.cs
- Substitution.cs
- SecurityPermission.cs
- DataSetUtil.cs
- SafeSecurityHandles.cs
- Queue.cs
- SerializableAttribute.cs
- VarRemapper.cs
- ExecutionContext.cs
- HttpContextWrapper.cs
- SchemaNotation.cs
- OutputScope.cs
- AssemblyNameUtility.cs
- NameValueConfigurationCollection.cs
- storepermission.cs
- WebEncodingValidator.cs
- XslAstAnalyzer.cs
- UnsafeNativeMethods.cs
- TemplateKey.cs
- PageTheme.cs
- ProfileSettings.cs
- ListenDesigner.cs
- AstNode.cs
- CodeTypeConstructor.cs
- ExpressionBuilder.cs
- HtmlLink.cs
- TextServicesHost.cs
- SQLDateTime.cs
- AssemblyCache.cs
- PrintPreviewGraphics.cs
- SocketException.cs
- ConnectorSelectionGlyph.cs
- InputLanguageProfileNotifySink.cs
- SafeNativeMethods.cs
- XmlSchemaSequence.cs
- ObservableDictionary.cs
- MdiWindowListStrip.cs
- GPRECTF.cs
- XmlSchemaSimpleTypeUnion.cs
- TreeViewBindingsEditorForm.cs
- SqlRewriteScalarSubqueries.cs
- FilterException.cs
- KernelTypeValidation.cs
- EditorPartChrome.cs
- HtmlInputFile.cs
- NegatedCellConstant.cs
- FixedTextBuilder.cs
- CqlParser.cs
- EmptyQuery.cs
- WebPartMovingEventArgs.cs
- CultureTableRecord.cs
- XPathException.cs
- SettingsBase.cs
- EntityType.cs
- ExecutionEngineException.cs
- JavaScriptString.cs
- SerializationInfoEnumerator.cs
- LinqDataSourceView.cs
- InternalsVisibleToAttribute.cs
- WebPartUtil.cs
- RSAOAEPKeyExchangeFormatter.cs
- XsltLoader.cs
- XmlSchemaAttributeGroupRef.cs
- UnsafeNativeMethods.cs
- XmlCollation.cs
- ECDsa.cs
- GroupBoxDesigner.cs
- PassportAuthenticationEventArgs.cs
- TreeViewImageIndexConverter.cs
- DataBindingHandlerAttribute.cs
- RC2CryptoServiceProvider.cs
- PageSettings.cs
- ContentType.cs
- filewebresponse.cs
- DocumentSchemaValidator.cs
- VirtualizingPanel.cs
- XmlDeclaration.cs
- RelationshipConstraintValidator.cs
- ParameterCollection.cs
- NamespaceQuery.cs
- Listbox.cs
- PopupEventArgs.cs
- LiteralSubsegment.cs
- RangeExpression.cs
- MergeFilterQuery.cs
- RectangleConverter.cs
- TemplateField.cs
- StylusPointProperties.cs
- MetadataArtifactLoaderResource.cs
- PartialTrustHelpers.cs
- PingReply.cs