private void propertyGrid1_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { if (e.ChangedItem.Label == "ItemName") { TInterfaceElement ie = Screen.listitem[e.OldValue.ToString()]; Screen.listitem.Remove(e.OldValue.ToString()); Screen.listitem.Add(ie.ItemName, ie); int indx = cbElements.SelectedIndex; cbElements.Items.RemoveAt(indx); cbElements.Items.Insert(indx, ie); cbElements.SelectedIndex = indx; cbElements.Refresh(); } }
private void deleteToolStripMenuItem_Click(object sender, EventArgs e) { TInterfaceElement item = (TInterfaceElement)cbElements.SelectedItem; Screen.listitem.Remove(item.ItemName); cbElements.Items.Remove(item); item.Dispose(); if (cbElements.Items.Count > 0) { cbElements.SelectedIndex = 0; } else { propertyGrid1.SelectedObject = null; } }
public void CreateLabel() { Label lbl = new Label(); lbl.Parent = pnl; lbl.MouseDown += new MouseEventHandler(MouseDown); lbl.MouseMove += new MouseEventHandler(MouseMove); lbl.Text = "Label"; lbl.ContextMenuStrip = pmElement; lbl.Refresh(); TInterfaceElement item = new TInterfaceElement(); item.border = lbl; item.ItemName = "Label"; item.BackColor = VGA_COLOR.VGA_BLACK; item.FontColor = VGA_COLOR.VGA_WHITE; Boolean err = true; int i = 0; while (err) { try { listitem.Add(item.ItemName, item); lbl.Tag = item.ItemName; err = false; AddItem(item); } catch (Exception ee) { i++; item.ItemName = "Label" + i.ToString(); } } }
private void OnAddItem(TInterfaceElement item) { cbElements.Items.Add(item); cbElements.SelectedItem = item; }
public void LoadElements(System.Xml.XmlReader ids) { TInterfaceElement ie = new TInterfaceElement(); while (ids.Read()) { if (ids.IsStartElement()) { switch (ids.Name) { case "SCREEN_Width": { ids.Read(); Width = Convert.ToInt16(ids.Value); }; break; case "SCREEN_Height": { ids.Read(); Height = Convert.ToInt16(ids.Value); }; break; case "SCREEN_BackColor": { ids.Read(); BackColor = utftUtils.GetUTFTColor(ids.Value); }; break; case "SCREEN_FontColor": { ids.Read(); FontColor = utftUtils.GetUTFTColor(ids.Value); }; break; case "SCREEN_ABorderColor": { ids.Read(); ActiveBorderColor = utftUtils.GetUTFTColor(ids.Value); }; break; case "SCREEN_PBorderColor": { ids.Read(); PassiveBorderColor = utftUtils.GetUTFTColor(ids.Value); }; break; case "Desctop": { ids.Read(); Image = new System.Drawing.Bitmap(ids.Value); }; break; case "Element": ie = new TInterfaceElement(); break; case "ItemType": { ids.Read(); switch (ids.Value) { case "Border": { Button btn = new Button(); btn.Parent = pnl; btn.MouseDown += new MouseEventHandler(MouseDown); btn.MouseMove += new MouseEventHandler(MouseMove); btn.ContextMenuStrip = pmElement; btn.Text = "Border"; btn.Refresh(); ie.border = btn; } break; // button case "2": break; // edit case "Label": { Label lbl = new Label(); lbl.Parent = pnl; lbl.MouseDown += new MouseEventHandler(MouseDown); lbl.MouseMove += new MouseEventHandler(MouseMove); lbl.Text = "Label"; lbl.ContextMenuStrip = pmElement; lbl.Refresh(); ie.border = lbl; } break; // label case "4": break; // Checker } } break; case "ID": ids.Read(); ie.ID = Convert.ToByte(ids.Value); break; case "ItemName": ids.Read(); ie.ItemName = ids.Value; listitem.Add(ie.ItemName, ie); AddItem(ie); break; case "X": ids.Read(); ie.X = Convert.ToInt16(ids.Value); break; case "Y": ids.Read(); ie.Y = Convert.ToInt16(ids.Value); break; case "Width": ids.Read(); ie.width = Convert.ToInt16(ids.Value); break; case "Height": ids.Read(); ie.heigth = Convert.ToInt16(ids.Value); break; case "BackColor": ids.Read(); ie.BackColor = utftUtils.GetUTFTColor(ids.Value); break; case "FontColor": ids.Read(); ie.FontColor = utftUtils.GetUTFTColor(ids.Value); break; case "CanSelect": ids.Read(); ie.CanSelect = Convert.ToBoolean(ids.Value); break; case "Text": ids.Read(); ie.Text = ids.Value; break; } // ids.Name } //while } }
public void LoadElements(System.Xml.XmlReader ids) { TInterfaceElement ie = new TInterfaceElement(); while (ids.Read()) if (ids.IsStartElement()) { switch (ids.Name) { case "SCREEN_Width": { ids.Read(); Width = Convert.ToInt16(ids.Value); }; break; case "SCREEN_Height": { ids.Read(); Height = Convert.ToInt16(ids.Value); }; break; case "SCREEN_BackColor": { ids.Read(); BackColor = utftUtils.GetUTFTColor(ids.Value); }; break; case "SCREEN_FontColor": { ids.Read(); FontColor = utftUtils.GetUTFTColor(ids.Value); }; break; case "SCREEN_ABorderColor": { ids.Read(); ActiveBorderColor = utftUtils.GetUTFTColor(ids.Value); }; break; case "SCREEN_PBorderColor": { ids.Read(); PassiveBorderColor = utftUtils.GetUTFTColor(ids.Value); }; break; case "Desctop": { ids.Read(); Image = new System.Drawing.Bitmap(ids.Value); };break; case "Element": ie = new TInterfaceElement(); break; case "ItemType": { ids.Read(); switch (ids.Value) { case "Border": { Button btn = new Button(); btn.Parent = pnl; btn.MouseDown += new MouseEventHandler(MouseDown); btn.MouseMove += new MouseEventHandler(MouseMove); btn.ContextMenuStrip = pmElement; btn.Text = "Border"; btn.Refresh(); ie.border = btn; } break; // button case "2": break; // edit case "Label": { Label lbl = new Label(); lbl.Parent = pnl; lbl.MouseDown += new MouseEventHandler(MouseDown); lbl.MouseMove += new MouseEventHandler(MouseMove); lbl.Text = "Label"; lbl.ContextMenuStrip = pmElement; lbl.Refresh(); ie.border = lbl; } break; // label case "4": break; // Checker } } break; case "ID": ids.Read(); ie.ID = Convert.ToByte(ids.Value); break; case "ItemName": ids.Read(); ie.ItemName = ids.Value; listitem.Add(ie.ItemName, ie); AddItem(ie); break; case "X": ids.Read(); ie.X = Convert.ToInt16(ids.Value); break; case "Y": ids.Read(); ie.Y = Convert.ToInt16(ids.Value); break; case "Width": ids.Read(); ie.width = Convert.ToInt16(ids.Value); break; case "Height": ids.Read(); ie.heigth = Convert.ToInt16(ids.Value); break; case "BackColor": ids.Read(); ie.BackColor = utftUtils.GetUTFTColor(ids.Value); break; case "FontColor": ids.Read(); ie.FontColor = utftUtils.GetUTFTColor(ids.Value); break; case "CanSelect": ids.Read(); ie.CanSelect = Convert.ToBoolean(ids.Value); break; case "Text": ids.Read(); ie.Text = ids.Value; break; }// ids.Name }//while }
public void CreateLabel() { Label lbl = new Label(); lbl.Parent = pnl; lbl.MouseDown += new MouseEventHandler(MouseDown); lbl.MouseMove += new MouseEventHandler(MouseMove); lbl.Text = "Label"; lbl.ContextMenuStrip = pmElement; lbl.Refresh(); TInterfaceElement item = new TInterfaceElement(); item.border = lbl; item.ItemName = "Label"; item.BackColor = VGA_COLOR.VGA_BLACK; item.FontColor = VGA_COLOR.VGA_WHITE; Boolean err = true; int i = 0; while (err) try { listitem.Add(item.ItemName, item); lbl.Tag = item.ItemName; err = false; AddItem(item); } catch (Exception ee) { i++; item.ItemName = "Label" + i.ToString(); } }
public void CreateElement() { Button btn = new Button(); btn.Parent = pnl; btn.MouseDown += new MouseEventHandler(MouseDown); btn.MouseMove += new MouseEventHandler(MouseMove); btn.ContextMenuStrip = pmElement; btn.Text = "Border"; btn.Refresh(); TInterfaceElement item = new TInterfaceElement(); item.border = btn; item.ItemName = "Border"; item.BackColor = VGA_COLOR.VGA_BLACK; item.FontColor = VGA_COLOR.VGA_WHITE; Boolean err = true; int i = 0; while (err) try { listitem.Add(item.ItemName, item); btn.Tag = item.ItemName; err = false; AddItem(item); } catch (Exception ee) { i++; item.ItemName = "Border" + i.ToString(); } }