C#中的2个基本问题 [英] 2 basic questions in c#

查看:45
本文介绍了C#中的2个基本问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是c#的新手,我试图用2个.gif图片和2个按钮构建一个表单,一个在图片之间进行bottun切换,另一个则使表单恢复原样..我怎么能不用另一个临时变量就可以做到吗?
Q2:如何在C#中控制.gif图片的速度?

感谢

Im new to c# , im trying to build a form with 2 .gif pictures and 2 buttons, one bottun switch between the pics and the other bring the form back as it was in the first place.... how can i do it without using another temporary Variable?
Q2: how can i control .gif pictures speed in c# ?

thanks

推荐答案

1)您是说交换图像数据吗?您为什么要这样做?为什么要做到呢?您可以通过将一个对象存储在另一个对象的属性中来完成此操作,但是随后您将失去该属性的值(并且它基本上仍在使用temp变量).您还可以使用XOR操作来交换图像(例如,通过对原始像素数据执行操作).但是这个要求似乎很愚蠢.只需创建另一个临时变量即可.

1.1)如果您是要隐藏一个图像并显示另一个图像,则只需切换每个图像的可见性即可.一次就能出现一个.

1.2)您是说交换图像位置吗?如果是这样,您可能可以在位置上使用XOR技术(如果坐标不是整数,则可能会出现问题).

2)您可能必须重新创建GIF.如果您使用的是WPF,则可以使用 MediaElement 控件.
1) Do you mean swap the image data? Why would you want to do that and why would you assume it''s possible? You could sort of do it by storing one object on a property of the other object, but then you''d lose the value of that property (and it''s still basically using temp variable). You could also use XOR operations to swap the images (e.g., by performing the operation on the raw pixel data). But this requirement seems silly. Just create another temporary variable.

1.1) If you mean you are just hiding one image and showing the other, just toggle the visibility of each. That''ll make one appear at a time.

1.2) Do you mean swap the image positions? If so, you can probably use the XOR technique on the positions (may run into issues if the coordinates are not integral).

2) You would likely have to recreate the GIF. If you are using WPF, you may be able to use the MediaElement control.


HI 感谢您的回复...
1)我的意思是,通过单击一个按钮,两个图片框将显示相同的图像(图像之一).我问这个问题是因为我听说某人做了更改(通过单击按钮)后,他使用另一个botton恢复了原始的视图",我的意思是将每个图像恢复到其图片框....使用清除方法....我真的不记得如何!

2)我没有真正得到它..let假设我们有一个包含一个图片框的Windows窗体,然后向该图片框加载gif图片...如何更改图片的帧速率?
一个小例子将不胜感激

谢谢
HI thanks for your reply...
1)i mean that by clicking a button both pictureboxes will show the same image (one of the images). im asking about that because i heard from someone that after doing the change (by clicking the button) , he use another botton to restore the original "view" , i mean restoring each image to its picturebox....and he did that by using Clear method .... i didnt realy remember how!

2)i didnt realy get it..lets assume that we have windows form containing one picturebox ,and to that picturebox we load gif image...how can i change the framerate of the image?
small example will be appreciated

thanks


这篇关于C#中的2个基本问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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