I am not sure, you can try passing the form reference into the method(if that is what you mean).
class MyMenu
{
public static void AddLine(Form f)
{
ShapeContainer canvas = new ShapeContainer();
LineShape theLine = new LineShape();
canvas.Parent = f;
theLine.Parent = canvas;
theLine.BorderColor = SystemColors.ControlDarkDark;
theLine.StartPoint = new System.Drawing.Point(-3, 154);
theLine.EndPoint = new System.Drawing.Point(212, 154);
}
}
And from the Form:
MyMenu.AddLine(this);
solved C# Use ‘this’ Keyword in a class [closed]