private void pcBox_Click(object sender, EventArgs e) { PictureBox pb = ((PictureBox)sender); if (_currentSlideTextIdx >= 0) { _slideTexts[_currentSlideTextIdx].BackColor = _itemNormalBg; _slideTexts[_currentSlideTextIdx].ForeColor = _itemNormalFg; _currentSlideTextIdx = -1; } if (ImageClicked != null) { Focus(); SlideImageClickEventArgs p = new SlideImageClickEventArgs((IBackground)pb.Tag); ImageClicked(this, p); } }
private void textLbl_Click(object sender, EventArgs e) { Button lbl = ((Button)sender); if (_currentSlideTextIdx >= 0) { _slideTexts[_currentSlideTextIdx].BackColor = _itemNormalBg; _slideTexts[_currentSlideTextIdx].ForeColor = _itemNormalFg; } int newSlideIdx = _slideTexts.IndexOf(lbl); if (_currentSlideTextIdx < newSlideIdx) { int tOffset = ((Panel)lbl.Parent).Parent.Bottom; if (tOffset + VerticalScroll.Value > Height) { VerticalScroll.Value = tOffset + VerticalScroll.Value - Height + 2; } PerformLayout(); } else { int tOffset = ((Panel)lbl.Parent).Parent.Top; if (tOffset < 0) { VerticalScroll.Value += tOffset - 5; } PerformLayout(); } _currentSlideTextIdx = newSlideIdx; lbl.BackColor = _itemActiveBg; lbl.ForeColor = _itemActiveFg; var bg = lbl.Tag as IBackground; if (bg != null) { if (ImageClicked != null) { Focus(); SlideImageClickEventArgs p = new SlideImageClickEventArgs(bg); ImageClicked(this, p); } } else { if (SlideClicked != null) { Focus(); var partNumber = (int)lbl.Parent.Parent.Tag; var slideNumber = (int)lbl.Tag; SlideClickEventArgs p = new SlideClickEventArgs(_currentSong, partNumber, slideNumber); p.isFirst = _currentSlideTextIdx == 0; p.isLast = _currentSlideTextIdx == _slideTexts.Count - 1; SlideClicked(this, p); } } }