Help needed in drawing 3D scrollbars - wpf

I need to write the following component in WPF:
It should be over image, I should able to drag the lines with the mouse (drag X up and down, drag Y left and right, and Z spin from horizontal to vertical)
My backround in WPF is almost not exist,
Can you give me guidliness? do you know component that doing it, or something similar to that?
Do you know what is the name of this control?
Thanks.

I refactored the program in
http://www.codeproject.com/KB/WPF/WPFDiagramDesigner_Part1.aspx
In the code I just remark
//Canvas.SetTop(designerItem, top + e.VerticalChange);
And remain
Canvas.SetLeft(designerItem, left + e.HorizontalChange);
Delete almost everything, replaced image with rectangle,
And now the verical and horizontal lines drag and drop lines work,
Now I am searching how to do the diagonal line drag and drop
(I tried to do it with path/line control, I had the problem that if I add the diagonal line, it capture all the mouse event, and I can't move the other lines)
Help still needed

I managed to do it,
You can download the code here

Related

Changing the anchor point of the scrollviewer (WPF)

I am trying to do something a little bit specific, and I can't seem to find if it is even possible. So I thought I would lay down the question here.
What I'm looking for is a way to change the anchor point of the scrollviewer from the top to the bottom (however you look at it). I'll explain what I mean.
By default when the control contained in your scrollviewer gets taller, so will your vertical scrollbar scollableheight.
But what happens is, the vertical scrollbar will stay at the same scrolloffset from the top, while what I want is that the vertical scrollbar keeps it's position relative to the bottom. The reason I want this behaviour is because I am creating a list that the user can expand more of by scrolling to the top. but then when I add the new items it looks like the scrollviewer scrolls up to the newly added items. (although it is actually the content the is pushed down) So if the scrollviewer would have the vertical scrollbar anchored to the bottom, the visible part of the content would stays at the same position to the user because the distance from that part to the bottom didn't change.
I hope you can understand what I'm trying to do.
I allready found one way of doing this, but it is not the desired option to me.
Option 1) Apply a Scaletransform of -1 in the Y-axis to the scrollviewer to flip it upside down. Then apply another ScaleTransform of -1 in the Y-axis to the content of the scrollviewer to make the content right side up.
But the problem with this technique is that for one, when you scroll using your mousewheel the scrollviewer scrolls inverted as normal. And second, I'm using 2 scaletransformations just to change the behaviour of the scrollviewer, and not even for eye candy. So that seems a bit excessive to me.
Option 2) anyone?

How to scroll contents WHILE scrolling

I have created a usercontrol that is essentially a text editor (using Graphics.Drawstring in OnPaint).
I have set AutoScroll = true, and AutoScrollMinSize values appropriately. Everything is working how it should...
EXCEPT, i would like the control to scroll itself WHILST I am currently scrolling (i.e. click and drag the scroll bar... and whilst it is being dragged the control should be scrolling the entire time). At the moment it only scrolls when the scroll bar is released (mouse up).
I have tried implementing _Scroll and invalidating the control, but that just makes it flicker uncontrollably.
I cannot find any examples online for this, due to it being difficult to describe!
Can anyone point me in the right direction please?
Control.Invalidate() will make something flicker badly. I faced this problem drawing cross-hairs over a mouse position on a PictureBox drawing a line chart before. The trick is to use (and I cant remember which one is best to come first)
Control.Update();
Control.Refresh();
in the Scroll event. Depending on what else you are drawing in the Control and how you are drawing it this may be better for you. Also this is tested on PictureBox, Control may be another matter.

Shapes Clipping

I'm having a problem that's driving me crazy for a couple hours...
Situation:
I am drawing a shape - ellipse,
then im creating a new brush - from an image,
I apply the brush to my shape,
and then I rotate the shape..
The problem is: Everthying is displaying correctly - but...
As soon as I drag the shape to the edge of the window - thats where the formular ends,
it's starting to cut of some parts of the shape.
It's simply not drawing the part that should be not visible, because overflowing the form.
But in my case, I've rotated the shape, so it's cutting the wrong part of it.
This is what it look's like. Is there a way to kinda "reset" the cliping.. Or another solution...
Solved It.
Set the parent element's width and height larger then the window is (its was HorizontalAlignment.Stretch) before.
Now you'll never reach the cliping edge of the parent

WPF lines and polylines events for a 2D Editor

i want to create a 2d-editor like application in WPF an i need to know how to do this:
How can intercept the event when i click on a Line or Polyline?
How can detect the end / beginning of a line and show a small dot or small box in the end or the beginning of the line. Is there a way to raise an event if i get close of end or the beginning of the line?
How can i create a panning and zooming functionality? How can i control the canvas for that functionality?
How can i maintain the aspect ratio between X and Y and the scale. I mean if i have a horizontal line of length 5 and a vertical line of length 5, what do i have to do to both lines look the same length visually?
Thanks for your answers.
Eduardo
I don't know much, but the ideas that came to my mind are as below, correct me if anything wrong.
Using Hit-Testing [Ref] or Pre-defined extendable Shapes [Ref], which already have common Input events (like MouseEnter, MouseLeave, ...)
For showing a small dot, u can use Adorners. Every line a has end and start point, u can just get it's value and adjust your visual (small dot) for them. Yes, Adorner can help u, they are just like any other UIElement, so commons events like MouseEnter, MouseLeave, ... are there.
For panning and zooming, u can use the code from here or here or here
The lines will be visually same. Just draw them using Shapes (link above).

Clipping Paths in Silverlight Mobile (WP7) - I can't create anything but a simple rectangle?

I'm trying to create clipping paths for shapes, such as circles, polygons, etc. I'm actually trying to make the clipping path follow the line of the shape. I've tried the below in Expression Blend, what am I missing? What I'm really trying to do here is have the user trace shapes with an InkPresenter, and have it error if they've drawn outside the lines X times... if Clipping Paths is the wrong way to go here, by all means please let me know what the correct direction is :)
I created a rectangle, rounded the edges until it was a circle and then Make Clipping Path was enabled. I select it and I get the error: "Rounded corners are not supported for clipping paths in Silverlight 4 Mobile and have been removed."
Then I created about 50 rectangles over the circle, then Make Compound Path... and now Make Clipping Path is disabled again
Then I left the 50 rectangles as just Rectangles and thought I'll just create each of them as a Clipping path... I do the first one, so far so good... I select the second and make it a Clipping Path for my InkPresenter, and it deletes my first Clipping Path and uses the second. Dead in the water, it looks like each object can only have one clipping path.
How do I get around this?
Tim
You can use a PathGeometry to create an arbitrary shape geometry that you can assign as Clip to your InkPresenter.
You can build up the points for the PathGeometry from input events as the user traces the shape.

Resources