|
|
Hi, You can easily implement this behaviour by self. To do that you should create a derived class from PdfViewer and write the following code. Code:
public class MyPdfViewer : PdfViewer
{
//List containing the indices of the selected pages
private List<int> _selectedPages = new List<int>();
//Overrides the mouse down behaviour
protected override void OnMouseDown(MouseEventArgs e)
{
try
{
//Determines the page to the mouse coordinates
int pageIndex = this.PointInPage(e.Location);
if (pageIndex < 0)
{
//If click outside the page, but in the viewer, then deselect all pages
_selectedPages.Clear();
Invalidate();
return;
}
//if click inside selected page then do nothing
if (_selectedPages.Contains(pageIndex))
return;
//Add a new page into list of selected pages and invalidate the PdfViewer
_selectedPages.Add(pageIndex);
Invalidate();
}
finally
{
//Execute the base behaviour
base.OnMouseDown(e);
}
}
//Overrides the drawing of current page highlight
protected override void DrawCurrentPageHighlight(Graphics graphics, int pageIndex, Rectangle actualRect)
{
if (_selectedPages.Contains(pageIndex))
{
//if pageIndex inside a list of selected page, then highlight the border
using (var pen = new Pen(this.CurrentPageHighlightColor, 8))
{
actualRect.Inflate(0, 0);
var sm = graphics.SmoothingMode;
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
graphics.DrawRectangle(pen, actualRect);
graphics.SmoothingMode = sm;
}
}
}
}
|
|
|
Hello,
how can i enable multiselect for pages in the winform PDF viewer control?
f.e. the user should be able to select one or more pages to be deleted.
If the multiselect pages feature is not available is it possible to implement that?
Thanks in advance
|
Important Information:
The Patagames Software Support Forum uses cookies. By continuing to browse this site, you are agreeing to our use of cookies.
More Details
Close