Everything working fine
I need clear form on button click
some help?
- private void artikli_buttoni() //pice
- {
- SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=bss;Integrated Security=True");
- //SqlConnection con = new SqlConnection(cs);
- SqlCommand cmd = new SqlCommand("SELECT ime+'-'+cijena_sa_porezom, data FROM roba_usluge where grupa_artikala='Pice'", con);
- var da = new SqlDataAdapter(cmd);
- var ItemTable = new DataTable();
- da.Fill(ItemTable);
- con.Open();
- Int32 count = ItemTable.Rows.Count;
- con.Close();
- int top = 70;
- int left = 10;
- for (int i = 1; i <= count; i++)
- {
- Button button = new Button();
- button.Size = new Size(128, 128);
- button.BackColor = Color.Transparent;
- //button.FlatStyle = FlatStyle.Flat;
- button.FlatAppearance.BorderSize = 0;
- button.Font = new System.Drawing.Font("Trebuchet MS", 10);
- button.TextAlign = ContentAlignment.TopCenter;
- button.BackgroundImageLayout = ImageLayout.Zoom;
- button.Left = left;
- button.Top = top;
- button.Text = ItemTable.Rows[i - 1][0].ToString();
- if (ItemTable.Rows[i - 1][1] != null)
- {
- try
- {
- byte[] _byte = (byte[])ItemTable.Rows[i - 1][1];
- MemoryStream ms = new MemoryStream(_byte);
- button.BackgroundImage = System.Drawing.Image.FromStream(ms);//bilo image
- }
- catch { }
- }
- button.Click += new EventHandler(this.btn_Click);
- this.Controls.Add(button);
- if (i % 5 == 0)
- {
- left = 10;
- top += button.Height + 2;
- }
- else
- {
- left += button.Width + 2;
- }
- }
- }
Rafnas T PPosted May 25, 2018, 1:26 PM
Goran BibicPosted May 25, 2018, 12:18 PM
Goran BibicPosted May 25, 2018, 11:44 AM
Rafnas T PPosted May 25, 2018, 11:40 AM
Goran BibicPosted May 25, 2018, 11:31 AM
Goran BibicPosted May 25, 2018, 11:29 AM
Rafnas T PPosted May 25, 2018, 11:24 AM
Goran BibicPosted May 25, 2018, 11:22 AM