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
- DocumentViewerHelper.cs
- TextTreeExtractElementUndoUnit.cs
- Regex.cs
- ButtonChrome.cs
- SpeakInfo.cs
- PaginationProgressEventArgs.cs
- ConfigurationPermission.cs
- BitmapEffectInputData.cs
- Drawing.cs
- LightweightCodeGenerator.cs
- UpdateException.cs
- ChildDocumentBlock.cs
- PagedDataSource.cs
- TextContainerChangeEventArgs.cs
- BrushValueSerializer.cs
- DmlSqlGenerator.cs
- ArithmeticException.cs
- ThreadExceptionDialog.cs
- SupportsPreviewControlAttribute.cs
- DataGridLinkButton.cs
- DataConnectionHelper.cs
- DeferredReference.cs
- EntityStoreSchemaGenerator.cs
- MemberAccessException.cs
- UnknownBitmapEncoder.cs
- DecodeHelper.cs
- ScrollBarRenderer.cs
- DashStyle.cs
- RegexNode.cs
- ConsumerConnectionPointCollection.cs
- UInt64Converter.cs
- AudioBase.cs
- ServicePoint.cs
- ServiceDescriptionImporter.cs
- XhtmlBasicValidationSummaryAdapter.cs
- StylusCaptureWithinProperty.cs
- Vector3DConverter.cs
- ReadOnlyTernaryTree.cs
- WebServiceFaultDesigner.cs
- ObsoleteAttribute.cs
- WebResourceAttribute.cs
- XmlReader.cs
- FrameworkPropertyMetadata.cs
- DesignerActionUIStateChangeEventArgs.cs
- Hex.cs
- DBParameter.cs
- _NativeSSPI.cs
- HtmlTextViewAdapter.cs
- EndpointNotFoundException.cs
- KeyEventArgs.cs
- PresentationAppDomainManager.cs
- RawStylusInputReport.cs
- ActivityExecutor.cs
- ModelEditingScope.cs
- SimpleType.cs
- InputScopeNameConverter.cs
- X509WindowsSecurityToken.cs
- Group.cs
- ClientSettingsStore.cs
- TraceSwitch.cs
- x509utils.cs
- InputProcessorProfilesLoader.cs
- DiscreteKeyFrames.cs
- UnwrappedTypesXmlSerializerManager.cs
- TraceRecord.cs
- QilName.cs
- DebuggerAttributes.cs
- Application.cs
- DbConnectionInternal.cs
- SkinBuilder.cs
- HandledEventArgs.cs
- SudsWriter.cs
- ApplicationGesture.cs
- SecurityState.cs
- PenThreadWorker.cs
- TemplatePagerField.cs
- Point4D.cs
- QuaternionKeyFrameCollection.cs
- BaseDataBoundControl.cs
- DataAdapter.cs
- IItemContainerGenerator.cs
- XmlTextReaderImplHelpers.cs
- ObjectViewEntityCollectionData.cs
- CustomError.cs
- SplitContainerDesigner.cs
- PropertyRecord.cs
- CaseExpr.cs
- Math.cs
- SourceLineInfo.cs
- AsyncCodeActivity.cs
- CatalogPartCollection.cs
- webeventbuffer.cs
- CounterSampleCalculator.cs
- DispatcherProcessingDisabled.cs
- HorizontalAlignConverter.cs
- RowToParametersTransformer.cs
- StreamReader.cs
- DocumentPaginator.cs
- ListControlBuilder.cs
- WindowsRichEditRange.cs