如何在GroupBox中迭代10个TextBox?

时间:2012-05-17 14:25:39

标签: c# textbox tabs controls groupbox

我在TabBox控件中的GroupBox中有10个TextBox。如何实现剪切,复制和放大粘贴所有TextBox而不单独访问每个TextBox

1 个答案:

答案 0 :(得分:0)

只需使用阻止或替换剪切,复制,粘贴命令的自定义文本框:

public class MyTextBox : TextBox
{
    private const int WM_CUT   = 0x0300;
    private const int WM_COPY  = 0x0301;
    private const int WM_PASTE = 0x0302;

    protected override void WndProc(ref Message m)
    {
        switch(m.Msg)
        {
            case WM_CUT:
                // Handle Cut
                return;

            case WM_COPY:  
                // handle copy 
                return;

            case WM_PASTE:
                // handle paste
                return;
        }

        base.WndProc(ref m);
    }
}