Ejemplo n.º 1
0
        private void btn_AddAZ_Click(object sender, EventArgs e)
        {
            Bitmap   b  = new Bitmap(20, 20);
            Bitmap   p  = new Bitmap(20, 20);
            Graphics g1 = Graphics.FromImage(b);

            //for (int k = 0; k < dom_Letter.Items.Count/6; k++)
            //{
            //    g1.DrawString(dom_Letter.Items[k].ToString(), new Font("Arial", 18), new SolidBrush(Color.Black), -3, -4);
            //    _HLR.AddPattern(b);
            //}
            foreach (char c in txt_All.Text.ToCharArray())
            {
                //g1.Clear(Color.FromArgb(0,0,0,0));
                b  = new Bitmap(20, 20);
                p  = new Bitmap(20, 20);
                g1 = Graphics.FromImage(b);
                g1.DrawString(c.ToString(), new Font("Arial", 18), new SolidBrush(Color.Black), -3, -4);
                for (int i = 0; i < 20; i++)
                {
                    for (int j = 0; j < 20; j++)
                    {
                        //g.FillRectangle(new SolidBrush((b.GetPixel(i, j)==Color.White)?Color.White:Color.Blue), i * s.X, j * s.Y, s.X, s.Y);
                        if (HLR.CtoI(b.GetPixel(i, j)) > 0)
                        {
                            p.SetPixel(i, j, Color.FromArgb(255, 0, 0, 0));
                        }
                        //g.FillRectangle(new SolidBrush(b.GetPixel(i, j)), i * s.X, j * s.Y, s.X, s.Y);
                    }
                }
                _HLR.AddPattern(p);
            }
        }
Ejemplo n.º 2
0
        private void btn_MSB_Click(object sender, EventArgs e)
        {
            Bitmap answer = (Bitmap)_HLR.Patterns[_HLR.MatchMSB()].Clone();

            selectedPoints.Clear();
            for (int i = 0; i < 20; i++)
            {
                for (int j = 0; j < 20; j++)
                {
                    //g.FillRectangle(new SolidBrush((b.GetPixel(i, j)==Color.White)?Color.White:Color.Blue), i * s.X, j * s.Y, s.X, s.Y);
                    if (HLR.CtoI(answer.GetPixel(i, j)) > 0)
                    {
                        selectedPoints.Add(new Point(i, j));
                    }
                    //g.FillRectangle(new SolidBrush(b.GetPixel(i, j)), i * s.X, j * s.Y, s.X, s.Y);
                }
            }
            g.Clear(pictureBox1.BackColor);
            ReDraw();
        }
Ejemplo n.º 3
0
        private void btn_Draw_Click(object sender, EventArgs e)
        {
            g.Clear(pictureBox1.BackColor);
            Bitmap   b  = new Bitmap(20, 20);
            Graphics g1 = Graphics.FromImage(b);

            g1.DrawString(dom_Letter.Text, new Font("Arial", 18), new SolidBrush(Color.Black), -3, -4);
            s = new Point((pictureBox1.Width / 20), (pictureBox1.Height / 20));
            selectedPoints.Clear();
            for (int i = 0; i < 20; i++)
            {
                for (int j = 0; j < 20; j++)
                {
                    //g.FillRectangle(new SolidBrush((b.GetPixel(i, j)==Color.White)?Color.White:Color.Blue), i * s.X, j * s.Y, s.X, s.Y);
                    if (HLR.CtoI(b.GetPixel(i, j)) > 0)
                    {
                        selectedPoints.Add(new Point(i, j));
                    }
                    //g.FillRectangle(new SolidBrush(b.GetPixel(i, j)), i * s.X, j * s.Y, s.X, s.Y);
                }
            }
            ReDraw();
        }