void NewSs(Page item, Sensor s) { SensorS ss = new SensorS(); ss.X = 64; ss.Y = 64; ss.Uid = s.Uid; ss.Node = s.NodeId; ss.Port = s.PortId; ss.Sensor = s; item.Sensors.Add(ss); NewPb(item, ss); }
void NewPb(Page item, SensorS ss) { PicBox pb = new PicBox(ss); pb.Cursor = Cursors.Hand; pb.Parent = this; pb.Location = new Point(ss.X, ss.Y); item.Pbs.Add(pb); pb.DoubleClick += Pb_DoubleClick; pb.MouseEnter += Pb_MouseEnter; pb.MouseDown += Pb_MouseDown; pb.MouseUp += Pb_MouseUp; pb.MouseMove += Pb_MouseMove; }
public PicBox(SensorS s) { this.Size = new Size(64, 64); this.BackgroundImage = Image.FromFile("ico.png");//Properties.Resources.ico;// this.BackColor = Color.Transparent; this.BackgroundImageLayout = ImageLayout.Stretch; this.Ss = s; this.Label = new Label(); this.Label.Parent = this; this.Label.Text = s.Node; //this.Label.ForeColor = Color.White; this.Label.Anchor = AnchorStyles.Bottom & AnchorStyles.Right; this.Label.AutoSize = true; this.Label.Location = new Point(this.Width - this.Label.Width - 4, this.Size.Height - this.Label.Height - 5); //this.Label.Location = new Point(32, 32); }