0

我是一个新手,我决定使用 Krypton Toolkit 来增强我的程序的 GUI。我能够将它加载到我的项目中。我创建了一个带有名称的控件的问题,该控件mycontrol具有一个带有名称的 KryptonDataGridView mydatagrid

在我的表单中,我有以下代码:

public partial class Form1 : KryptonForm
{
    private KryptonPage[] mycontrolpage;
    private Control mycontrolcontent;
    public Form1()
    {
        InitializeComponent();
    }

    private KryptonPage NewmycontrolPage()
    {
        mycontrolcontent = new mycontrol();
        KryptonPage page = new KryptonPage("mypage", null, "OS mypage");
        // Add the control for display inside the page
        mycontrolcontent.Dock = DockStyle.Fill;
        page.Controls.Add(mycontrolcontent);

        // Document pages cannot be docked or auto hidden
        page.ClearFlags(KryptonPageFlags.DockingAllowAutoHidden | KryptonPageFlags.DockingAllowDocked);

        return page;
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        // Setup docking functionality
        KryptonDockingWorkspace w = kryptonDockingManager.ManageWorkspace(kryptonDockableWorkspace);
        kryptonDockingManager.ManageControl(kryptonPanel, w);
        kryptonDockingManager.ManageFloating(this);

        mycontrolpage = new KryptonPage[] { NewmycontrolPage() };
        kryptonDockingManager.AddToWorkspace("Workspace", mycontrolpage);
    }
}

我的问题是如何访问网格mycontrol

4

1 回答 1

0

没有一些代码,您总是可以查看示例..或者一些代码片段:

    internal ComponentFactory.Krypton.Toolkit.KryptonDataGridView dgvRules;

然后...

            int offset = dgvRules.Rows.Add((bool)condition, name, description, applied);
            KryptonDataGridViewCheckBoxCell dataGridViewCell = dgvRules.Rows[offset].Cells[0] as KryptonDataGridViewCheckBoxCell;
            if (condition == Tribool.Unknown
                || accumulationRules[offset] == Tribool.Unknown)
            {
                dataGridViewCell.ReadOnly = condition == Tribool.Unknown;
                dataGridViewCell.ThreeState = true;
                dataGridViewCell.Value = CheckState.Indeterminate;
            }
            else
            {
                dataGridViewCell.Value = (CheckState)accumulationRules[offset];
            }
于 2019-06-17T14:40:48.760 回答