开发者

How to create moveable "free floating" panel that can freely move over the canvas and is partially transparent

开发者 https://www.devze.com 2023-04-04 04:50 出处:网络
The scenario is that i wan开发者_如何学运维t the user to create a shape in a small panel that opens (the added shape can later be placed on the canvas), but for a better reference, i want the user to

The scenario is that i wan开发者_如何学运维t the user to create a shape in a small panel that opens (the added shape can later be placed on the canvas), but for a better reference, i want the user to be able to move the semi-transparent panel somewhere on the canvas and then draw with the accurate reference.

Please tell me:

  1. Which panel type to use

  2. How to make it moving by clicking the mouse on the move button (not the whole panel as dragging will be used for drawing lines) and move it around.

  3. How to make it semi transparent.

  4. How to make it appear and disappear (this should be pretty simple)

  5. How to somehow limit its movement inside the canvas so it cannot move on the ribbon

And I really really hope there will be something built-in in WPF that i'll be able to use, and i will not have to do it the hard way i.e. create a rectangle, and do customized hit testing on it to allow the user to draw on top of that rectangle, make that rectangle transparent, and add graphics items for the buttons and controls on that rectangle "panel".

I am asking this because i have never seen such feature in any Windows application and i have no idea what to use for this purpose and how to implement it. The closest thing to what i want is in Adobe Acrobat Pro, which is the small preview of the page that appears when i double click with the middle mouse button. It doesn't move, nor it is transparent or can be drawn upon, but scale and shape wise i want something similar.


You should be able to place a second Canvas inside of your main canvas, and place whatever UserControl you'd like with your "view" inside of it.

You'll have to handle the mouse click/drag for moving it around yourself, but otherwise, it should be very straightforward.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号