Example #1
0
        public void AddString(string s, FontFamily family, int style, float emSize, RectangleF layoutRect, StringFormat? format)
        {
            if (family == null)
                throw new ArgumentException(nameof(family));

            IntPtr sformat = (format == null) ? IntPtr.Zero : format.nativeFormat;
            // note: the NullReferenceException on s.Length is the expected (MS) exception
            int status = Gdip.GdipAddPathString(_nativePath, s, s.Length, family.NativeFamily, style, emSize, ref layoutRect, sformat);
            Gdip.CheckStatus(status);
        }
Example #2
0
        public void AddString(string s, FontFamily family, int style, float emSize, RectangleF layoutRect, StringFormat?format)
        {
            ArgumentNullException.ThrowIfNull(family);

            Gdip.CheckStatus(Gdip.GdipAddPathString(
                                 new HandleRef(this, _nativePath),
                                 s,
                                 s.Length,
                                 new HandleRef(family, family?.NativeFamily ?? IntPtr.Zero),
                                 style,
                                 emSize,
                                 ref layoutRect,
                                 new HandleRef(format, format?.nativeFormat ?? IntPtr.Zero)));
        }