Exemple #1
0
        private void btnChooseConfig_Click(object sender, EventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();



            if (ofd.ShowDialog() == DialogResult.OK)
            {
                cbCharList.Items.Clear();
                string path     = ofd.FileName;
                string fileName = path.Substring(path.LastIndexOf("\\") + 1);
                this.lblShowConfigFile.Text = fileName;
                StreamReader sR    = File.OpenText(path);
                int          count = int.Parse(sR.ReadLine());
                this.lblItemNumber.Text = count.ToString();
                charList.Clear();
                for (int i = 0; i != count; i++)
                {
                    cbCharList.Items.Add(sR.ReadLine());
                    string s = sR.ReadLine();
                    //Font f = new Font(charList[i].fontFamily, charList[i].fontSize, charList[i].fs);

                    FontConverter x = new FontConverter();

                    Font           f         = x.ConvertFromString(s) as Font;
                    Color          c         = Color.FromArgb(int.Parse(sR.ReadLine()));
                    int            X         = int.Parse(sR.ReadLine());
                    int            Y         = int.Parse(sR.ReadLine());
                    int            alignment = int.Parse(sR.ReadLine());
                    PropertyOfChar poc       = new PropertyOfChar((int)f.Size, c, f.FontFamily.Name, f.Style, alignment, X, Y);
                    charList.Add(poc);
                }
                sR.Close();
                //sW.WriteLine(cbCharList.Items[i]);
                //
                //sW.WriteLine(charList[i].c.ToArgb());
                //sW.WriteLine(charList[i].X);
                //sW.WriteLine(charList[i].Y);

                //string strFontSize = sR.ReadLine();
                //this.fontSize = int.Parse(strFontSize);
                //this.lblFontSize.Text = fontSize.ToString();
                //MessageBox.Show(fontSize.ToString());
                //string strC = sR.ReadLine();
                //this.c = Color.FromArgb(int.Parse(strC));
                //this.pictureBox2.BackColor = c;
                //MessageBox.Show(c.Name);
                //string strFontFamily = sR.ReadLine();
                //this.fontFamily = strFontFamily;
                //MessageBox.Show(fontFamily.ToString());
                //this.pictureBox1.Invalidate();

                //sR.Close();
            }
        }
Exemple #2
0
        private void btnAddChar_Click(object sender, EventArgs e)
        {
            if (tbItemadded.Text != "")
            {
                this.cbCharList.Items.Add(tbItemadded.Text);
                this.lblItemNumber.Text = cbCharList.Items.Count.ToString();

                PropertyOfChar poc = new PropertyOfChar(10, Color.White, "Arial", FontStyle.Bold, 1, 10, 10);
                charList.Add(poc);
            }
            else
            {
                MessageBox.Show("No content input!!");
            }
        }