0

我创建了一个简单的应用程序框架,允许用户标记显示在可缩放图片中的图像(Cyotek imagebox,http: //cyotek.com/blog/imagebox-update-version-1-1-0-0 )。为了让一切看起来都超过 2000+,我添加了 dockpanelsuite ( https://github.com/dockpanelsuite/dockpanelsuite ),因为我想有额外的面板来更快地导航,另外一个面板可以用于一些工具,比如 image fx等等。我已经按照建议设置了面板,中间的底座是不可移动的,并持有 imagebox 控件。但是,我无法访问和更改图像框属性。我已经加载了正确的命名空间,我已经将 imagebox 设置为 public,但仍然没有运气。这是主 docj 的构造:

    private void InitializeComponent()
    {
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Image_Area));
        this.canvas_tab = new Cyotek.Windows.Forms.ImageBox();
        this.SuspendLayout();
        // 
        // canvas_tab
        // 
        this.canvas_tab.AllowZoom = false;
        this.canvas_tab.Cursor = System.Windows.Forms.Cursors.Cross;
        this.canvas_tab.Dock = System.Windows.Forms.DockStyle.Fill;
        this.canvas_tab.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Bicubic;
        this.canvas_tab.Location = new System.Drawing.Point(0, 0);
        this.canvas_tab.Name = "canvas_tab";
        this.canvas_tab.ShortcutsEnabled = false;
        this.canvas_tab.Size = new System.Drawing.Size(284, 262);
        this.canvas_tab.TabIndex = 2;
        this.canvas_tab.TextDisplayMode = Cyotek.Windows.Forms.ImageBoxGridDisplayMode.None;
        // 
        // Image_Area
        // 
        this.AccessibleRole = System.Windows.Forms.AccessibleRole.Window;
        this.AllowEndUserDocking = false;
        this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(284, 262);
        this.CloseButton = false;
        this.CloseButtonVisible = false;
        this.ControlBox = false;
        this.Controls.Add(this.canvas_tab);
        this.Cursor = System.Windows.Forms.Cursors.Cross;
        this.DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document;
        this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.HideOnClose = true;
        this.Name = "Image_Area";
        this.Text = "\"\"";
        this.ResumeLayout(false);
    }

    #endregion

    public Cyotek.Windows.Forms.ImageBox canvas_tab;

}

其中 canvas_tab 是保存图像的图像框。在程序的主要部分中,我按如下方式构建码头

     public partial class main_Form : Form
{
    public main_Form()
    {
        InitializeComponent();
        Image_Area main_Canvas = new Image_Area();

main_Canvas.Show(dockPanel, DockState.Document); session_enable();

但是,我只能在 main_Form 中访问 main_Canvas.canvas_tab,我什至不能从共享相同命名空间的方法中访问它,例如上面的 session_enable()。我的代码有什么问题?我只是对自己的明显愚蠢视而不见吗?如果您对如何避免此类陷阱有任何建议,或者对我使用 dockpanelsuite 的基本方法有任何替代方法,请不要犹豫!我知道我可以使用多个嵌套拆分器,但我希望用户能够按照自己的意愿移动面板!

4

0 回答 0