Beispiel #1
0
        /// <summary>
        /// Draw the text using the FieldWorks IVwGraphicsWin32 interface.
        /// </summary>
        /// <remarks>Only used with Mono</remarks>
        private void DrawFwText(Graphics graphics, Rectangle cellBounds,
                                string text, DataGridViewCellStyle cellStyle, FwTextBoxColumn col)
        {
            Debug.Assert(Platform.IsMono, "This method is only needed on Mono");
            if (String.IsNullOrEmpty(text))
            {
                return;
            }
            IntPtr           hdc = graphics.GetHdc();
            IVwGraphicsWin32 vg  = VwGraphicsWin32Class.Create();               // actually VwGraphicsCairo

            try
            {
                vg.Initialize(hdc);
                var renderProps = GetRenderProps(cellStyle, col);
                vg.SetupGraphics(ref renderProps);
                int x;
                int y;
                GetLocationForText(cellBounds, (col.TextBoxControl.RightToLeft == RightToLeft.Yes),
                                   vg, text, out x, out y);
                vg.PushClipRect(cellBounds);
                vg.DrawText(x, y, text.Length, text, 0);
                vg.PopClipRect();
            }
            finally
            {
                vg.ReleaseDC();
                graphics.ReleaseHdc(hdc);
            }
        }
Beispiel #2
0
        protected void ProcessSetupGraphics(IEnumerable <string> arguments)
        {
            Debug.Assert(arguments.Count() == 14);

            LgCharRenderProps props = new LgCharRenderProps();

            props.clrFore = uint.Parse(arguments.First());
            arguments     = arguments.Skip(1);

            props.clrBack = uint.Parse(arguments.First());
            arguments     = arguments.Skip(1);

            props.clrUnder = uint.Parse(arguments.First());
            arguments      = arguments.Skip(1);

            props.dympOffset = int.Parse(arguments.First());
            arguments        = arguments.Skip(1);

            props.ws  = int.Parse(arguments.First());
            arguments = arguments.Skip(1);

            props.fWsRtl = byte.Parse(arguments.First());
            arguments    = arguments.Skip(1);

            props.nDirDepth = int.Parse(arguments.First());
            arguments       = arguments.Skip(1);

            props.ssv = int.Parse(arguments.First());
            arguments = arguments.Skip(1);

            props.unt = int.Parse(arguments.First());
            arguments = arguments.Skip(1);

            props.ttvBold = int.Parse(arguments.First());
            arguments     = arguments.Skip(1);

            props.ttvItalic = int.Parse(arguments.First());
            arguments       = arguments.Skip(1);

            props.dympHeight = int.Parse(arguments.First());
            arguments        = arguments.Skip(1);

            props.szFaceName = new ushort[32];
            for (int ich = 0; ich < arguments.First().Length; ++ich)
            {
                props.szFaceName[ich] = (ushort)arguments.First()[ich];
            }
            if (arguments.First().Length < 32)
            {
                props.szFaceName[arguments.First().Length] = 0;
            }
            else
            {
                props.szFaceName[31] = 0;
            }

            arguments = arguments.Skip(1);

            props.szFontVar = new ushort[64];
            for (int ich = 0; ich < arguments.First().Length; ++ich)
            {
                props.szFontVar[ich] = (ushort)arguments.First()[ich];
            }
            if (arguments.First().Length < 64)
            {
                props.szFontVar[arguments.First().Length] = 0;
            }
            else
            {
                props.szFontVar[63] = 0;
            }
            arguments = arguments.Skip(1);

            m_vwGraphics32.SetupGraphics(ref props);

            // all argument should be used up.
            Debug.Assert(arguments.Count() == 0);
        }