Esempio n. 1
0
        //窗口加载
        private void SetFontParaForm_Load(object sender, EventArgs e)
        {
            int nRet = CSharpInterface.HS_GetFontPara(ref m_fontPara);

            if (nRet != 0)
            {
                MessageBox.Show("读取字体数数据失败!\n返回值:" + nRet.ToString() + "\n错误信息:"
                                + CSharpInterface.GetError().ToString(), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.Close();
            }
            m_nType       = m_nFontType = m_fontPara.naFontType;
            m_strFontName = new String(m_fontPara.szFontName);
            m_strShxCN    = new String(m_fontPara.szShxCN);
            m_strShxEN    = new String(m_fontPara.szShxEN);
            m_strShxNum   = new String(m_fontPara.szShxNum);

            if (m_nFontType == 0)
            {
                m_lf.lfFaceName = System.Text.Encoding.Default.GetBytes(m_fontPara.szFontName.ToString());
            }
            else if (m_nFontType == 1)
            {
                m_strFontCHS = new String(m_fontPara.szShxCN);
                m_strFontEN  = new String(m_fontPara.szShxEN);
                m_strFontNUM = new String(m_fontPara.szShxNum);
            }
            else if (m_nFontType == 2)
            {
                m_strFontUser = new String(m_fontPara.szFontName);
            }
            else if (m_nFontType == 3)
            {
                m_strHzkType = new String(m_fontPara.szShxCN);
                m_strAscType = new String(m_fontPara.szShxEN);
            }

            UpdateData(false);

            //初始化字体信息
            DirectoryInfo dircinfo1 = new DirectoryInfo(CSharpInterface.g_strPathName + "\\PFonts\\");

            foreach (FileInfo fileinfo1 in dircinfo1.GetFiles())
            {
                this.cmbCHS.Items.Add(fileinfo1.Name.Remove(fileinfo1.Name.LastIndexOf(".")));
            }
            cmbCHS.SelectedText = m_strFontCHS;

            DirectoryInfo dircinfo2 = new DirectoryInfo(CSharpInterface.g_strPathName + "\\EFonts\\");

            foreach (FileInfo fileinfo2 in dircinfo2.GetFiles())
            {
                this.cmbEN.Items.Add(fileinfo2.Name.Remove(fileinfo2.Name.LastIndexOf(".")));
                this.cmbNUM.Items.Add(fileinfo2.Name.Remove(fileinfo2.Name.LastIndexOf(".")));
            }
            cmbEN.SelectedText  = m_strFontEN;
            cmbNUM.SelectedText = m_strFontNUM;

            DirectoryInfo dircinfo3 = new DirectoryInfo(CSharpInterface.g_strPathName + "\\Font\\");

            foreach (FileInfo fileinfo3 in dircinfo3.GetFiles())
            {
                this.cmbUser.Items.Add(fileinfo3.Name.Remove(fileinfo3.Name.LastIndexOf(".")));
            }
            cmbUser.SelectedText = m_strFontUser;

            cmbMatrixEnNum.Items.Add("5*7");
            cmbMatrixEnNum.Items.Add("8*16");
            cmbMatrixCHS.Items.Add("12*12");
            cmbMatrixCHS.Items.Add("14*14");
            cmbMatrixCHS.Items.Add("16*16");

            UpdateDataView();
        }