Hi everyone,
I'm new to WPF. Well i need to draw an ellipse over an image based on its X,Y values(on image mouse move). Somehow i have managed to draw ellipse using DrawGeometry() over the image. Now i have to animate that ellipse(like blinking or LED kind of). I'm not able to do that. I have created animated ellipse(storyboard) using Blend but i dont know how to use that on this scenario. Please some body help me. I don't have much time to wait. Because in few days i have to deliver this project. Here i have attached the code below. Please let me know if any changes has to be done on this code. For time being i'm using timer for animation. But this is not a good approach. please give me any samples. Thanks.
BitmapImage bmImage = new BitmapImage(new Uri(currentImagePath));
DrawingVisual drawingVisual = new DrawingVisual();
DrawingContext drawingContext = drawingVisual.RenderOpen();
drawingContext.DrawImage(img.Source, new Rect(0, 0, bmImage.Width, bmImage.Height));
SolidColorBrush myBrush = new SolidColorBrush(Colors.Red);
Pen pen = new Pen(myBrush, 5.0);
EllipseGeometry el = new EllipseGeometry(new Point(x, y + 5), 38, 38);
drawingContext.DrawGeometry(null, pen, el);
RenderTargetBitmap renderBmap = new RenderTargetBitmap(bmImage.PixelWidth, bmImage.PixelHeight, 96, 96, PixelFormats.Pbgra32);
renderBmap.Render(drawingVisual);
img.Source = renderBmap;