public void Add(IDrawItem item) { if (!items.Contains(item)) { items.Add(item); } }
/// <summary> /// Adds a IDrawItem to this. /// </summary> /// <param name="item">The IDrawItem to be added.</param> public void AddDrawItem(IDrawItem item) { bool added = false; for (int i = 0; i < layers.Count; i++) { if (layers[i]._drawLayer == item.DrawLayer) { layers[i].Add(item); added = true; } } if (!added) { DrawLayerCollection drawn = new DrawLayerCollection(item.DrawLayer); drawn.Add(item); layers.Add(drawn); if (max < item.DrawLayer) { max = item.DrawLayer; } } }
public void MouseDown(Object sender, System.Windows.Forms.MouseEventArgs e) { //m_PictureBox.Parent.Select(); m_PictureBox.Focus(); bool flag = false; //是否有點到物件的標記 if (m_SelectedItem == null) { foreach (IDrawItem item in m_IDrawItemList) { if (item.IsContains(e.Location)) { m_SelectedItem = item; m_SelectedItem.IsControlPointVisible = true; flag = true; break; } } } else { //有選取物件 foreach (IDrawItem item in m_IDrawItemList) { if (item.Equals(m_SelectedItem) == false && item.IsContains(e.Location)) { m_SelectedItem.IsControlPointVisible = false; m_SelectedItem = item; m_SelectedItem.IsControlPointVisible = true; flag = true; break; } else if (item.Equals(m_SelectedItem) == true && item.IsCtlContains(e.Location)) { //控制點 if (item.SetCurrentCtl(e.Location) == true) { IsCtlPoint = true; //oldPrePoint = e.Location; //記錄物體坐標 oldPoint = e.Location; flag = true; break; } } } } if (flag == false && m_SelectedItem != null) { m_SelectedItem.IsControlPointVisible = false; m_SelectedItem = null; } ((PictureBox)sender).Refresh(); }
/// <summary> /// Removes a IDrawItem from this. /// </summary> /// <param name="item">The IDrawItem to be removed.</param> public void Remove(IDrawItem item) { for (int i = 0; i < layers.Count; i++) { if (layers[i]._drawLayer == item.DrawLayer) { layers[i].Remove(item); } } }
public void AddDrawItem(IDrawItem item) { _itemsToDraw.Add(item); var cb = new CheckBoxItem(item.SettingName()); _itemsShouldDraw.Add(item.SettingName(), false); cb.Tag = item.SettingName(); cb.Text = item.CheckBoxName(); if (pIniManager.GetBoolean("Radar", item.SettingName(), false)) { cb.Checked = true; _itemsShouldDraw[item.SettingName()] = true; } cb.Click += DrawItemClick; ControlSettings.Items.Add(cb); }
public void AddDrawItem(IDrawItem oItem) { if (!m_IDrawItemList.Contains(oItem)) { m_IDrawItemList.Add(oItem); //加入Paint事件 m_PictureBox.Paint += oItem.Paint; } else { throw new Exception("清單中已有該物件"); } if (m_PictureBox != null) { m_PictureBox.Refresh(); } }
public void Remove(IDrawItem item) { if (item is ObjectComponent) { for (int i = 0; i < items.Count; i++) { if (items[i] is ObjectComponent && ((ObjectComponent)items[i]).ID == ((ObjectComponent)item).ID) { items.Remove(item); } } } else if (items.Contains(item)) { items.Remove(item); } }
public bool RemoveDrawItem(IDrawItem oItem) { if (m_IDrawItemList.Contains(oItem)) { if (m_PictureBox != null) { //移除Paint事件 m_PictureBox.Paint -= oItem.Paint; m_PictureBox.Refresh(); } m_IDrawItemList.Remove(oItem); return(true); } else { return(false); } }
/// <summary> /// Adds an item to be drawn by this. /// </summary> /// <param name="item">The item to be drawn.</param> public static void Add(IDrawItem item) { layers.AddDrawItem(item); }
/// <summary> /// Removes an item from this. /// </summary> /// <param name="item">The item to be removed.</param> public static void Remove(IDrawItem item) { layers.Remove(item); }