Esempio n. 1
0
        /// <summary>
        /// Add embedded delete button control to list view
        /// </summary>
        /// <param name="listViewItemEx"></param>
        private void AddEmbeddedControlToListView(ListViewItemEx listViewItemEx)
        {
            TransparentButton deleteButton = new TransparentButton();

            deleteButton.BackColor             = System.Drawing.Color.Transparent;
            deleteButton.BackgroundImage       = global::Cii.Lar.Properties.Resources.delete;
            deleteButton.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Center;
            deleteButton.Name = "removeButton";
            deleteButton.Size = new System.Drawing.Size(16, 16);
            deleteButton.Tag  = listViewItemEx;
            listViewItemArray.AddItem(listViewItemEx.ListViewItem);
            StatisticsControl.StatisticsListView.AddEmbeddedControl(deleteButton, 3, listViewItemArray.Count - 1);
            deleteButton.Click += DeleteButton_Click;
        }
Esempio n. 2
0
        /// <summary>
        /// Delete button click event
        /// delete listviewitem and draw object graphic
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DeleteButton_Click(object sender, EventArgs e)
        {
            TransparentButton deleteButton = sender as TransparentButton;

            if (deleteButton != null)
            {
                deleteButton.Click -= DeleteButton_Click;
                ListViewItemEx listViewItemEx = (ListViewItemEx)deleteButton.Tag;
                listViewItemArray.DeleteItem(listViewItemEx.ListViewItem);
                StatisticsControl.StatisticsListView.Items.Remove(listViewItemEx.ListViewItem);
                StatisticsControl.StatisticsListView.Invalidate();
                DeleteDrawObject(listViewItemEx.DrawObject);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Append new list view item to StatisticsListView items
 /// </summary>
 /// <param name="drawObject"></param>
 /// <param name="statistics"></param>
 private void AppendItems(DrawObject drawObject, Statistics statistics)
 {
     if (this.drawObject == null || drawObject.Name != this.drawObject.Name)
     {
         try
         {
             this.drawObject = drawObject;
             ListViewItem lvi = new ListViewItem();
             lvi.Text = drawObject.Name;
             lvi.SubItems.Add(statistics.Circumference.ToString());
             lvi.SubItems.Add(statistics.Area.ToString());
             StatisticsControl.StatisticsListView.Items.Add(lvi);
             ListViewItemEx listViewItemEx = new ListViewItemEx(lvi, drawObject);
             AddEmbeddedControlToListView(listViewItemEx);
             EnableAppearanceButton();
         }
         catch (Exception ee)
         {
             LogHelper.GetLogger <ZWPictureBox>().Error(ee.Message);
             LogHelper.GetLogger <ZWPictureBox>().Error(ee.StackTrace);
         }
     }
 }