public void DrawString(string str, double x, double y, StringAlignment align, Size layoutRect, StringColorType colorType = StringColorType.Forground)
        {
            if (this.render == null || this.render.IsDisposed)
            {
                return;
            }
            float dpix, dpiy;

            D2D.SolidColorBrush brush;
            switch (colorType)
            {
            case StringColorType.Forground:
                brush = this._factory.GetSolidColorBrush(this.Foreground);
                break;

            case StringColorType.LineNumber:
                brush = this._factory.GetSolidColorBrush(this.LineNumber);
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            this.GetDpi(out dpix, out dpiy);
            MyTextLayout layout = this._factory.GetTextLayout(str, this.format, (float)layoutRect.Width, (float)layoutRect.Height, dpix, false);

            layout.StringAlignment = align;
            layout.Draw(this.render, (float)x, (float)y, brush);
            layout.Dispose();
        }
        public const int MiniumeWidth = 40;    //これ以上ないと誤操作が起こる

        public void InitTextFormat(string fontName, float fontSize, DW.FontWeight fontWeigth = DW.FontWeight.Normal, DW.FontStyle fontStyle = DW.FontStyle.Normal)
        {
            if (this.format != null)
            {
                this.format.Dispose();
            }

            float dpix, dpiy;

            this.GetDpi(out dpix, out dpiy);

            float fontSizeInDIP = fontSize * (dpix / 72.0f);

            this.format = this._factory.GetTextFormat(fontName, fontSizeInDIP, fontWeigth, fontStyle);
            this.format.WordWrapping     = DW.WordWrapping.NoWrap;
            this.format.ReadingDirection = GetDWRightDirect(_RightToLeft);

            MyTextLayout layout = this._factory.GetTextLayout("0", this.format, float.MaxValue, float.MaxValue, dpix, false);

            layout.RightToLeft = false;
            this.emSize        = new Size(layout.Width, layout.Height);
            layout.Dispose();

            this.TabWidthChar = this.TabWidthChar;

            this.hasCache = false;

            layout             = this._factory.GetTextLayout("+", this.format, float.MaxValue, float.MaxValue, dpix, false);
            layout.RightToLeft = false;
#if METRO
            this.FoldingWidth = Math.Max(D2DRenderCommon.MiniumeWidth, layout.Width);
#else
            this.FoldingWidth = layout.Width;
#endif
            layout.Dispose();

            this._factory.Clear();

            this.OnChangedRenderResource(this, new ChangedRenderRsourceEventArgs(ResourceType.Font));
        }