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
- XmlMapping.cs
- XmlJsonWriter.cs
- GridViewUpdatedEventArgs.cs
- Msec.cs
- StateBag.cs
- SerializationException.cs
- RuleInfoComparer.cs
- ZipPackagePart.cs
- PersonalizationProviderCollection.cs
- TargetParameterCountException.cs
- indexingfiltermarshaler.cs
- GridViewAutoFormat.cs
- BindableAttribute.cs
- CellPartitioner.cs
- PropertyGridEditorPart.cs
- Size.cs
- HttpWebRequest.cs
- PeerNameRegistration.cs
- DispatcherTimer.cs
- MetadataItem_Static.cs
- PropertyGeneratedEventArgs.cs
- XmlSchemaAttribute.cs
- NegotiateStream.cs
- AsmxEndpointPickerExtension.cs
- RegionInfo.cs
- Item.cs
- ToolboxItem.cs
- CopyNamespacesAction.cs
- CodeAttributeArgumentCollection.cs
- XslAstAnalyzer.cs
- LogArchiveSnapshot.cs
- DictionaryTraceRecord.cs
- Point3DAnimationUsingKeyFrames.cs
- DataTableNameHandler.cs
- ContentPlaceHolder.cs
- OpCopier.cs
- XamlSerializationHelper.cs
- WebPartConnectVerb.cs
- ComplexTypeEmitter.cs
- SecureStringHasher.cs
- cryptoapiTransform.cs
- CodeExporter.cs
- Lock.cs
- Qualifier.cs
- SharedPersonalizationStateInfo.cs
- TaiwanCalendar.cs
- ServiceOperationViewControl.cs
- BinaryConverter.cs
- Comparer.cs
- BoundField.cs
- OutputCacheModule.cs
- errorpatternmatcher.cs
- GeometryCombineModeValidation.cs
- PriorityBindingExpression.cs
- DesignerPerfEventProvider.cs
- SqlDataReader.cs
- DockPatternIdentifiers.cs
- ButtonAutomationPeer.cs
- FormViewInsertEventArgs.cs
- TemplatePropertyEntry.cs
- Int32Animation.cs
- objectresult_tresulttype.cs
- OperationExecutionFault.cs
- ReliableOutputConnection.cs
- ComPlusContractBehavior.cs
- HtmlHead.cs
- RelatedCurrencyManager.cs
- GuidelineCollection.cs
- SkipQueryOptionExpression.cs
- Viewport2DVisual3D.cs
- DataGridViewCellParsingEventArgs.cs
- FlowDocumentReader.cs
- BaseParaClient.cs
- Normalization.cs
- CreateUserWizard.cs
- ColumnMapTranslator.cs
- Page.cs
- XmlILIndex.cs
- XmlDictionaryReader.cs
- InvalidPrinterException.cs
- NullableDecimalSumAggregationOperator.cs
- NavigationPropertyEmitter.cs
- StorageFunctionMapping.cs
- ObjectDataSourceDesigner.cs
- LateBoundBitmapDecoder.cs
- SqlUserDefinedTypeAttribute.cs
- CheckBox.cs
- FontSourceCollection.cs
- XamlBrushSerializer.cs
- SiteMapHierarchicalDataSourceView.cs
- InternalConfigHost.cs
- SamlAction.cs
- CmsUtils.cs
- PropertyMetadata.cs
- DbMetaDataFactory.cs
- CodeSnippetCompileUnit.cs
- RuntimeHandles.cs
- ClassValidator.cs
- _NTAuthentication.cs
- UnaryNode.cs