PDA

View Full Version : delete some text put with DrawText



sdecorme
October 16, 2008, 10:28:48
Hi
I would like to know how to delete a text adding with the DrawText function
(I have about 10 text on the frame).
If it is not possible how can I clear all the overlay I use this function to add my text

private void icImagingControl1_OverlayUpdate(object sender, ICImagingControl.OverlayUpdateEventArgs e)
{
OverlayBitmap ob = icImagingControl1.OverlayBitmapAtPath[PathPositions.Device];
// Enable the overlay bitmap for drawing.
ob.Enable = true;
byte index = 0;
foreach (object item in listBox1.Items)
{
string text = item.ToString();
ob.Font = ListBoxItemFont[index];
System.Drawing.Color c = System.Drawing.Color.FromArgb( ListBoxFontColor[index].R ,ListBoxFontColor[index].G,ListBoxFontColor[index].B);
ob.DrawText(c , ListBoxItemPosX[index], ListBoxItemPosY[index], text);
index++;
}


}

thanks you

sdecorme
October 16, 2008, 10:42:34
Good joke but it is not my answer

Sascha Schmidt
October 16, 2008, 12:37:45
Hallo sdecorme,

In order to clear the whole overlay, you have to call '.Fill()':



private void icImagingControl1_OverlayUpdate(object sender, TIS.Imaging.ICImagingControl.OverlayUpdateEventArg s e)
{
count++;
e.overlay.Fill(e.overlay.DropOutColor);
e.overlay.DrawText(System.Drawing.Color.Red, 10, 10, count.ToString());
}

You can also clear only a specific region using '.DrawSolidRect()':


private void icImagingControl1_OverlayUpdate(object sender, TIS.Imaging.ICImagingControl.OverlayUpdateEventArg s e)
{
count++;
e.overlay.DrawSolidRect(e.overlay.DropOutColor, 0, 0, 100, 100);
e.overlay.DrawText(System.Drawing.Color.Red, 10, 10, count.ToString());
}

sdecorme
October 16, 2008, 12:53:59
the e.overlay.Fill(e.overlay.DropOutColor);
works prefectly thanks you