0

I have created a simple application skeleton that allows the user to mark images that are displayed within a zoomable picturebx (Cyotek imagebox, http://cyotek.com/blog/imagebox-update-version-1-1-0-0). To make everything look 2000+, I've added the dockpanelsuite (https://github.com/dockpanelsuite/dockpanelsuite) into the mix, because I would like to have extra panels for quicker navigation and another one for some tools like image fx etc. I have set up the panels as suggested, with the middle dock being immovable and holding the imagebox control. However, I am not able to access and change the imagebox properties. I have loaded up the correct namespace, I've set the imagebox to public but still no luck. This is what the construction of the main docj loooks like:

    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;

}

where canvas_tab is the imagebox holding the image. in the main portion of the program, i construct the dock(s) as follow

     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();

However, I can only access main_Canvas.canvas_tab within main_Form, I can't even access it from methods sharing the same namespace such as above session_enable(). What's wrong with my code? Am I just blind to an obvious stupidity on my behalf? If you have any suggestions how to avoid such pitfalls or any alternative to my basic approach of using the dockpanelsuite, don't hesitate! I know I could use multiple nested splitters, but I would like the user to be able to move the panels around as he wishes!

steveax
  • 17,527
  • 6
  • 44
  • 59
Sacha Viquerat
  • 329
  • 1
  • 3
  • 14
  • I don't think I get your question, but to create docking panels the standard way is to create controls that inherit from DockContent and add them to the dockPanel control in your main form (having `IsMdiContainer` set to `true`) with `yourDockContent.Show(dockPanel);`. If you are at this point - what's exactly your quesion? – mvo Feb 07 '14 at 00:03
  • I just made the docks public right at the beginning of main_Form, before the constructor. Now they can be accessed! Thank you anyways! – Sacha Viquerat Feb 07 '14 at 01:16

0 Answers0