private void button2_Click(object sender, EventArgs e) { string path = ""; m_params.Strings[0] = textBox1.Text; m_params.Strings[1] = h.ToString(); m_params.Strings[2] = Encoding.Default.GetString(m_app.FontImages[m_fontIndex], 0, m_app.Fonts[m_fontIndex].NameEnd + 1); Form form = new FontCreator(m_params); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { if (MessageBox.Show("Replace the generated font?".Translate(), "Tips".Translate(), MessageBoxButtons.YesNo) == DialogResult.Yes) { path = m_params.Strings[0]; int count = Marshal.SizeOf(typeof(InfoFont)); StreamReader reader = new StreamReader(path); byte[] buffer = new byte[count]; reader.BaseStream.Read(buffer, 0, count); InfoFont infoFont = Utility.ToStruct <InfoFont>(buffer); m_app.Fonts[m_fontIndex] = infoFont; buffer = new byte[infoFont.Size]; reader.BaseStream.Read(buffer, 0, buffer.Length); m_app.FontImages[m_fontIndex] = buffer; reader.Close(); reader.Dispose(); showzi(); m_params.Strings[1] = "edit"; RefreshMe(); } } else { m_params.Strings[1] = ""; } }
private void button2_Click(object sender, EventArgs e) { string path = ""; m_params.Strings[0] = textBox1.Text; m_params.Strings[1] = h.ToString(); m_params.Strings[2] = Encoding.Default.GetString(m_app.FontImages[m_fontIndex], 0, m_app.Fonts[m_fontIndex].NameEnd + 1); Form form = new FontCreator(m_params); form.ShowDialog(); if (form.DialogResult == DialogResult.OK) { if (MessageBox.Show("Replace the generated font?".Translate(), "Tips".Translate(), MessageBoxButtons.YesNo) == DialogResult.Yes) { path = m_params.Strings[0]; int count = Marshal.SizeOf(typeof(InfoFont)); StreamReader reader = new StreamReader(path); byte[] buffer = new byte[count]; reader.BaseStream.Read(buffer, 0, count); InfoFont infoFont = Utility.ToStruct<InfoFont>(buffer); m_app.Fonts[m_fontIndex] = infoFont; buffer = new byte[infoFont.Size]; reader.BaseStream.Read(buffer, 0, buffer.Length); m_app.FontImages[m_fontIndex] = buffer; reader.Close(); reader.Dispose(); showzi(); m_params.Strings[1] = "edit"; RefreshMe(); } } else { m_params.Strings[1] = ""; } }