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
- Transform.cs
- XmlSchemaSequence.cs
- SqlParameterCollection.cs
- ServiceAuthorizationElement.cs
- ByteAnimationUsingKeyFrames.cs
- MemberDescriptor.cs
- RegionIterator.cs
- sqlstateclientmanager.cs
- ColorMatrix.cs
- MetadataUtil.cs
- ConfigXmlComment.cs
- IDReferencePropertyAttribute.cs
- ExpressionEvaluator.cs
- DrawingContextWalker.cs
- CurrentChangedEventManager.cs
- SequentialOutput.cs
- EventSinkActivityDesigner.cs
- StorageSetMapping.cs
- ServiceDescriptionData.cs
- ErrorTableItemStyle.cs
- Reference.cs
- XmlNamespaceDeclarationsAttribute.cs
- ErrorHandlerModule.cs
- DataSourceView.cs
- UndoManager.cs
- InstanceDescriptor.cs
- AddInActivator.cs
- DispatcherTimer.cs
- XmlTypeAttribute.cs
- CompositeTypefaceMetrics.cs
- Query.cs
- GeometryConverter.cs
- KeyValueInternalCollection.cs
- ViewStateAttachedPropertyFeature.cs
- XmlWrappingReader.cs
- XPathScanner.cs
- PathFigure.cs
- GridPattern.cs
- ExternalDataExchangeService.cs
- ScrollBarAutomationPeer.cs
- BasicCommandTreeVisitor.cs
- RangeValuePattern.cs
- WebPartExportVerb.cs
- IsolatedStorageFile.cs
- Byte.cs
- UIntPtr.cs
- StringDictionary.cs
- TextDecorationLocationValidation.cs
- DbDataReader.cs
- StrongNameIdentityPermission.cs
- DecodeHelper.cs
- AppSettingsReader.cs
- RepeatInfo.cs
- CustomErrorsSection.cs
- TrackBarRenderer.cs
- SmiEventStream.cs
- DoubleLinkList.cs
- NullEntityWrapper.cs
- StylusDownEventArgs.cs
- TypeDelegator.cs
- ObjectView.cs
- ToolStripSplitButton.cs
- UnicodeEncoding.cs
- RawTextInputReport.cs
- PenThreadPool.cs
- GroupItem.cs
- XmlQueryContext.cs
- SizeKeyFrameCollection.cs
- Button.cs
- Rect3DConverter.cs
- TypedTableGenerator.cs
- AuthenticationManager.cs
- DirectoryGroupQuery.cs
- ListManagerBindingsCollection.cs
- TemplatedAdorner.cs
- LinqExpressionNormalizer.cs
- ToolStripSeparator.cs
- Validator.cs
- DataGridViewImageColumn.cs
- ColumnMap.cs
- WebErrorHandler.cs
- LinqDataSourceSelectEventArgs.cs
- columnmapkeybuilder.cs
- CopyCodeAction.cs
- DataGridViewCellPaintingEventArgs.cs
- DBDataPermissionAttribute.cs
- ZoneMembershipCondition.cs
- TransformerInfoCollection.cs
- MD5CryptoServiceProvider.cs
- DataRowChangeEvent.cs
- BitmapCodecInfo.cs
- LambdaCompiler.Binary.cs
- DesignerCommandAdapter.cs
- WmlCalendarAdapter.cs
- XmlCharCheckingReader.cs
- SQLInt16.cs
- ConfigXmlText.cs
- NativeMethods.cs
- DataPointer.cs
- MsmqInputMessage.cs