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
- CommandID.cs
- FormCollection.cs
- TextRangeEdit.cs
- SqlCacheDependencyDatabase.cs
- ExpandableObjectConverter.cs
- TdsParser.cs
- RtfFormatStack.cs
- HttpProtocolReflector.cs
- XamlPathDataSerializer.cs
- CommaDelimitedStringAttributeCollectionConverter.cs
- BodyGlyph.cs
- TypeResolvingOptions.cs
- FileDialogCustomPlacesCollection.cs
- MiniConstructorInfo.cs
- KeyPullup.cs
- DateTimeParse.cs
- CapabilitiesState.cs
- DataRelationPropertyDescriptor.cs
- ThreadAttributes.cs
- HtmlElementErrorEventArgs.cs
- ListViewHitTestInfo.cs
- ContextMenuStripGroupCollection.cs
- LocalizableAttribute.cs
- CodeDomSerializerBase.cs
- SafeFileMappingHandle.cs
- LayoutSettings.cs
- DataGridItemEventArgs.cs
- EntityDataSourceContextCreatingEventArgs.cs
- SystemIPAddressInformation.cs
- TCPClient.cs
- ResourceType.cs
- DesignerView.cs
- PeerTransportBindingElement.cs
- FtpCachePolicyElement.cs
- DataBinding.cs
- ValueSerializerAttribute.cs
- PropertyDescriptorGridEntry.cs
- SafeRightsManagementQueryHandle.cs
- SelectionRangeConverter.cs
- PerformanceCountersElement.cs
- BindingWorker.cs
- DefaultValueConverter.cs
- Trigger.cs
- OciEnlistContext.cs
- FixUp.cs
- DataErrorValidationRule.cs
- XmlStreamNodeWriter.cs
- Base64Stream.cs
- FormClosingEvent.cs
- CopyNodeSetAction.cs
- HostVisual.cs
- LayoutExceptionEventArgs.cs
- _NativeSSPI.cs
- GlyphCollection.cs
- UIElementAutomationPeer.cs
- TouchesCapturedWithinProperty.cs
- SystemIPGlobalProperties.cs
- DesignerRegion.cs
- XhtmlBasicPhoneCallAdapter.cs
- XmlSchemaAnnotation.cs
- Html32TextWriter.cs
- HtmlHistory.cs
- HeaderUtility.cs
- XmlSerializationReader.cs
- DataControlLinkButton.cs
- Viewport3DAutomationPeer.cs
- DurableErrorHandler.cs
- XmlObjectSerializerWriteContextComplex.cs
- Margins.cs
- HttpWriter.cs
- WebRequestModuleElement.cs
- XmlHierarchicalDataSourceView.cs
- FileDetails.cs
- KeyTimeConverter.cs
- Schema.cs
- TextContainerHelper.cs
- CapabilitiesUse.cs
- EditBehavior.cs
- UncommonField.cs
- XmlBufferedByteStreamReader.cs
- DataGridLinkButton.cs
- DocumentOutline.cs
- BinaryFormatter.cs
- IsolatedStorageSecurityState.cs
- ClientEventManager.cs
- ExtensionQuery.cs
- ConstNode.cs
- DataGridViewCheckBoxCell.cs
- MetabaseServerConfig.cs
- TransformProviderWrapper.cs
- MenuItemStyle.cs
- WMIGenerator.cs
- DefaultWorkflowTransactionService.cs
- HttpMethodConstraint.cs
- FieldTemplateUserControl.cs
- AffineTransform3D.cs
- NumberFunctions.cs
- TypedElement.cs
- WindowsFormsLinkLabel.cs
- DataShape.cs