Exemple #1
0
        private void OnCommandContextExecuted(object sender, CommandContextEventArgs e)
        {
            switch (e.Context.Properties.ID)
            {
            case (int)Contexts.Open:
                m_State.Load();
                break;

            case (int)Contexts.Save:
                m_State.Save();
                break;

            case (int)Contexts.FillStyle:
                NComboBoxCommandContext c    = (NComboBoxCommandContext)m_Manager.CommandManager.GetContext((int)Contexts.ComboBoxContext2);
                NComboBoxCommand        comm = (NComboBoxCommand)c.GetCommands()[0];

                comm.HostedControl.SuspendLayout();
                comm.Items.Clear();

                //NListBoxItem item;
                for (int i = 0; i < 200; i++)
                {
                    //item = new NListBoxItem(i, "NListBoxItem " + i, false);
                    comm.Items.Add("Item " + i);
                }

                comm.HostedControl.ResumeLayout();

                break;
            }
        }
Exemple #2
0
        private void OnLoadImage(object sender, CommandContextEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();

            ofd.Title            = "Select Image:";
            ofd.Filter           = NUIManager.AllImageFilesFilter;
            ofd.RestoreDirectory = true;

            ofd.InitialDirectory = "..\\..\\Resources\\Backgrounds";
            ofd.Multiselect      = false;

            if (ofd.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Image img = Image.FromFile(ofd.FileName);

            SetImage(img);
        }