private void loadCurrentImageAnnotations() { if (capture.Position == capture.Length) { return; } drawingManager.Clear(); frame = capture.ReadAs <Bgr, byte>(); //the order is relevant (position is automatically increased) var imageKey = getCurrentImageKey(); if (Database.ContainsKey(imageKey)) { drawingManager.AddRange(Database[imageKey]); } this.pictureBox.Image = frame.ToBitmap(); pictureBox.Update(); this.Text = getCurrentImageKey() + " -> " + new FileInfo(databaseFileName).Name; this.slider.Value = (int)Math.Max(0, this.capture.Position - 1); this.slider.Maximum = (int)(capture.Length - 1); this.lblCurrentFrame.Text = this.slider.Value.ToString(); this.lblTotalFrames.Text = this.slider.Maximum.ToString(); }