public void AddImage(Point position, Bitmap image, string roomName, string iconDesc) { //RoomAvatars.AddFirst(new ImageBox(ImageBoxProperties.RoomIcons[0],ImageBoxProperties.width,ImageBoxProperties.height)); ImageBox imageBox = new ImageBox(image, Globals.ImageBoxProperties.width, Globals.ImageBoxProperties.height); imageBox.RoomName = roomName; imageBox.Icon = iconDesc; RoomAvatars.AddFirst(imageBox); AvatarMap.Add(roomName, imageBox); position.X += ViewPort.ViewX; position.Y += ViewPort.ViewY; RoomAvatars.First.Value.Location = position; //ImageBox image = RoomImages.First.Value; //UUUM, WHY DID I PUT THIS HERE? ResizeMaxAreaDimensions(); }
/// <summary> /// Returns true is the given ImageBox's center is within the given rect. /// </summary> private bool IsRoomInRect(ImageBox image, Rectangle rect) { rect.X += ViewPort.ViewX; rect.Y += ViewPort.ViewY; int xMidPoint = image.Location.X + (Globals.ImageBoxProperties.width / 2); int yMidPoint = image.Location.Y + (Globals.ImageBoxProperties.height / 2); //basically all we need to find is if the center point of the image //is within the given rect if (xMidPoint > rect.Left && xMidPoint < rect.Right && yMidPoint > rect.Top && yMidPoint < rect.Bottom) { return(true); } return(false); }
public void SetTarget(ImageBox target) { if (refTarget != null && refTarget != refSource) { refTarget.RemoveFromConnections(this); } if (target == null) { refTarget = refSource; } else { refTarget = target; refTarget.AddToConnections(this); } }
public bool OnActivateImage(string roomName) { bool selected = false; ImageBox temp = null; foreach (ImageBox image in RoomAvatars) { if (!selected && roomName == image.RoomName) { image.Mode = ImageBoxRenderMode.Active; selected = true; temp = image; } else { image.Mode = ImageBoxRenderMode.Normal; } } refActiveImage = temp; //swap the image to the front of the list //that way it gets rendered on top if (selected) { RoomAvatars.Remove(temp); RoomAvatars.AddFirst(refActiveImage); if (RoomSelectEvent != null) { RoomSelectEvent(this, new StringEventArgs(refActiveImage.RoomName)); } } else { if (RoomSelectEvent != null) { RoomSelectEvent(this, new StringEventArgs(null)); } } return(selected); }