Code:
                         / FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / CommonUI / System / Drawing / Advanced / SizeF.cs / 1 / SizeF.cs
                        
                        
                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
//  
//----------------------------------------------------------------------------- 
/*************************************************************************\ 
* 
* Copyright (c) 1998-1999, Microsoft Corp.  All Rights Reserved.
* 
* Module Name:
*
*   SizeF.cs
* 
* Abstract:
* 
*   Floating-point coordinate size class 
*
* Revision History: 
*
*   12/14/1998 davidx
*       Created it.
* 
\**************************************************************************/
 
namespace System.Drawing { 
    using System.Diagnostics; 
    using System;
    using System.IO;
    using Microsoft.Win32; 
    using System.ComponentModel;
    using System.Diagnostics.CodeAnalysis; 
    using System.Globalization; 
    /** 
     * Represents a dimension in 2D coordinate space
     */
    ///  
    ///    
    ///       Represents the size of a rectangular region 
    ///       with an ordered pair of width and height. 
    ///     
    ///   
    [Serializable]
    [System.Runtime.InteropServices.ComVisible(true)]
    [TypeConverter(typeof(SizeFConverter))]
    [SuppressMessage("Microsoft.Usage", "CA2225:OperatorOverloadsHaveNamedAlternates")] 
    public struct SizeF {
 
        /// 
        ///    Initializes a new instance of the  
        public static readonly SizeF Empty = new SizeF();
        private float width;
        private float height; 
 
        /** 
         * Create a new SizeF object from another size object
         */ 
        /// 
        ///    Initializes a new instance of the  
        public SizeF(SizeF size) { 
            width = size.width; 
            height = size.height;
        } 
        /**
         * Create a new SizeF object from a point
         */ 
        ///  
        ///     
        ///       Initializes a new instance of the  
        ///  
        public SizeF(PointF pt) {
            width = pt.X; 
            height = pt.Y;
        } 
 
        /**
         * Create a new SizeF object of the specified dimension 
         */
        /// 
        ///     
        ///       Initializes a new instance of the   
        ///  
        public SizeF(float width, float height) { 
            this.width = width;
            this.height = height;
        }
 
        ///  
        ///     
        ///       Performs vector addition of two   
        ///  
        public static SizeF operator +(SizeF sz1, SizeF sz2) {
            return Add(sz1, sz2);
        } 
        ///  
        ///    
        ///       Contracts a  
        ///  
        public static SizeF operator -(SizeF sz1, SizeF sz2) { 
            return Subtract(sz1, sz2);
        } 
 
        ///  
        ///    Tests whether two  
        public static bool operator ==(SizeF sz1, SizeF sz2) { 
            return sz1.Width == sz2.Width && sz1.Height == sz2.Height;
        } 
 
        ///  
        ///    
        ///       Tests whether two  
        ///   
        public static bool operator !=(SizeF sz1, SizeF sz2) {
            return !(sz1 == sz2); 
        } 
        /// 
        ///    
        ///       Converts the specified  
        ///   
        public static explicit operator PointF(SizeF size) { 
            return new PointF(size.Width, size.Height);
        } 
        /// 
        ///     
        ///       Tests whether this   
        ///  
        [Browsable(false)] 
        public bool IsEmpty {
            get {
                return width == 0 && height == 0;
            } 
        }
 
        /** 
         * Horizontal dimension
         */ 
        /// 
        ///    
        ///       Represents the horizontal component of this 
        ///      
        ///   
        public float Width {
            get { 
                return width;
            }
            set {
                width = value; 
            }
        } 
 
        /**
         * Vertical dimension 
         */
        /// 
        ///     
        ///       Represents the vertical component of this
        ///      
        ///  
        public float Height { 
            get {
                return height;
            }
            set { 
                height = value;
            } 
        } 
        ///  
        ///    
        ///       Performs vector addition of two  
        ///   
        public static SizeF Add(SizeF sz1, SizeF sz2) {
            return new SizeF(sz1.Width + sz2.Width, sz1.Height + sz2.Height); 
        } 
        /// 
        ///    
        ///       Contracts a  
        ///   
        public static SizeF Subtract(SizeF sz1, SizeF sz2) { 
            return new SizeF(sz1.Width - sz2.Width, sz1.Height - sz2.Height);
        } 
        /// 
        ///     
        ///       Tests to see whether the specified object is a
        ///     
        ///   
        public override bool Equals(object obj) {
            if (!(obj is SizeF))
                return false;
 
            SizeF comp = (SizeF)obj;
 
            return(comp.Width == this.Width) && 
            (comp.Height == this.Height) &&
            (comp.GetType().Equals(GetType())); 
        }
        ///  
        ///    [To be supplied.] 
        ///   
        public override int GetHashCode() { 
            return base.GetHashCode();
        } 
        /// 
        ///    [To be supplied.]  
        ///  
        public PointF ToPointF() { 
            return (PointF) this; 
        }
 
        /// 
        ///    [To be supplied.] 
        ///   
        public Size ToSize() {
            return Size.Truncate(this); 
        } 
        /// 
        ///    
        ///       Creates a human-readable string that represents this
        ///     
        ///   
        public override string ToString() { 
            return "{Width=" + width.ToString(CultureInfo.CurrentCulture) + ", Height=" + height.ToString(CultureInfo.CurrentCulture) + "}";
        } 
    }
}
 
// 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
- ListViewUpdateEventArgs.cs
- Types.cs
- _NegoState.cs
- EntityDataSourceDesigner.cs
- SmiRequestExecutor.cs
- DesignerActionVerbList.cs
- OpacityConverter.cs
- BufferBuilder.cs
- DecimalConstantAttribute.cs
- ToolStripDesigner.cs
- Exceptions.cs
- DbInsertCommandTree.cs
- DetailsViewDeletedEventArgs.cs
- AccessKeyManager.cs
- CryptoHelper.cs
- WindowsEditBoxRange.cs
- TextTreeTextBlock.cs
- GeneralTransformGroup.cs
- ResourceIDHelper.cs
- SiteOfOriginPart.cs
- PartialToken.cs
- Wizard.cs
- IisTraceListener.cs
- XmlDocumentSerializer.cs
- WindowsSolidBrush.cs
- SystemWebExtensionsSectionGroup.cs
- SystemColorTracker.cs
- objectquery_tresulttype.cs
- TypefaceMetricsCache.cs
- TargetParameterCountException.cs
- InstanceKeyView.cs
- ValidatingReaderNodeData.cs
- EventDrivenDesigner.cs
- StorageModelBuildProvider.cs
- MetadataUtil.cs
- wgx_render.cs
- DataObjectEventArgs.cs
- ButtonChrome.cs
- XmlDocumentType.cs
- FileDataSourceCache.cs
- MoveSizeWinEventHandler.cs
- VirtualDirectoryMapping.cs
- RowUpdatedEventArgs.cs
- MetaDataInfo.cs
- ConfigurationCollectionAttribute.cs
- ManagedFilter.cs
- ResourceDictionary.cs
- Column.cs
- Internal.cs
- Function.cs
- ContainerParaClient.cs
- DependencyObject.cs
- DbProviderFactoriesConfigurationHandler.cs
- Floater.cs
- Scene3D.cs
- PeerNodeTraceRecord.cs
- WebPartZoneBase.cs
- GroupBoxRenderer.cs
- MultiDataTrigger.cs
- SmiMetaDataProperty.cs
- Selection.cs
- ServiceHost.cs
- Pen.cs
- StreamingContext.cs
- Encoding.cs
- BCLDebug.cs
- HandlerFactoryCache.cs
- FormViewModeEventArgs.cs
- FontUnitConverter.cs
- HeaderCollection.cs
- UInt64Converter.cs
- XPathAncestorIterator.cs
- XmlObjectSerializerWriteContextComplex.cs
- RbTree.cs
- Logging.cs
- StreamedWorkflowDefinitionContext.cs
- InfoCardRSAOAEPKeyExchangeDeformatter.cs
- Registry.cs
- PickBranch.cs
- TCPClient.cs
- InheritanceContextChangedEventManager.cs
- TypeInfo.cs
- ProfileBuildProvider.cs
- WindowsTab.cs
- TextDecoration.cs
- StylusPointProperty.cs
- ParameterElementCollection.cs
- CalendarButton.cs
- MemberDescriptor.cs
- InternalConfigHost.cs
- CheckableControlBaseAdapter.cs
- StructuralType.cs
- Border.cs
- ActivityInterfaces.cs
- XmlTypeMapping.cs
- ZipIOLocalFileBlock.cs
- PtsHost.cs
- DataGridRow.cs
- CfgParser.cs
- ContextActivityUtils.cs