积极答复者
C# 急死了!! 有关RotateTransform 的旋转中心的问题 跪求高人指点啊!

问题
-
首先,本人菜鸟,很菜很菜,刚接触C#几个星期,被老师逼的要用C#做东西。
然后,现在需要旋转图片,我用RotateTransform,现在的问题是修改不了旋转中心!!!语句如下:
Graphics g1 = this.pictureBox1.CreateGraphics();
RotateTransform rotateTransform2 = new RotateTransform(10);
rotateTransform2.CenterX = 30;rotateTransform2.CenterY= 30;
g1.rotateTransform2;报错“找不到类型或命名空间名称RotateTransform(是否缺少using指令或程序集引用)”,
但是
当我添加了using System.Windows.Media;之后,报错说“命名空间 System.Windows中不存在类型或命名空间名称“Media”(是缺少程序集引用吗)”
哎~急死了急死了急死了~跪求高人
如果用这个修改旋转中心的方法不行,或者有其他的方法也可以~~
答案
-
你好,
按照错误信息所说,你需要添加所需的引用。
在项目中右击“添加引用”,在.NET选项卡中选择WindowsBase。
如此就可以解决你的问题了。
Paul Zhou [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 Paul Zhou 2011年4月6日 2:01
全部回复
-
我想旋转一张图片,使用了 RotateTransform ,我在改他的旋转中心的时候用的是下面的语句
Graphics g1 = this.pictureBox1.CreateGraphics();
RotateTransform rotateTransform2 = new RotateTransform(10);
rotateTransform2.CenterX = 30;
g1.rotateTransform2;报错“找不到类型或命名空间名称RotateTransform”,再下是菜鸟,有没有大神指点一下啊??
- 已合并 Sheng Jiang 蒋晟Moderator 2011年4月8日 18:01
-
WPF程序吗? 添加一下对System.Windows.Media名字空间的引用试试.
Eric Yang [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
-
你好,
按照错误信息所说,你需要添加所需的引用。
在项目中右击“添加引用”,在.NET选项卡中选择WindowsBase。
如此就可以解决你的问题了。
Paul Zhou [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
- 已标记为答案 Paul Zhou 2011年4月6日 2:01