千千静听的字体保存为如下字符串:-13,0,0,0,700,0,0,0,134,3,2,4,49,幼圆
如何用此字符串构造一个Font
哪位朋友能指点指点,多谢多谢!

解决方案 »

  1.   

    LZ 可以用 可序列化 用2进制生成 object 
    同时font 在propergridview 中只有9个数据 
    都是int Color等 分别保存到文本就可以了
    我刚刚做了一个demo 可行性分析是没有问题的
      

  2.   

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;namespace WindowsFormsApplication73
    {
        public partial class Form1 : Form
        {
            [DllImport("gdi32")]
            static extern IntPtr CreateFontW(
                        Int32 nHeight,
                        Int32 nWidth,
                        Int32 nEscapement,
                        Int32 nOrientation,
                        Int32 fnWeight,
                        UInt32 fdwItalic,
                        UInt32 fdwUnderline,
                        UInt32 fdwStrikeOut,
                        UInt32 fdwCharSet,
                        UInt32 fdwOutputPrecision,
                        UInt32 fdwClipPrecision,
                        UInt32 fdwQuality,
                        UInt32 fdwPitchAndFamily,
                        IntPtr lpszFace);        public Form1()
            {
                InitializeComponent();            Label L1 = new Label();
                L1.Parent = this;
                L1.Text = "默认的字体";            Label L2 = new Label();
                L2.Parent = this;
                L2.Location = new Point(0, 30);
                L2.Font = Font.FromHfont(CreateFontW(-13, 0, 0, 0, 700, 0, 0, 0, 134, 3, 2, 4, 49, Marshal.UnsafeAddrOfPinnedArrayElement("幼圆".ToCharArray(), 0)));
                L2.Text = "幼圆字体";
            }
        }
    }