How can I crop the image by just clicking and dragging around the area that I would like to keep?


You can first select the image area you want to keep by using Dynamic Web TWAIN's OnImageAreaSelected event. Then call the Crop method in the OnMouseDoubleClick event to crop the image. When you double click the image, only the selected area is remained.

Code (C#):

int iLeft;
int iTop;
int iRight;
int iBottom;

public Form1()

private void Scan_Click(object sender, EventArgs e)

//crop the image
private void Crop()
     axDynamicWebTwain1.Crop(axDynamicWebTwain1.CurrentImageIndexInBuffer,iLeft,iTop, iRight, iBottom);

//fired when mouse selects an area on an image
private void axDynamicWebTwain1_OnImageAreaSelected(object sender, AxDYNAMICWEBTWAINCTRLLib._IDynamicWebTwainEvents_OnImageAreaSelectedEvent e)
     iLeft = e.left;
     iTop =;
     iRight = e.right;
     iBottom = e.bottom;            

//fired when mouse double clicks on an image
private void axDynamicWebTwain1_OnMouseDoubleClick(object sender, AxDYNAMICWEBTWAINCTRLLib._IDynamicWebTwainEvents_OnMouseDoubleClickEvent e)
      Crop(); //call the crop method
      iLeft = 0;
      iTop = 0;
      iRight = 0;
      iBottom = 0; 



Is this page helpful?

Leave a Reply

Your email address will not be published.