Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Core / CSharp / System / Windows / Media / Effects / DropShadowEffect.cs / 1305600 / DropShadowEffect.cs
//------------------------------------------------------------------------------ // Microsoft Avalon // Copyright (c) Microsoft Corporation, 2007 // // File: DropShadowEffect.cs //----------------------------------------------------------------------------- using System; using System.Diagnostics; using System.Windows; using System.Windows.Media; namespace System.Windows.Media.Effects { ////// DropShadowEffect /// public partial class DropShadowEffect { #region Constructors ////// Constructor /// public DropShadowEffect() { } #endregion ////// Takes in content bounds, and returns the bounds of the rendered /// output of that content after the Effect is applied. /// internal override Rect GetRenderBounds(Rect contentBounds) { Point topLeft = new Point(); Point bottomRight = new Point(); double radius = BlurRadius; topLeft.X = contentBounds.TopLeft.X - radius; topLeft.Y = contentBounds.TopLeft.Y - radius; bottomRight.X = contentBounds.BottomRight.X + radius; bottomRight.Y = contentBounds.BottomRight.Y + radius; double depth = ShadowDepth; double direction = Math.PI/180 * Direction; double offsetX = depth * Math.Cos(direction); double offsetY = depth * Math.Sin(direction); // If the shadow is horizontally aligned or to the right of the original element... if (offsetX >= 0.0f) { bottomRight.X += offsetX; } // If the shadow is to the left of the original element... else { topLeft.X += offsetX; } // If the shadow is above the original element... if (offsetY >= 0.0f) { topLeft.Y -= offsetY; } // If the shadow is below the original element... else { bottomRight.Y -= offsetY; } return new Rect(topLeft, bottomRight); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- VisualTarget.cs
- CorrelationKey.cs
- RegistryKey.cs
- CodeGeneratorOptions.cs
- Matrix.cs
- DynamicDocumentPaginator.cs
- ConfigurationManagerInternalFactory.cs
- PlacementWorkspace.cs
- ReachSerializer.cs
- SafeRightsManagementPubHandle.cs
- BitArray.cs
- SafeProcessHandle.cs
- SoapConverter.cs
- DrawingGroup.cs
- ParameterReplacerVisitor.cs
- NoResizeHandleGlyph.cs
- CodeVariableReferenceExpression.cs
- HttpRequestCacheValidator.cs
- MessageRpc.cs
- DynamicPhysicalDiscoSearcher.cs
- SystemNetHelpers.cs
- EmptyControlCollection.cs
- HostUtils.cs
- HistoryEventArgs.cs
- WebAdminConfigurationHelper.cs
- HtmlContainerControl.cs
- FacetValues.cs
- DisableDpiAwarenessAttribute.cs
- FrameworkElementAutomationPeer.cs
- DockPatternIdentifiers.cs
- SByte.cs
- InnerItemCollectionView.cs
- HttpStreamMessage.cs
- Subtree.cs
- X509InitiatorCertificateClientElement.cs
- Clock.cs
- TextParagraphCache.cs
- Quaternion.cs
- Canvas.cs
- HyperLinkField.cs
- TextTreeTextNode.cs
- ModuleBuilderData.cs
- LineVisual.cs
- System.Data_BID.cs
- Accessible.cs
- DefaultWorkflowTransactionService.cs
- PeerApplicationLaunchInfo.cs
- TreeViewImageIndexConverter.cs
- TableItemPattern.cs
- ToolStripPanelRow.cs
- MemoryStream.cs
- SecurityPermission.cs
- InstanceKeyView.cs
- CngProvider.cs
- ComplexTypeEmitter.cs
- ControlAdapter.cs
- HttpCachePolicyElement.cs
- X509ChainPolicy.cs
- XmlUtil.cs
- HTMLTagNameToTypeMapper.cs
- SecureConversationServiceElement.cs
- ThemeableAttribute.cs
- CompileLiteralTextParser.cs
- ReadOnlyDictionary.cs
- Int64Storage.cs
- RectangleGeometry.cs
- SynchronizedInputPattern.cs
- InkCanvasFeedbackAdorner.cs
- ListItemCollection.cs
- ReaderWriterLockWrapper.cs
- PropertyValueChangedEvent.cs
- NotConverter.cs
- ContainerParagraph.cs
- ReadOnlyNameValueCollection.cs
- TextContainerChangeEventArgs.cs
- SRef.cs
- KnownTypeHelper.cs
- DesignerToolStripControlHost.cs
- LayoutEngine.cs
- CustomAttribute.cs
- GenericWebPart.cs
- SizeChangedEventArgs.cs
- ClientBuildManagerCallback.cs
- MobileListItemCollection.cs
- HostingEnvironment.cs
- DbSetClause.cs
- ExpressionLink.cs
- PasswordBoxAutomationPeer.cs
- SiteMapNodeItem.cs
- ReadOnlyAttribute.cs
- DataServiceRequest.cs
- TogglePattern.cs
- FontStyle.cs
- RectangleF.cs
- WinCategoryAttribute.cs
- DrawingImage.cs
- WebPartExportVerb.cs
- EntityParameter.cs
- MouseEvent.cs
- StringUtil.cs