表单标题栏按钮问题 [英] Forms title bar buttons issues
问题描述
http://stackoverflow.com/questions/12329421/is-there-a-way-to-check-when-mouse-is-above-standard-window-control- buttons-clo [ ^ ]
此代码不是我的。我通过上面的链接,根据我的要求做了一些改动。我正在尝试编写鼠标输入和输入鼠标离开事件最小化& c#中表单的关闭按钮?
http://stackoverflow.com/questions/12329421/is-there-a-way-to-check-when-mouse-is-above-standard-window-control-buttons-clo[^]
This code is not mine. I went through the above link and I had made some alteration according for my requirement. I'm trying to code mouse enter & mouse leave event for minimize & close button of form in c#?
SpeechSynthesizer reader;
internal const int WM_NCMOUSEMOVE = 0x00A0;
protected override void WndProc(ref Message m)
{
if (m.Msg == WM_NCMOUSEMOVE)
{
//Mouse over on Minimize button
if ((int)m.WParam == 0x8)
{
reader = new SpeechSynthesizer();
reader.SpeakAsync("Minimize button");
}
//Mouse over on Maximize button
if ((int)m.WParam == 0x9)
{
reader = new SpeechSynthesizer();
reader.SpeakAsync("Maximize button");
}
//Mouse over on Close button
if ((int)m.WParam == 0x14)
{
reader = new SpeechSynthesizer();
reader.SpeakAsync("Close button");
}
}
base.WndProc(ref m);
}
我的问题:
1.我如何使用读卡器。 SpeakAsync(异步)方法无需重复。因为如果我使用reader.speak(Synchronous)将等待进程直到它完成阅读文本。
2.此外,我需要实现鼠标离开事件。因为如果鼠标离开按钮,我确实想调用reader.Dispose()方法。有没有办法实现鼠标离开事件?
请帮忙。
My Questions:
1. How can I use reader.SpeakAsync (Asynchronous) method without repeating. Since if I use reader.speak (Synchronous) that will wait process until it finish reading text.
2. Also I need to implement mouse leave event. Because if mouse leaves the button, I do want to call reader.Dispose() method. Are there any way to implement mouse leave events?
Please help.
推荐答案
1。尝试后台工作者,在这种情况下,reader.speak将在后台工作
2.希望这个链接可以帮助你 - 易于自定义标题栏 [ ^ ]
1. Try background worker, in this case reader.speak will work at background
2. Hope this link will help you - Easy Customize Title Bar[^]
这篇关于表单标题栏按钮问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!