Rounded button?
Existing code is ok
- private void Form1_Load(object sender, EventArgs e)
- {
- // TODO: This line of code loads data into the 'bssDataSet.roba_usluge' table. You can move, or remove it, as needed.
- this.roba_uslugeTableAdapter.Fill(this.bssDataSet.roba_usluge);
- SqlConnection con = new SqlConnection("Data Source=.\\SQLEXPRESS;Initial Catalog=bss;Integrated Security=True");
-
- SqlCommand cmd = new SqlCommand("SELECT ime+'-'+cijena_sa_porezom, data FROM roba_usluge", con);
- // Getting all the data to ItemTable
- var da = new SqlDataAdapter(cmd);
- var ItemTable = new DataTable();
- da.Fill(ItemTable);
- con.Open();
- Int32 count = ItemTable.Rows.Count;
- con.Close();
- int top = 50;
- int left = 50;
- for (int i = 1; i <= count; i++)
- // for (int i = 0; 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);
- }
- catch { }
- }
- button.Click += new EventHandler(this.btn_Click);
- this.Controls.Add(button);
- if (i % 5 == 0)
- {
- left = 50;
- top += button.Height + 2;
- }
- else
- {
- left += button.Width + 2;
- }
- }
- }

Rafnas T PRank #280 · 8.8K reputationPosted Apr 8, 2018, 9:54 PM EDT
Rafnas T PRank #280 · 8.8K reputationPosted Apr 8, 2018, 10:11 PM EDT
with
Rafnas T PRank #280 · 8.8K reputationPosted Apr 8, 2018, 10:37 PM EDT
Rafnas T PRank #280 · 8.8K reputationPosted Apr 8, 2018, 10:42 PM EDT
Rafnas T PRank #280 · 8.8K reputationPosted Apr 8, 2018, 11:07 PM EDT
Goran BibicRank #993 · 2K reputationPosted Apr 8, 2018, 10:21 PM EDT
Goran BibicRank #993 · 2K reputationPosted Apr 8, 2018, 10:43 PM EDT
Goran BibicRank #993 · 2K reputationPosted Apr 8, 2018, 10:55 PM EDT
Goran BibicRank #993 · 2K reputationPosted Apr 8, 2018, 11:01 PM EDT
Rafnas T PRank #280 · 8.8K reputationPosted Apr 8, 2018, 11:09 PM EDT
Goran BibicRank #993 · 2K reputationPosted Apr 8, 2018, 11:09 PM EDT