Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Wrapped ToolStrip Control

Wrapped ToolStrip Control

Scheduled Pinned Locked Moved C#
visual-studiodesignhelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Rafone
    wrote on last edited by
    #1

    Hi All; I am using VS 2008 and I have wrapped a checkbox into a toolstrip. Works great but when in VS after shutting down the app the toolstrip is blank (shows no controls don't get the add contol drop down). If I close that project and open another then go back all is well. Can someone tell me if this is a bug in my code or a bug in VS2008? Here is the code for the wrapper;

    using System;
    using System.Windows.Forms;
    using System.Windows.Forms.Design;

    [System.ComponentModel.DesignerCategory("code")]
    [ToolStripItemDesignerAvailability(ToolStripItemDesignerAvailability.ToolStrip | ToolStripItemDesignerAvailability.StatusStrip)]

    public class ToolStripCheckBox : ToolStripControlHost
    {
    public ToolStripCheckBox()
    : base(new CheckBox())
    {

    }
    
    
    public CheckBox CheckBoxControl
    {
        get { return Control as CheckBox; }
    }
    
    public bool Checked
    {
        get { return CheckBoxControl.Checked; }
        set { CheckBoxControl.Checked = value; }
    }
    
    public event EventHandler CheckedChanged;
    
    public void OnCheckedChanged(object sender, EventArgs e)
    {
        // not thread safe!
        if (CheckedChanged != null)
        {
            CheckedChanged(sender, e);
        }
    }
    
    protected override void OnSubscribeControlEvents(Control control)
    {
        base.OnSubscribeControlEvents(control);
        (control as CheckBox).CheckedChanged += OnCheckedChanged;
    }
    
    protected override void OnUnsubscribeControlEvents(Control control)
    {
        base.OnUnsubscribeControlEvents(control);
        (control as CheckBox).CheckedChanged -= OnCheckedChanged;
    }
    

    }

    thx rafone

    Statistics are like bikini's... What they reveal is astonishing ... But what they hide is vital ...

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups