コード例 #1
0
        //Template
        private void addTemplate(Point pp, String wine, int number)
        {
            Panel       p = new Panel();
            Button      b = new Button();
            RichTextBox t = new RichTextBox();

            b.Location  = new Point(15, 13);
            b.Size      = new Size(100, 102);
            b.BackColor = Color.Transparent;
            b.FlatStyle = FlatStyle.Flat;
            b.FlatAppearance.BorderSize = 0;
            b.BackgroundImage           = Vinhos.Properties.Resources._03c8c134458037de51c64988ae9bdc46;
            b.ImageAlign            = ContentAlignment.MiddleCenter;
            b.BackgroundImageLayout = ImageLayout.Zoom;


            b.Click += (sender, args) =>
            {
                Form7 form = new Form7(number);
                form.Location      = this.Location;
                form.StartPosition = FormStartPosition.Manual;
                form.FormClosing  += delegate { this.Show(); };
                form.Show();
                this.Hide();
            };

            String[] aux = wine.Split(' ');


            t.Location           = new Point(9, 122);
            t.BackColor          = Color.Gray;
            t.BorderStyle        = BorderStyle.None;
            t.SelectionAlignment = HorizontalAlignment.Center;
            t.Size     = new Size(115, 30);
            t.Font     = new Font("Arial", 8, FontStyle.Regular);
            t.WordWrap = true;
            String s = aux[0];

            if (aux.Length >= 2)
            {
                s = aux[0] + ' ' + aux[1];
            }
            String s2 = "";

            for (int i = 2; i < aux.Length; i++)
            {
                s2 = s2 + " " + aux[i];
            }

            t.Text = s + Environment.NewLine + s2;


            p.BackColor   = Color.Gray;
            p.Location    = pp;
            p.BorderStyle = BorderStyle.Fixed3D;
            p.Size        = new Size(129, 185);


            p.Controls.Add(b);
            p.Controls.Add(t);


            panel2.Controls.Add(p);
        }