Ho l'immagine WritableBitmap
e ho impostato il controllo immagine src. Sto creando rettangolo quando l'utente si sposta nell'area di testo selezionata. Sto anche usando PDFtron SDK
per ottenere il testo selezionato dal documento PDF. stiamo ottenendo l'immagine WritableBitmap
da PDF. Dobbiamo selezionare il testo in linea.Come selezionare o evidenziare il testo sull'evento di spostamento del mouse in WritableBitmap in wpf C#
Sto usando questo codice per disegnare lo schermo:
System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle((int)Math.Min(_downX, x),
(int)Math.Min(_downY, y),
(int)Math.Abs(_downX - x),
(int)Math.Abs(_downY - y));
System.Drawing.Bitmap myBitmap = new System.Drawing.Bitmap(@"D:\PDF\ScreenDraw\WpfApplication1\WpfApplication1\Image\Capture.PNG");
using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(myBitmap))
{
System.Drawing.Color customColor = System.Drawing.Color.FromArgb(50, System.Drawing.Color.Red);
System.Drawing.SolidBrush shadowBrush = new System.Drawing.SolidBrush(customColor);
g.FillRectangles(shadowBrush, new System.Drawing.Rectangle[] { rectangle });
}
//myBitmap.Save(@"D:\PDF\abc.png");
//bitmapSource = new BitmapImage(new Uri(@"D:\PDF\abc.png", UriKind.Absolute));
using (var memory = new System.IO.MemoryStream())
{
myBitmap.Save(memory, System.Drawing.Imaging.ImageFormat.Png);
memory.Position = 0;
var bitmapImage = new BitmapImage();
bitmapImage.BeginInit();
bitmapImage.StreamSource = memory;
bitmapImage.CacheOption = BitmapCacheOption.OnLoad;
bitmapImage.EndInit();
Img.Source = bitmapImage;
}
Come posso selezionare il testo con la linea di saggio non un Rect
saggio?
Devo selezionare il testo come mostrato nell'immagine sopra.
Suppongo che si possa semplicemente disegnare più rettangoli, uno per ogni linea/parte di linea. – FriendlyGuy