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
- COM2Enum.cs
- PropertyHelper.cs
- ChameleonKey.cs
- HistoryEventArgs.cs
- Span.cs
- SequentialUshortCollection.cs
- KnownBoxes.cs
- AudienceUriMode.cs
- ToolStripDesigner.cs
- DataGridColumn.cs
- StatusBarItemAutomationPeer.cs
- SpeechSynthesizer.cs
- APCustomTypeDescriptor.cs
- GPRECTF.cs
- ScriptIgnoreAttribute.cs
- XhtmlStyleClass.cs
- ProtocolsSection.cs
- RequestCacheValidator.cs
- PropertyValueChangedEvent.cs
- PolicyException.cs
- GPStream.cs
- RectangleConverter.cs
- DataSourceHelper.cs
- EnumerableRowCollection.cs
- MergeFilterQuery.cs
- SourceCollection.cs
- InheritanceAttribute.cs
- HttpHandlerActionCollection.cs
- EnvelopedPkcs7.cs
- TextBoxLine.cs
- WindowsScroll.cs
- DistinctQueryOperator.cs
- DataStorage.cs
- PageParserFilter.cs
- DecoratedNameAttribute.cs
- KeyBinding.cs
- MSAANativeProvider.cs
- EncryptedReference.cs
- _ReceiveMessageOverlappedAsyncResult.cs
- ServiceProviders.cs
- Identity.cs
- UrlMappingsSection.cs
- ImportContext.cs
- DesignTimeParseData.cs
- EventSourceCreationData.cs
- JavascriptCallbackResponseProperty.cs
- ModuleBuilder.cs
- SmtpCommands.cs
- DataGridViewTextBoxEditingControl.cs
- SpeakInfo.cs
- PackWebResponse.cs
- HostedNamedPipeTransportManager.cs
- LayoutManager.cs
- SettingsBase.cs
- StickyNoteHelper.cs
- ClientSideProviderDescription.cs
- AsymmetricKeyExchangeDeformatter.cs
- _AutoWebProxyScriptHelper.cs
- DataRowView.cs
- CssTextWriter.cs
- MaskedTextBox.cs
- AuthenticationModuleElement.cs
- ZipFileInfoCollection.cs
- XmlNullResolver.cs
- Icon.cs
- SystemIcmpV4Statistics.cs
- CorrelationTokenInvalidatedHandler.cs
- EditingCoordinator.cs
- QueryOperationResponseOfT.cs
- ProcessInfo.cs
- ContentValidator.cs
- LocalizableResourceBuilder.cs
- FullTrustAssembliesSection.cs
- StructuredTypeInfo.cs
- Currency.cs
- DbConnectionPoolCounters.cs
- Size3DConverter.cs
- PersonalizationState.cs
- SiteMembershipCondition.cs
- XmlILConstructAnalyzer.cs
- InteropBitmapSource.cs
- ReflectionUtil.cs
- AspNetSynchronizationContext.cs
- RectangleConverter.cs
- DecimalAnimation.cs
- XmlDataProvider.cs
- Camera.cs
- TypeReference.cs
- TraceSource.cs
- WindowsUpDown.cs
- DesignerActionUIStateChangeEventArgs.cs
- CngKeyBlobFormat.cs
- PresentationSource.cs
- EDesignUtil.cs
- ActivityDesignerHelper.cs
- IIS7UserPrincipal.cs
- ThreadInterruptedException.cs
- ToolboxComponentsCreatedEventArgs.cs
- ScriptingJsonSerializationSection.cs
- latinshape.cs