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
- WriterOutput.cs
- ToolStripProgressBar.cs
- DispatcherHookEventArgs.cs
- EventMappingSettingsCollection.cs
- SimpleBitVector32.cs
- DispatchWrapper.cs
- EntityContainerAssociationSet.cs
- _BaseOverlappedAsyncResult.cs
- DocumentGridPage.cs
- CanonicalFormWriter.cs
- NamespaceCollection.cs
- LinearGradientBrush.cs
- ContainerFilterService.cs
- OleAutBinder.cs
- PeerReferralPolicy.cs
- IdentityReference.cs
- PartDesigner.cs
- XmlWriterDelegator.cs
- TriggerActionCollection.cs
- PropertySourceInfo.cs
- HandlerBase.cs
- ParallelEnumerable.cs
- ParentUndoUnit.cs
- ObjectViewQueryResultData.cs
- ColumnTypeConverter.cs
- TimerExtension.cs
- SplitContainer.cs
- FrameworkElementAutomationPeer.cs
- EventLogSession.cs
- IISUnsafeMethods.cs
- LinkedList.cs
- IFlowDocumentViewer.cs
- AnnotationResourceChangedEventArgs.cs
- DocumentAutomationPeer.cs
- DbConnectionHelper.cs
- XmlElement.cs
- RegexWorker.cs
- validation.cs
- GeneralTransform3DTo2D.cs
- CatalogZoneDesigner.cs
- TrackingRecordPreFilter.cs
- XmlQueryOutput.cs
- RegionIterator.cs
- HtmlTernaryTree.cs
- RawAppCommandInputReport.cs
- DataGridSortCommandEventArgs.cs
- ExpressionPrinter.cs
- OdbcInfoMessageEvent.cs
- StylusShape.cs
- HtmlWindow.cs
- WebPartRestoreVerb.cs
- SqlIdentifier.cs
- References.cs
- ListView.cs
- ColorDialog.cs
- SemanticAnalyzer.cs
- IApplicationTrustManager.cs
- ByteStorage.cs
- WeakRefEnumerator.cs
- XdrBuilder.cs
- TemplateColumn.cs
- TrackBarRenderer.cs
- EncoderNLS.cs
- FrameworkContextData.cs
- TraceContextEventArgs.cs
- MarkupCompiler.cs
- SmiMetaDataProperty.cs
- DbConnectionStringBuilder.cs
- XmlCharCheckingWriter.cs
- RenamedEventArgs.cs
- WindowsScroll.cs
- HtmlInputButton.cs
- RotationValidation.cs
- ScriptManagerProxy.cs
- XpsInterleavingPolicy.cs
- NativeObjectSecurity.cs
- CheckBoxList.cs
- ObjectHelper.cs
- XsltFunctions.cs
- TemplatePropertyEntry.cs
- TemplatePropertyEntry.cs
- ListSortDescriptionCollection.cs
- InternalSafeNativeMethods.cs
- XPathAxisIterator.cs
- UseLicense.cs
- DelegatingTypeDescriptionProvider.cs
- TextBoxAutoCompleteSourceConverter.cs
- DataServiceConfiguration.cs
- AutoResetEvent.cs
- PersistenceContext.cs
- UnmanagedHandle.cs
- TileBrush.cs
- TransportSecurityHelpers.cs
- Rotation3DAnimationBase.cs
- CodeExpressionStatement.cs
- EmptyEnumerable.cs
- VarInfo.cs
- ConfigDefinitionUpdates.cs
- FilteredAttributeCollection.cs
- SynchronizingStream.cs