Пример #1
0
        public DWriteTextLayout CreateTextLayout(string text, DWriteTextFormat textFormat, float maxWidth, float maxHeight)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text");
            }

            if (textFormat == null)
            {
                throw new ArgumentNullException("textFormat");
            }

            IDWriteTextLayout textLayout;

            this.handle.CreateTextLayout(text, (uint)text.Length, (IDWriteTextFormat)textFormat.Handle, maxWidth, maxHeight, out textLayout);
            return(new DWriteTextLayout(textLayout));
        }
        public DWriteTextLayout CreateTextLayout(string text, DWriteTextFormat textFormat, float maxWidth, float maxHeight)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text");
            }

            if (textFormat == null)
            {
                throw new ArgumentNullException("textFormat");
            }

            IDWriteTextLayout textLayout;
            this.handle.CreateTextLayout(text, (uint)text.Length, (IDWriteTextFormat)textFormat.Handle, maxWidth, maxHeight, out textLayout);
            return new DWriteTextLayout(textLayout);
        }
        public void DrawText(string text, DWriteTextFormat textFormat, D2D1RectF layoutRect, D2D1Brush defaultForegroundBrush, D2D1DrawTextOptions options, DWriteMeasuringMode measuringMode)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text");
            }

            if (textFormat == null)
            {
                throw new ArgumentNullException("textFormat");
            }

            if (defaultForegroundBrush == null)
            {
                throw new ArgumentNullException("defaultForegroundBrush");
            }

            this.GetHandle<ID2D1RenderTarget>().DrawText(text, (uint)text.Length, (IDWriteTextFormat)textFormat.Handle, ref layoutRect, defaultForegroundBrush.GetHandle<ID2D1Brush>(), options, measuringMode);
        }