How to Draw a Rockwell RSLogix 5000 Ladder Logic Diagram with this Windows Forms Control?

85 views Asked by At

I found this CLadderView WinForms control that looks useful for drawing PLC ladder logic diagrams but I'm not too familiar with the System.Drawing namespace for Graphics or how to assign the control properly so it renders. The CLadderView should be able to take an L5X file from RSLogix 5000 and create a ladder logic diagram.

Here is the code I have so far:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }

    private void Form1_Load(object sender, EventArgs e)
    {
        //var g = CreateGraphics();
        //var rectangle = new Rectangle(0, 0, 1000, 1000);
        var ladderView = new CLadderView();
        ladderView.SetUserXMLFile("CarWash.L5X");
        ladderView.Width = Width;
        ladderView.Height = Height;
        ladderView.AutoSize = true;
        ladderView.Dock = DockStyle.Fill;
        Controls.Add(ladderView);
    }
}

But it gives an empty screen: Empty Windows Forms GUI

The CLadderView Control (it was too big for the post): https://pastebin.com/fxn4jnWU

I tried various ways of connecting the CLadderView control to the root Win Forms window but nothing seems to work and it always comes back blank.

0

There are 0 answers