Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / Documents / FixedSOMImage.cs / 1 / FixedSOMImage.cs
/*++ File: FixedSOMImage.cs Copyright (C) 2005 Microsoft Corporation. All rights reserved. Description: SOM object that wraps an image on the page. The corresponding markup element can be either an image or a Path with an ImageBrush History: 05/17/2005: [....] - Created --*/ namespace System.Windows.Documents { using System.Windows.Automation; using System.Windows.Controls; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Shapes; using System.Globalization; using System.Diagnostics; internal sealed class FixedSOMImage : FixedSOMElement { //-------------------------------------------------------------------- // // Constructors // //--------------------------------------------------------------------- #region Constructors private FixedSOMImage(Rect imageRect, GeneralTransform trans, Uri sourceUri, FixedNode node, DependencyObject o) : base(node, trans) { _boundingRect = trans.TransformBounds(imageRect); _source = sourceUri; _startIndex = 0; _endIndex = 1; _name = AutomationProperties.GetName(o); _helpText = AutomationProperties.GetHelpText(o); } #endregion Constructors //------------------------------------------------------------------- // // Public Methods // //--------------------------------------------------------------------- #region Public Methods public static FixedSOMImage Create(FixedPage page, Image image, FixedNode fixedNode) { Uri imageUri = null; if (image.Source is BitmapImage) { BitmapImage imageSource = image.Source as BitmapImage; imageUri = imageSource.UriSource; } else if (image.Source is BitmapFrame) { BitmapFrame imageSource = image.Source as BitmapFrame; imageUri = new Uri(imageSource.ToString(), UriKind.RelativeOrAbsolute); } Rect sourceRect = new Rect(image.RenderSize); GeneralTransform transform = image.TransformToAncestor(page); return new FixedSOMImage(sourceRect, transform, imageUri, fixedNode, image); } public static FixedSOMImage Create(FixedPage page, Path path, FixedNode fixedNode) { Debug.Assert(path.Fill is ImageBrush); ImageSource source = ((ImageBrush)(path.Fill)).ImageSource; Uri imageUri = null; if (source is BitmapImage) { BitmapImage imageSource = source as BitmapImage; imageUri = imageSource.UriSource; } else if (source is BitmapFrame) { BitmapFrame imageSource = source as BitmapFrame; imageUri = new Uri(imageSource.ToString(), UriKind.RelativeOrAbsolute); } Rect sourceRect = path.Data.Bounds; GeneralTransform trans = path.TransformToAncestor(page); return new FixedSOMImage(sourceRect, trans, imageUri, fixedNode, path); } #if DEBUG public override void Render(DrawingContext dc, string label, DrawDebugVisual debugVisual) { Pen pen = new Pen(Brushes.Yellow, 1); Rect rect = _boundingRect; rect.Inflate(5,5); dc.DrawRectangle(null, pen , rect); if (label != null && debugVisual == DrawDebugVisual.Paragraphs) { base.RenderLabel(dc, label); } } #endif #endregion Public Methods //-------------------------------------------------------------------- // // Internal Properties // //--------------------------------------------------------------------- #region Internal Properties internal Uri Source { get { return _source; } } internal String Name { get { return _name; } } internal String HelpText { get { return _helpText; } } #endregion Internal Properties //-------------------------------------------------------------------- // // Private Fields // //---------------------------------------------------------------------- #region Private Fields private Uri _source; private String _name; private String _helpText; #endregion Interanl Fields } } // 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
- ObjectStateEntryDbDataRecord.cs
- CacheOutputQuery.cs
- OleDbConnectionInternal.cs
- FileSystemInfo.cs
- WindowsSysHeader.cs
- SelectiveScrollingGrid.cs
- TimersDescriptionAttribute.cs
- SystemTcpConnection.cs
- ServiceDescriptionSerializer.cs
- HttpPostProtocolImporter.cs
- FrameworkObject.cs
- CodeNamespace.cs
- SQLChars.cs
- AssemblyFilter.cs
- Rect3DValueSerializer.cs
- Vector3DCollectionConverter.cs
- LayoutEngine.cs
- xmlsaver.cs
- DocumentPageTextView.cs
- SettingsProviderCollection.cs
- OracleException.cs
- ConnectionsZone.cs
- TemplatedWizardStep.cs
- GridPattern.cs
- TextDecoration.cs
- Metafile.cs
- CryptoStream.cs
- OdbcInfoMessageEvent.cs
- AppliesToBehaviorDecisionTable.cs
- ParsedAttributeCollection.cs
- XmlText.cs
- RequestQueryParser.cs
- XmlDocumentSerializer.cs
- EventDescriptor.cs
- UIAgentMonitorHandle.cs
- Size3D.cs
- SHA256.cs
- CompositeTypefaceMetrics.cs
- MetadataHelper.cs
- XmlQueryContext.cs
- GridProviderWrapper.cs
- RootProfilePropertySettingsCollection.cs
- _HeaderInfoTable.cs
- BaseParser.cs
- ForeignKeyConstraint.cs
- IdentifierCollection.cs
- FieldMetadata.cs
- login.cs
- WebHttpBinding.cs
- OperationPickerDialog.designer.cs
- LayoutManager.cs
- EditorAttribute.cs
- SmtpNetworkElement.cs
- Material.cs
- ManifestSignedXml.cs
- DrawingServices.cs
- WebPartDisplayMode.cs
- OleDbInfoMessageEvent.cs
- PageBuildProvider.cs
- HttpWriter.cs
- DataGridViewRowsAddedEventArgs.cs
- SafeNativeMethods.cs
- DesignerContextDescriptor.cs
- StaticResourceExtension.cs
- NullableFloatMinMaxAggregationOperator.cs
- ScriptServiceAttribute.cs
- URLAttribute.cs
- ExceptionUtil.cs
- DrawingGroupDrawingContext.cs
- WebPartVerbsEventArgs.cs
- Nullable.cs
- CrossSiteScriptingValidation.cs
- BookmarkList.cs
- LayoutExceptionEventArgs.cs
- HttpHandlerActionCollection.cs
- PictureBox.cs
- Trigger.cs
- DataTableReader.cs
- PointIndependentAnimationStorage.cs
- OutputScopeManager.cs
- SelectionHighlightInfo.cs
- ColorTranslator.cs
- DBSchemaRow.cs
- FormClosingEvent.cs
- ProcessModelInfo.cs
- CompositeDataBoundControl.cs
- Win32.cs
- DataServiceBuildProvider.cs
- ConstructorNeedsTagAttribute.cs
- Geometry.cs
- ExtractedStateEntry.cs
- ClientRoleProvider.cs
- AutomationAttributeInfo.cs
- SimpleExpression.cs
- TextTreeExtractElementUndoUnit.cs
- PropertyChangingEventArgs.cs
- SymmetricAlgorithm.cs
- StateItem.cs
- ContentTextAutomationPeer.cs
- CodeTypeParameterCollection.cs