抽奖使用鼠标旋转 [英] Draw & rotate using mouse

查看:73
本文介绍了抽奖使用鼠标旋转的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Graphics Object并在其上绘制了一个矩形(graphics.DrawRectangle).现在,我想使用鼠标旋转它.和旋转矩阵.但是我在移动鼠标时看不到旋转,只是在松开按钮后才看到旋转...

i''ve got a Graphics Object and have drawn a rectangle (graphics.DrawRectangle) on it. Now I want to rotate it using the mouse. and the rotation matrix. But I don''t see the rotation while moving the mouse, I just see it after realeasing the button...

推荐答案

您需要将旋转变换应用为此处 [
You need to apply a rotate transform as here[^].


代替使用System.Drawing您可以使用WPF.该库针对此类问题进行了更好的设计.

与移动图形对象相比,它比GDI/GDI +更易于使用.在基本方法中,您根本不执行渲染.而是将对象放在画布上并直接对其进行操作.您可以使用鼠标/键盘对其进行操作,并为任何属性或组合(缩放/平移)设置动画效果-这已经全部实现.您甚至可以创建矢量对象(完美的工具是InkSpace,请参见
http://en.wikipedia.org/wiki/Inkspace [ ^ ];它在SVG中有效(
Instead of using System.Drawing and System.Drawing.Graphics you could use WPF. This library is much better designed for such things.

It is also easier to use compared to GDI/GDI+ when it comes to moving graphical objects. In a basic approach you don''t do rendering at all. Instead, you put objects on canvas and operate them directly. You can operate them with mouse/keyboard and animate any properties or combination, zoom/pan — this is all already implemented. You can even create vector objects (perfect instrument is InkSpace, see http://en.wikipedia.org/wiki/Inkspace[^]; it works in SVG (http://en.wikipedia.org/wiki/Scalable_Vector_Graphics[^]) and can export into XAML) and add those object to your canvas to a standard objects. You can even allow your user to do that dynamically during run time.

—SA


这篇关于抽奖使用鼠标旋转的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆