c# - Wrapping msctls_hotkey32 in .NET Windows Forms -


I am trying to work with a hotkey control in C # on the basis of both Control class and msctls_hotkey32 win32 class. What work do I have, though this is not true:

  class hotkey: text box {create protected override create parameters params {getParams parms = base.CreateParam; Parms.ClassName = "msctls_hotkey32"; Return Parameters; }} // (some other p / invoice for HKM_SETHOTKEY, etc.)}  

The advantage is that it is simple and it works, the disadvantage is that it is from the text box Receives a bunch of functionality that does not apply to this control. So my question is - is it a better way to do this without modifying the wheel again?

Thank you.

You can always inherit the system directly. Control and then definitely add specific methods and qualities that you want to support. To work you have to set up control styles appropriately, this is a quick example.

  Using the system; Using System.Windows.Forms; Namespace WindowsFormsApplication1 {Class Hotkey: Control {Public Hotkey} {Setstyle (Control Style. UserPaint, False); } Protected Override CreateParams CreateParams {Receive {CreateParams cp = base.CreateParams; Cp.ClassName = "msctls_hotkey32"; Return CP; }}}}  

Comments