读书人

没找到合适的方法重写

发布时间: 2013-08-27 10:20:47 作者: rapoo

没找到适合的方法重写
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Forms;
using System.Drawing;
using System.Data;




namespace ClassLibrary4

{

public partial class Button
{

private void Form_Activated(object sender, EventArgs e)
{

//注册热键Shift+S,Id号为100。HotKey.KeyModifiers.Shift也可以直接使用数字4来表示。
HotKey.RegisterHotKey(Handle, 100, HotKey.KeyModifiers.ESC, 0);
//注册热键Ctrl+B,Id号为101。HotKey.KeyModifiers.Ctrl也可以直接使用数字2来表示。
HotKey.RegisterHotKey(Handle, 101, HotKey.KeyModifiers.Ctrl, Keys.B);
//注册热键Alt+D,Id号为102。HotKey.KeyModifiers.Alt也可以直接使用数字1来表示。
HotKey.RegisterHotKey(Handle, 102, HotKey.KeyModifiers.Alt, Keys.D);
}

//在FormA的Leave事件中注销热键。


private void FrmSale_Leave(object sender, EventArgs e)
{
//注销Id号为100的热键设定
HotKey.UnregisterHotKey(Handle, 100);
//注销Id号为101的热键设定
HotKey.UnregisterHotKey(Handle, 101);
//注销Id号为102的热键设定
HotKey.UnregisterHotKey(Handle, 102);
}

public override void WndProc(ref Message m)这里出现没找到合适的方法重写?求破! 既然父类都没有,谈什么重写啊
[解决办法]
public partial class Button:Form
[解决办法]
没找到合适的方法重写
------解决方案--------------------


引用:
引用1楼:错误1“ClassLibrary4.Button.WndProc(ref System.Windows.Forms.Message)”: 当重写“protected”继承成员“System.Windows.Forms.Control.WndProc(ref System.Windows.Forms.Message)”时,无法更改访问修饰符又出现了这个问题,请教一下


public override void WndProc(ref Message m)

==>>

protected override void WndProc(ref Message m)
[解决办法]
private void FrmSale_Leave(object sender, EventArgs e)
{
//注销Id号为100的热键设定
HotKey.UnregisterHotKey(Handle, 100);
//注销Id号为101的热键设定
HotKey.UnregisterHotKey(Handle, 101);
//注销Id号为102的热键设定
HotKey.UnregisterHotKey(Handle, 102);

读书人网 >C#

热点推荐