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
- KeyGestureValueSerializer.cs
- DataBindingList.cs
- X500Name.cs
- RadioButtonPopupAdapter.cs
- FormattedTextSymbols.cs
- TraceSection.cs
- EventRecordWrittenEventArgs.cs
- AuthenticationService.cs
- CaretElement.cs
- CounterCreationData.cs
- SecurityDescriptor.cs
- MatrixStack.cs
- WorkflowInstanceSuspendedRecord.cs
- MoveSizeWinEventHandler.cs
- MessageSmuggler.cs
- ByteKeyFrameCollection.cs
- AutomationElementIdentifiers.cs
- DiscoveryCallbackBehavior.cs
- securitycriticaldataformultiplegetandset.cs
- Accessible.cs
- XmlRawWriter.cs
- CharacterShapingProperties.cs
- SecureConversationVersion.cs
- EventLogWatcher.cs
- WindowsScrollBarBits.cs
- ReceiveCompletedEventArgs.cs
- Literal.cs
- MaskedTextBox.cs
- TemplateKey.cs
- sqlstateclientmanager.cs
- NativeMethods.cs
- ChtmlImageAdapter.cs
- CursorConverter.cs
- ClassHandlersStore.cs
- DynamicRendererThreadManager.cs
- WsdlExporter.cs
- StringValueSerializer.cs
- GeneratedCodeAttribute.cs
- StateWorkerRequest.cs
- QueryOptionExpression.cs
- TrackBarRenderer.cs
- Executor.cs
- SecureStringHasher.cs
- ObjectSecurity.cs
- SHA256Managed.cs
- ObjectStateManager.cs
- SqlMethodTransformer.cs
- EnumerableCollectionView.cs
- PermissionRequestEvidence.cs
- UTF32Encoding.cs
- XmlUtil.cs
- SqlTriggerAttribute.cs
- ParameterToken.cs
- StrokeSerializer.cs
- ClockController.cs
- TableRow.cs
- KeyValueInternalCollection.cs
- RequestDescription.cs
- DesignerRegionCollection.cs
- DrawingBrush.cs
- SmtpNtlmAuthenticationModule.cs
- CombinedGeometry.cs
- ObjectIDGenerator.cs
- FrameworkContentElement.cs
- SignatureGenerator.cs
- DBSchemaTable.cs
- WebPageTraceListener.cs
- WebEventTraceProvider.cs
- Vector3DValueSerializer.cs
- DataGridRowsPresenter.cs
- MergeFilterQuery.cs
- FileReader.cs
- SHA512.cs
- HttpHandlerActionCollection.cs
- ImpersonationContext.cs
- SqlCaseSimplifier.cs
- TextElement.cs
- EntitySet.cs
- DetailsViewDeleteEventArgs.cs
- WebPartMenu.cs
- SqlFacetAttribute.cs
- TypeGeneratedEventArgs.cs
- SecurityUtils.cs
- ProfileService.cs
- KeyFrames.cs
- TraceSwitch.cs
- HScrollProperties.cs
- BeginStoryboard.cs
- QueuePropertyVariants.cs
- TableDetailsRow.cs
- URL.cs
- TypeSystem.cs
- Certificate.cs
- PerformanceCounterPermission.cs
- GenericTypeParameterBuilder.cs
- UInt16Storage.cs
- Menu.cs
- ZoomPercentageConverter.cs
- ValueTypeFixupInfo.cs
- InputLanguageManager.cs