三个简单问题 [英] three Simple Questions

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

问题描述

1.如何将FontDialog的内容添加到我的表单?
(我不想创建一个显示FontDialog的按钮...我需要将对话框的内容作为图标添加到我的表单中,例如按钮 B 和按钮 I ... etc).

2.如何在窗体上显示正在运行的计时器?
(从0开始,然后每秒增加一次)

3.如何消除按下Enter键时出现的声音?
(这是事件代码:

1. how to add the FontDialog''s contents to my form?
(I don''t want to create a button that displays the FontDialog ... I need to add the dialog''s contents as icons to my form like " a button B and a button I ...etc").

2. how to DISPLAY a running timer on my Form?
(starts with 0 and increases every second)

3. how to remove the sound that appears when I press the Enter button?
( this is the event code:

private void TextBox_KeyUp(object sender, KeyEventArgs e)
       {
           if (e.KeyCode == Keys.Enter)
           {
               // Do Something
           }
       }



但是当我按Enter时,就像是一个错误的MessageBox一样,发出嘈杂的烦人的声音...如何摆脱它?).

感谢您的帮助:)
谢谢大家,



but when I press Enter a noisy annoying sound like an error MessageBox rises... how to get rid of it?).

I appreciate any help :)
thanks guys,

推荐答案

1.你不能–这些对话框都是由OS创建的.在不同的操作系统上请求一个,它看起来可能会有所不同.您必须自己创建工具按钮和其他控件.

2.对于纯UI计时器,请使用System.Windows.Forms.Timer或任何WPF等效项(如果使用图形IDE,它将在您的工具箱中),将其间隔设置为1000ms并在更新中更新标签事件.此计时器在UI线程中运行,并且不是非常准确,因此,如果您实际上在数据管理过程中对某些内容进行计时,则可能要使用其他技术,但是您的问题暗示这仅仅是UI级别的事情. br/>
3. Enter不会发出声音.您在表单上是否还有其他东西挂接到Enter上(例如,设置为表单的AcceptButton的按钮)来放置消息框?
1. You can''t – these dialogs are all of a piece and created by the OS. Ask for one on a different OS and it may look different. You will have to create tool buttons and other controls yourself.

2. For a pure UI timer, use System.Windows.Forms.Timer or whatever the WPF equivalent is (it will be in your toolbox if you are using a graphical IDE), set its interval to 1000ms and update a label in the update event. This timer runs in the UI thread and is not super accurate, so if you''re actually timing something as part of a data management process you may want to use other techniques, but your question implies it is just a UI level thing.

3. There should be no sound from Enter. Do you have something else on the form hooked up to Enter (for example a button set as the form''s AcceptButton) which is putting up a message box?


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

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