コード例 #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     BSFrmAddMeal frm = new BSFrmAddMeal(this);
     frm.TopLevel = false;
     frm.AutoScroll = true;
     this.Controls.Add(frm);
     frm.FormBorderStyle = FormBorderStyle.None;
     frm.IsUpdate = false;
     
     frm.Show();
 }
コード例 #2
0
 private void btnEdit_Click(object sender, EventArgs e)
 {
     BSFrmAddMeal frm = new BSFrmAddMeal(this);
     frm.TopLevel = false;
     frm.AutoScroll = true;
     this.Controls.Add(frm);
     frm.FormBorderStyle = FormBorderStyle.None;
     frm.detail = detail;
     frm.IsUpdate = true;
     frm.bytes1 = FrmAddmeal_pictureBox1_bytes;
     frm.Show();
 }
コード例 #3
0
        private void dataGridView1_RowEnter(object sender, DataGridViewCellEventArgs e)
        {
            BSFrmAddMeal frm = new BSFrmAddMeal(this);
            detail.ID = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["ID"].Value);
            detail.Name = dataGridView1.Rows[e.RowIndex].Cells["Name"].Value.ToString();
            detail.Calories = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["Calories"].Value);
            detail.NutrientID = Convert.ToInt32(dataGridView1.Rows[e.RowIndex].Cells["NutrientID"].Value);

            byte[] bytes = (byte[])dataGridView1.Rows[e.RowIndex].Cells["Image"].Value;
            FrmAddmeal_pictureBox1_bytes = (byte[])dataGridView1.Rows[e.RowIndex].Cells["Image"].Value;
            if (bytes != null)
            {
                System.IO.MemoryStream ms = new System.IO.MemoryStream(bytes);
                pictureBox1.Image = Image.FromStream(ms);
            }
            else
            {
                pictureBox1.Image = null;
            }
            
            categories = bll.GetTagsWithMealID(detail.ID);
            dataGridView2.DataSource = categories;
            detail.Tags = categories;
        }