Exemple #1
0
        /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.StringFormat3"]/*' />
        /// <devdoc>
        ///    <para>
        ///       Initializes a new instance of the <see cref='System.Drawing.StringFormat'/> class from the specified
        ///       existing <see cref='System.Drawing.StringFormat'/>.
        ///    </para>
        /// </devdoc>
        public StringFormat(StringFormat format)
        {
            if (format == null)
            {
                throw new ArgumentNullException("format");
            }

            int status = SafeNativeMethods.GdipCloneStringFormat(new HandleRef(format, format.nativeFormat), out nativeFormat);

            if (status != SafeNativeMethods.Ok)
            {
                throw SafeNativeMethods.StatusException(status);
            }
        }
Exemple #2
0
        /// <include file='doc\StringFormat.uex' path='docs/doc[@for="StringFormat.Clone"]/*' />
        /// <devdoc>
        ///    Creates an exact copy of this <see cref='System.Drawing.StringFormat'/>.
        /// </devdoc>
        public object Clone()
        {
            IntPtr cloneFormat = IntPtr.Zero;

            int status = SafeNativeMethods.GdipCloneStringFormat(new HandleRef(this, nativeFormat), out cloneFormat);

            if (status != SafeNativeMethods.Ok)
            {
                throw SafeNativeMethods.StatusException(status);
            }

            StringFormat newCloneStringFormat = new StringFormat(cloneFormat);

            return(newCloneStringFormat);
        }