I am using the pictureBox_Paint event to try and draw an overlay onto the image in a PictureBox.
This is working fine until I resize the PictureBox (set to use SizeMode.Zoom), when I do this the overlay graphic is drawn off position by the margin between the image and the edge of the PictureBox. I guess I need to use the ImageRectangle somehow but this is not public.
I would create a custom usercontrol instead, you would have much more control, and would not be difficult to build.
Related
I am developing a whiteboard application in WPF.
How can I draw a rectangle and circle/ellipse by dragging the mouse like we do in Paint by dragging the mouse pointer ?
I am using WPF canvas for drawing.
have a look into below link
http://www.codeproject.com/Articles/22776/WPF-DrawTools
To run WPF-DrawTools you have to:
Let the VS to convert the project.
Set appropriate NetFramework version (say, Net 4.5).
Add references to correspondent libraries (e.g., PresentationCore) if VS could not find them itself.
I want to create animation like this image, i'm wondering how do i get start for this ? in silverlight xaml
this bar will increased or decreased in animation
thanks for any help
I would create image overlay to create grid effect and would draw solid rectangles under the image. Animate rectangles using standard XAML animations.
Or even better: animate black overlay rectangles covering top of bars.
Sent from windows phone.
I'm trying to add a zoom feature for an image viewer control I'm creating. When viewing the image, holding down the left mouse button brings up a rounded rectangle that is zoomed into the image. I figure I can use An ImageBrush as the background but I can't figure out how to make it just display a specified area of the image. Can this even be done?
By using the Viewbox.
all
I m developing on Medical Image Processing software, I wont crop image on mouse event, means when we drag mouse cursor and move over the image in any shape, the selected portion of image should be cropped. and that will paste in same image. is it Possible in WPF or Silverlight?
Check out the Clip property. You can specify a path in this property that is used to clip the parent object. Set Clip on your Image control to clip the image.
For design time clipping, your best bet is to use Blend (download a trial here if you don't have it) to draw a free hand path. Right click on the path and select Path->Make Clipping Path. In the next dialog, select the image that you want to clip.
EDIT: It sounds like you want to use runtime clipping/cropping, so you will want to generate the clip path using the points gathered from the mouse events. Create a collection of these points and then generate a path from them (linear lines probably... I don't know how you would generate appropriate curves unless you wrote a complex algorithm). Set this path to the Clip property after the fact.
/EDIT
You can add a transparent layer on top of the control and add an InkCanvas.
Then allow the user to draw a stroke (freehand) and turn the stroke into a Geometry by using GetGeometry use the geometry in the Clip property of the control to be clipped.
How can I programmatically draw a bitmap to a WPF Canvas? (or should I do something else entirely?) I will have about 40 moving images.
If you need to dynamically create and modify bitmaps, then use a WritableBitmap. You can place these on a canvas.
I did something similar, but I wanted some logic on each image(object) so I created a UserControl with an image and just add the UserControl to the canvas.