This is a migrated thread and some comments may be shown as answers.

hide / show panel from radribbon image

6 Answers 163 Views
RibbonBar
This is a migrated thread and some comments may be shown as answers.
mampus
Top achievements
Rank 1
mampus asked on 09 Nov 2010, 05:46 PM
hi there..
i have some problem when i tried to show / hide from some panel or forms...
here my code for show / hide the panel when the radribbon image clicks...

'hide all of the panel...
 
    Public Sub bikinPanjangNol()
        Me.PanelDataBuku.Visible = False
        Me.PanelDataKaryawan.Visible = False
        Me.PanelDataMahasiswa.Visible = False
    End Sub
 
'then show the panel when radribbon image click....
    Private Sub TombolDataBuku_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TombolDataBuku.Click
        bikinPanjangNol()
        PanelDataBuku.Visible = True
        'Me.PanelDataBuku.BringToFront()
    End Sub
 
    Private Sub tblDataMahasiswa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tblDataMahasiswa.Click
        bikinPanjangNol()
        PanelDataMahasiswa.Visible = True
        Me.PanelDataMahasiswa.BringToFront()
    End Sub


that's code just work for the first panel....for the rest of panel..it didn't work.....
can u give me some of the solutions..???
thanks...

6 Answers, 1 is accepted

Sort by
0
Emanuel Varga
Top achievements
Rank 1
answered on 09 Nov 2010, 10:26 PM
Hello Mampus,

Can you please provide some more details, what image?
When are you hiding them when are you showing them?

Please try to create a small project and attach it here, i will be more than happy to assist you on that.

But like this i cannot tell what is not working...

Another question, are all of the parents separate? Or is one including others?
If one includes another, please set try setting the visibility from the child panels to the parents, I've seen some issues with this.

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
0
mampus
Top achievements
Rank 1
answered on 10 Nov 2010, 04:21 PM
hi there..
just like your instructions...i'm attach the screenshot....
here the code:
Public Partial Class RadRibbonForm1
    Public Sub hideAllPanel()
        Panel1.Visible = False
        Panel2.Visible = False
        Panel3.Visible = False
    End Sub
    Private Sub RadRibbonBarGroup1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadRibbonBarGroup1.Click
        hideAllPanel()
        Panel1.Visible = True
        Panel1.BringToFront()
    End Sub
 
    Private Sub RadRibbonBarGroup2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadRibbonBarGroup2.Click
        hideAllPanel()
        Panel2.Visible = True
        Panel2.BringToFront()
    End Sub
 
    Private Sub RadRibbonBarGroup3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadRibbonBarGroup3.Click
        hideAllPanel()
        Panel3.Visible = True
        Panel3.BringToFront()
    End Sub
End Class

please assist me..i'm just an newbie programmer...
many thanks to you...
0
Accepted
Emanuel Varga
Top achievements
Rank 1
answered on 10 Nov 2010, 06:31 PM
Hello again,

Please try this:

using System;
 
public partial class RadRibbonForm1 : Telerik.WinControls.UI.RadRibbonForm
{
    public RadRibbonForm1()
    {
        InitializeComponent();
    }
 
    private void radRibbonBarGroup1_Click(object sender, EventArgs e)
    {
        HideAllPanels();
        radPanel1.Visible = true;
    }
 
    private void radRibbonBarGroup2_Click(object sender, EventArgs e)
    {
        HideAllPanels();
        radPanel2.Visible = true;
    }
 
    private void radRibbonBarGroup3_Click(object sender, EventArgs e)
    {
        HideAllPanels();
        radPanel3.Visible = true;
    }
 
    private void HideAllPanels()
    {
        radPanel1.Visible = false;
        radPanel2.Visible = false;
        radPanel3.Visible = false;
    }
 
    #region Designer Code
 
    /// <summary>
    /// Required designer variable.
    /// </summary>
    private System.ComponentModel.IContainer components = null;
 
    /// <summary>
    /// Clean up any resources being used.
    /// </summary>
    /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
    protected override void Dispose(bool disposing)
    {
        if (disposing && (components != null))
        {
            components.Dispose();
        }
        base.Dispose(disposing);
    }
 
    #region Windows Form Designer generated code
 
    /// <summary>
    /// Required method for Designer support - do not modify
    /// the contents of this method with the code editor.
    /// </summary>
    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(RadRibbonForm1));
        this.radRibbonBar1 = new Telerik.WinControls.UI.RadRibbonBar();
        this.radStatusStrip1 = new Telerik.WinControls.UI.RadStatusStrip();
        this.panel1 = new System.Windows.Forms.Panel();
        this.ribbonTab1 = new Telerik.WinControls.UI.RibbonTab();
        this.radRibbonBarGroup1 = new Telerik.WinControls.UI.RadRibbonBarGroup();
        this.radRibbonBarGroup2 = new Telerik.WinControls.UI.RadRibbonBarGroup();
        this.radRibbonBarGroup3 = new Telerik.WinControls.UI.RadRibbonBarGroup();
        this.radPanel1 = new Telerik.WinControls.UI.RadPanel();
        this.radPanel2 = new Telerik.WinControls.UI.RadPanel();
        this.radPanel3 = new Telerik.WinControls.UI.RadPanel();
        ((System.ComponentModel.ISupportInitialize)(this.radRibbonBar1)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.radStatusStrip1)).BeginInit();
        this.panel1.SuspendLayout();
        ((System.ComponentModel.ISupportInitialize)(this.radPanel1)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.radPanel2)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this.radPanel3)).BeginInit();
        ((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
        this.SuspendLayout();
        //
        // radRibbonBar1
        //
        this.radRibbonBar1.AutoSize = true;
        this.radRibbonBar1.CommandTabs.AddRange(new Telerik.WinControls.RadItem[] {
        this.ribbonTab1});
        this.radRibbonBar1.Dock = System.Windows.Forms.DockStyle.Top;
        this.radRibbonBar1.EnableKeyMap = true;
        //
        //
        //
        //
        //
        //
        this.radRibbonBar1.ExitButton.ButtonElement.Class = "RadMenuButtonElement";
        this.radRibbonBar1.ExitButton.ButtonElement.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
        this.radRibbonBar1.ExitButton.Text = "Exit";
        this.radRibbonBar1.Location = new System.Drawing.Point(0, 0);
        this.radRibbonBar1.Name = "radRibbonBar1";
        //
        //
        //
        //
        //
        //
        this.radRibbonBar1.OptionsButton.ButtonElement.Class = "RadMenuButtonElement";
        this.radRibbonBar1.OptionsButton.ButtonElement.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
        this.radRibbonBar1.OptionsButton.Text = "Options";
        //
        //
        //
        this.radRibbonBar1.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
        this.radRibbonBar1.Size = new System.Drawing.Size(474, 144);
        this.radRibbonBar1.StartButtonImage = ((System.Drawing.Image)(resources.GetObject("radRibbonBar1.StartButtonImage")));
        this.radRibbonBar1.TabIndex = 0;
        this.radRibbonBar1.Text = "RadRibbonForm1";
        //
        // radStatusStrip1
        //
        this.radStatusStrip1.AutoSize = true;
        this.radStatusStrip1.LayoutStyle = Telerik.WinControls.UI.RadStatusBarLayoutStyle.Stack;
        this.radStatusStrip1.Location = new System.Drawing.Point(0, 397);
        this.radStatusStrip1.Name = "radStatusStrip1";
        this.radStatusStrip1.Size = new System.Drawing.Size(474, 28);
        this.radStatusStrip1.SizingGrip = false;
        this.radStatusStrip1.TabIndex = 1;
        this.radStatusStrip1.Text = "radStatusStrip1";
        //
        // panel1
        //
        this.panel1.Controls.Add(this.radPanel3);
        this.panel1.Controls.Add(this.radPanel2);
        this.panel1.Controls.Add(this.radPanel1);
        this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
        this.panel1.Location = new System.Drawing.Point(0, 144);
        this.panel1.Name = "panel1";
        this.panel1.Size = new System.Drawing.Size(474, 253);
        this.panel1.TabIndex = 2;
        //
        // ribbonTab1
        //
        this.ribbonTab1.Alignment = System.Drawing.ContentAlignment.BottomLeft;
        //
        // ribbonTab1.ContentPanel
        //
        this.ribbonTab1.ContentPanel.BackColor = System.Drawing.SystemColors.ControlLightLight;
        this.ribbonTab1.ContentPanel.CausesValidation = true;
        this.ribbonTab1.ContentPanel.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(238)));
        this.ribbonTab1.ContentPanel.ForeColor = System.Drawing.SystemColors.ControlText;
        this.ribbonTab1.ContentPanel.Location = new System.Drawing.Point(0, 0);
        this.ribbonTab1.ContentPanel.Size = new System.Drawing.Size(200, 100);
        this.ribbonTab1.IsSelected = true;
        this.ribbonTab1.Items.AddRange(new Telerik.WinControls.RadItem[] {
        this.radRibbonBarGroup1,
        this.radRibbonBarGroup2,
        this.radRibbonBarGroup3});
        this.ribbonTab1.Name = "ribbonTab1";
        this.ribbonTab1.StretchHorizontally = false;
        this.ribbonTab1.Text = "Panels";
        //
        // radRibbonBarGroup1
        //
        this.radRibbonBarGroup1.Name = "radRibbonBarGroup1";
        this.radRibbonBarGroup1.Text = "Panel1";
        this.radRibbonBarGroup1.Click += new System.EventHandler(this.radRibbonBarGroup1_Click);
        //
        // radRibbonBarGroup2
        //
        this.radRibbonBarGroup2.Name = "radRibbonBarGroup2";
        this.radRibbonBarGroup2.Text = "Panel2";
        this.radRibbonBarGroup2.Click += new System.EventHandler(this.radRibbonBarGroup2_Click);
        //
        // radRibbonBarGroup3
        //
        this.radRibbonBarGroup3.Name = "radRibbonBarGroup3";
        this.radRibbonBarGroup3.Text = "Panel3";
        this.radRibbonBarGroup3.Click += new System.EventHandler(this.radRibbonBarGroup3_Click);
        //
        // radPanel1
        //
        this.radPanel1.Location = new System.Drawing.Point(13, 7);
        this.radPanel1.Name = "radPanel1";
        this.radPanel1.Size = new System.Drawing.Size(129, 230);
        this.radPanel1.TabIndex = 0;
        this.radPanel1.Text = "radPanel1";
        //
        // radPanel2
        //
        this.radPanel2.Location = new System.Drawing.Point(162, 7);
        this.radPanel2.Name = "radPanel2";
        this.radPanel2.Size = new System.Drawing.Size(141, 230);
        this.radPanel2.TabIndex = 1;
        this.radPanel2.Text = "radPanel2";
        //
        // radPanel3
        //
        this.radPanel3.Location = new System.Drawing.Point(329, 7);
        this.radPanel3.Name = "radPanel3";
        this.radPanel3.Size = new System.Drawing.Size(133, 230);
        this.radPanel3.TabIndex = 2;
        this.radPanel3.Text = "radPanel3";
        //
        // RadRibbonForm1
        //
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(474, 425);
        this.Controls.Add(this.panel1);
        this.Controls.Add(this.radStatusStrip1);
        this.Controls.Add(this.radRibbonBar1);
        this.Name = "RadRibbonForm1";
        //
        //
        //
        this.RootElement.ApplyShapeToControl = true;
        this.Text = "RadRibbonForm1";
        ((System.ComponentModel.ISupportInitialize)(this.radRibbonBar1)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.radStatusStrip1)).EndInit();
        this.panel1.ResumeLayout(false);
        ((System.ComponentModel.ISupportInitialize)(this.radPanel1)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.radPanel2)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this.radPanel3)).EndInit();
        ((System.ComponentModel.ISupportInitialize)(this)).EndInit();
        this.ResumeLayout(false);
        this.PerformLayout();
    }
 
    #endregion Windows Form Designer generated code
 
    private Telerik.WinControls.UI.RadRibbonBar radRibbonBar1;
    private Telerik.WinControls.UI.RadStatusStrip radStatusStrip1;
    private System.Windows.Forms.Panel panel1;
    private Telerik.WinControls.UI.RibbonTab ribbonTab1;
    private Telerik.WinControls.UI.RadRibbonBarGroup radRibbonBarGroup1;
    private Telerik.WinControls.UI.RadRibbonBarGroup radRibbonBarGroup2;
    private Telerik.WinControls.UI.RadRibbonBarGroup radRibbonBarGroup3;
    private Telerik.WinControls.UI.RadPanel radPanel3;
    private Telerik.WinControls.UI.RadPanel radPanel2;
    private Telerik.WinControls.UI.RadPanel radPanel1;
 
    #endregion Designer Code
}

Just copy and paste this code in a new form:

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga
0
mampus
Top achievements
Rank 1
answered on 11 Nov 2010, 12:09 AM
hi there....
What exactly u're doing with the code above..??
I didn't notice some changing except for this part:
this.radRibbonBarGroup1.Click += new System.EventHandler(this.radRibbonBarGroup1_Click);
please explain to me..
0
Emanuel Varga
Top achievements
Rank 1
answered on 11 Nov 2010, 12:34 AM
Hello again mampus,

Please just copy and paste the code into a form and let me know if it's working for you (of course remove the designer class for that file.

Sorry, i forgot to convert it to vb, but first i want to be certain that it is working like you expected and if it is i will convert it to vb for you, OK?

Hope this helps, if you have any other questions or comments, please let me know,

Best Regards,
Emanuel Varga

Telerik WinForms MVP
0
mampus
Top achievements
Rank 1
answered on 23 Nov 2010, 10:27 AM
hi there...that's code seems didn't work....
please help me....
Tags
RibbonBar
Asked by
mampus
Top achievements
Rank 1
Answers by
Emanuel Varga
Top achievements
Rank 1
mampus
Top achievements
Rank 1
Share this question
or