2012-03-23 10 views
0

System.Windows.Form.Panelから継承するコントロールを開発しています。 アイデアは非常にシンプルです。パネルの一番下にあるツールバー。任意のコントロールをドロップできる領域です。その領域については、パネルについて考えて、このパネルをパブリックにし、ユーザーはそのコントロールだけをドロップすることができます。あなたの誰かがキプトンのグループボックスで働いているのかどうか分かりません。あなたはグループボックスコントロールを持っていて、パネルの中にあり、ドキュメントアウトラインビューを見ると、次のように気付くでしょう:kryptongroupbox1 | - > panel1そして、すべてのコントロールはパネル1にドロップされます。 私はそのようなことをしたいです。 ここでカスタムコントロールの編集可能な領域

は私のコードです:私のアプローチと

public partial class GridPanel : Panel 
{ 

    private System.Windows.Forms.ToolStripButton cb_print; 
    private System.Windows.Forms.ToolStripButton cb_excel; 
    private System.Windows.Forms.ToolStrip tool; 
    private System.Windows.Forms.ToolStripButton cb_filter; 
    private System.Windows.Forms.ToolStripButton cb_ocultar; 
    private System.Windows.Forms.ToolStripButton cb_restaurar; 
    private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 
    private System.Windows.Forms.ToolStripLabel lb_cantrow; 

    [Description("The internal panel that contains group content.")] 
    [Localizable(false)] 
    [Category("Appearance")] 
    [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] 
    public Panel Panel { get; set; } 

    public GridPanel() 
    { 
     InitializeComponent(); 
     InitCustomComp(); 
     this.Panel = new Panel{ Dock = DockStyle.Fill, BackColor = Color.Transparent }; 
     this.Controls.Add(Panel); 
     // this.Controls.Add(new KryptonDataGridView { Dock = DockStyle.Fill }); 
    } 

    private void InitCustomComp() 
    { 

     // the creation of the toolbar 
    } 

    public GridPanel(IContainer container) 
    { 
     container.Add(this); 

     InitializeComponent(); 
    } 
} 

私は私のカスタムコントロールのコントロールをドロップすることができますが、私はドッキング時に(記入)、それ私のツールバーの後ろにすべてのコントロールの領域に合わせ

の1申し訳ありませんが説明が少し混乱している場合。英語は母国語ではありません。

答えて

0

コントロールは内部パネルの代わりに外側パネルに追加されている可能性があります。

この問題については、このコードプロジェクトの記事「Designing Nested Controls」で説明しています。 Henry Minuteがこの問題をどのように解決したかを説明します。

+0

ありがとうございました –

関連する問題