public PictureBoxObj(long clientID, long pictubeBoxID, PictureBoxStatus status) { this.DoubleBuffered = true; this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.ContainerControl | ControlStyles.OptimizedDoubleBuffer | ControlStyles.SupportsTransparentBackColor, true); _uniqueID = pictubeBoxID; _clientID = clientID; _status = status; }
private void SetPictureBoxStatus(PictureBox pictureBox, PictureBoxStatus newStatus) { try { Image[] map = new Image[] { Pg3bWindowsFormsApplication.Properties.Resources.GreyDot, Pg3bWindowsFormsApplication.Properties.Resources.GreenDot, Pg3bWindowsFormsApplication.Properties.Resources.RedDot }; PictureBoxStatus oldStatus = (PictureBoxStatus)pictureBox.Tag; if (newStatus > oldStatus) { pictureBox.Tag = newStatus; pictureBox.Image = map[(int)newStatus]; } } catch { pictureBox.Image = Pg3bWindowsFormsApplication.Properties.Resources.GreyDot; pictureBox.Tag = PictureBoxStatus.Unknown; } }
private void SetPicBoxStatusAsync(PictureBoxStatus.PicBoxStatus picBox, PictureBoxStatus.ImageState state) { if (picBox.InvokeRequired) { picBox.Invoke(new Action(delegate { picBox.CurrentStatus = state; })); } else { picBox.CurrentStatus = state; } }
private void SetPictureBoxStatus(PictureBox pictureBox, PictureBoxStatus newStatus) { try { Image[] map = new Image[] { Pg3bWindowsFormsApplication.Properties.Resources.GreyDot, Pg3bWindowsFormsApplication.Properties.Resources.GreenDot, Pg3bWindowsFormsApplication.Properties.Resources.RedDot }; PictureBoxStatus oldStatus = (PictureBoxStatus)pictureBox.Tag; if (newStatus > oldStatus) { pictureBox.Tag = newStatus; pictureBox.Image = map[(int)newStatus]; } } catch { pictureBox.Image = Pg3bWindowsFormsApplication.Properties.Resources.GreyDot; pictureBox.Tag = PictureBoxStatus.Unknown; } }