private void createRes(string ResourceType) { //Mobile Resource creator resPic[j] = new ResourcePictureBox(); resPic[j].Size = new Size(30, 30); //I use this picturebox simply to debug and see if I can create a single picturebox, and that way I can tell if something goes wrong with my array of pictureboxes. Thus far however, neither are working. if (ResourceType == "computer") { resPic[j].Image = Properties.Resources.computer; resPic[j].ResType = "computer"; } else if (ResourceType == "mobile") { resPic[j].Image = Properties.Resources.mobile; resPic[j].ResType = "mobile"; } else if (ResourceType == "keyboard") { resPic[j].Image = Properties.Resources.keyboard; resPic[j].ResType = "keyboard"; } else if (ResourceType == "printer") { resPic[j].Image = Properties.Resources._5572; resPic[j].ResType = "printer"; } resPic[j].SizeMode = PictureBoxSizeMode.StretchImage; resPic[j].BackColor = Color.Transparent; //resPic[j].BackgroundImage = Properties.Resources.computer; resPic[j].BackgroundImageLayout = ImageLayout.Stretch; resPic[j].Location = new Point(0, 0); resPic[j].MouseDown += new MouseEventHandler(resPic_MouseDown); resPic[j].MouseUp += new MouseEventHandler(resPic_MouseUp); resPic[j].MouseMove += new MouseEventHandler(resPic_MouseMove); resPic[j].MouseHover += new EventHandler(resPic_MouseHover); resPic[j].Tag = j; resPic[j].LocationChanged += new EventHandler(resPic_LC); //pb.Anchor = AnchorStyles.Left; resPic[j].Visible = true; //pictureBox1.Controls.Add(resPic[j]); ResourcesBay.Controls.Add(resPic[j]); j++; ClearMyAccessPanel(); }
public Res() { InitializeComponent(); BaseMap.SendToBack(); for (int i = 0; i < 50; i++) { resPic[i] = new ResourcePictureBox(); cubPic[i] = new CustomPictureBox(); //pictureBox1.Paint += new PaintEventHandler(panelArea_Paint); } }
private void createRes(string ResourceNo, string ResourceType, string AssignedEmpNo, string DateOfIssue, string AssignedCubNo, string ResourceState, string OtherInformation, int ParentTag) { //Mobile Resource creator resPic[j] = new ResourcePictureBox(); resPic[j].Size = new Size(30, 30); //I use this picturebox simply to debug and see if I can create a single picturebox, and that way I can tell if something goes wrong with my array of pictureboxes. Thus far however, neither are working. if (ResourceType == "computer") { resPic[j].Image = Properties.Resources.computer; resPic[j].ResType = "computer"; } else if (ResourceType == "mobile") { resPic[j].Image = Properties.Resources.mobile; resPic[j].ResType = "mobile"; } else if (ResourceType == "keyboard") { resPic[j].Image = Properties.Resources.keyboard; resPic[j].ResType = "keyboard"; } else if (ResourceType == "printer") { resPic[j].Image = Properties.Resources._5572; resPic[j].ResType = "printer"; } resPic[j].DateOfIssue = DateOfIssue; resPic[j].AssCubNo = AssignedCubNo; resPic[j].AssEmpNo = AssignedEmpNo; resPic[j].ResNo = ResourceNo; resPic[j].ResType = ResourceType; resPic[j].ResState = ResourceState; resPic[j].OtherInfo = OtherInformation; resPic[j].SizeMode = PictureBoxSizeMode.StretchImage; resPic[j].BackColor = Color.Transparent; //resPic[j].BackgroundImage = Properties.Resources.computer; resPic[j].BackgroundImageLayout = ImageLayout.Stretch; resPic[j].Location = new Point(0, 0); resPic[j].MouseDown += new MouseEventHandler(resPic_MouseDown); resPic[j].MouseUp += new MouseEventHandler(resPic_MouseUp); resPic[j].MouseMove += new MouseEventHandler(resPic_MouseMove); resPic[j].MouseHover += new EventHandler(resPic_MouseHover); resPic[j].Tag = j; resPic[j].LocationChanged += new EventHandler(resPic_LC); //pb.Anchor = AnchorStyles.Left; resPic[j].Visible = true; //pictureBox1.Controls.Add(resPic[j]); if (ParentTag == -1) { ResourcesBay.Controls.Add(resPic[j]); } else { cubPic[ParentTag].Controls.Add(resPic[j]); } j++; }