如何通过单击按钮更改窗体包含 [英] how can i change the form contains with clicking on a button

查看:93
本文介绍了如何通过单击按钮更改窗体包含的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

hi


我想通过单击下一个或预览按钮来更改我的表单。所以,我喜欢在一段时间之后改变它,例如当我的节目在显示电影之后运行为秒,然后是菜单和其他按钮和图标外观。



那些是两个问题。



和另一个问题是,当用户将鼠标悬停在按钮和菜单或图标上时,我怎样才能播放声音。



如果某些项目存在,请给我链接地址或页面地址



最后我很抱歉我的英语不好: D

解决方案

无法清楚地理解你的要求... plz解释更合适。

并且你需要显示声音鼠标悬停在按钮上



你可以在Button的Mouseover事件上写代码



使用名称空间

使用System.Media;





使用下面的代码播放声音(仅限.wav文件)



系统tem.Media.SoundPlayer p =  new  SoundPlayer(); 
p.SoundLocation = filepath as string;
p.Play();







快乐编码

享受:)


当你说c#时,你使用的是WPF还是Windows Forms。

这是一个在WPF中实现1个窗口程序的例子。 br $> b $ b

我发现在不调用新窗口的情况下更改Windows容器的最佳方法是使用Usercontrol。



< usercontrol horizo​​ntalalignment =   Stretch verticalalignment = < span class =code-string> 拉伸 name =   currentContent usercontrol =   >  < /   usercontrol  >  





这样,哟您可以通过更改usercontrols内容属性轻松更改用户控件的内容。



 WipView1 userControl = new WipView1(); 
currentContent.Content = userControl;





至于为按钮添加声音,解决方案1的海报就是现货!


hi
i want to change my form contains with clicking on a button like NEXT or PREVIEW . and so , i like change it after a time , for example when my programs runing after showing a movie as seccondes then menues and other buttons and icons appearance.

those were two questions.

and another question that , how can i playing a sound when users mouse overs the buttons and menues or icons .

if some projects exist like that , please give me thos link addresses or page adresses

and finally im so sorry for my veeery bad english :D

解决方案

Not able to understand ur requirement clearly... plz explain more properply.
and as far as u need to display sound on mouse over button

U cn write code on Button''s Mouseover event

use name space
using using System.Media;


use below code to play sound(only .wav file)

System.Media.SoundPlayer p = new SoundPlayer();
p.SoundLocation="filepath as string";
p.Play();




happy coding
enjoy :)


When you say c#, are you using WPF or Windows Forms.
Here is an example of achieving a 1 Window Program in WPF.

I have found that the best way to change a Windows container without calling new windows is to use a Usercontrol.

<usercontrol horizontalalignment="Stretch" verticalalignment="Stretch" name="currentContent" usercontrol=""></usercontrol>



This way, you can easily change the content of the user control by changing the usercontrols content property.

WipView1 userControl = new WipView1();
currentContent.Content = userControl;



As for adding a sound to your buttons, The poster of Solution 1 is spot on!


这篇关于如何通过单击按钮更改窗体包含的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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