Beispiel #1
0
        protected override void OnLoad(EventArgs e)
        {
            SystemMenu.Insert(this, -2);                            //insert divider 2 items from the bottom
            SystemMenu.Insert(this, -2, "SystemMenu Test...", 999); //Insert menu item 2 items from the bottom (after above divider)
            SystemMenu.SetHandler(this, id =>
            {
                if (id == 999)
                {
                    MessageBoxEx.Show(this, "This is a test of the SystemMenu API.", "SystemMenu Test", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return(true); // This id is handled
                }
                return(false);    // Everything else is not handled by this api.
            });

            CustomStorageTests(); //Test control custom storage API.

            propertyGrid1.SelectedObject = new TestUITypeEditors(this);

            m_clbColorListBox.AddColor(Color.FromArgb(178, 0, 255)); //nearest color==Color.DarkViolet
            m_clbColorListBox.AddColor(Color.FromArgb(128, Color.Peru.R, Color.Peru.G, Color.Peru.B));
            m_clbColorListBox.AddColor(Color.CadetBlue);             //Not added because it already exists
            m_clbColorListBox.AddColor(Color.Empty);                 //Not added because it is invalid.
            m_clbColorListBox.Selected = Color.CadetBlue;

            m_ctvColorTreeView.AddColor(Color.FromArgb(57, 198, 149)); //nearest color==Color.MediumSeaGreen
            m_ctvColorTreeView.AddColor(Color.FromArgb(128, Color.MediumSeaGreen.R, Color.MediumSeaGreen.G, Color.MediumSeaGreen.B));
            m_ctvColorTreeView.AddColor(Color.FromArgb(57, 198, 149)); //nearest color==Color.MediumSeaGreen Already added.
            m_ctvColorTreeView.AddColor(Color.FromArgb(218, 165, 32)); //==Color.Goldenrod. Not added. Equivalant to known color
            m_ctvColorTreeView.Selected = Color.FromArgb(128, Color.MediumSeaGreen.R, Color.MediumSeaGreen.G, Color.MediumSeaGreen.B);

            m_cbbColorComboBox.AddColor(Color.FromArgb(218, 255, 127));      //nearest color==Color.YellowGreen
            m_cbbColorComboBox.AddColor(Color.FromArgb(128, 204, 242, 140)); //A=128, nearest color==Color.Khaki
            m_cbbColorComboBox.Selected = Color.MediumSeaGreen;

            base.OnLoad(e);
        }