The question is a little unfocused. Specifically - where do you want to draw the lines and rectangles? Generally speaking, you need a drawing surface, usually provided by a windows form.
Where does the need to avoid windows forms come from?
Are you using another kind of window?
For a windows form you could use code similar to this:
namespace WindowsFormsApplication1 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
protected override void OnPaint(PaintEventArgs e) {
base.OnPaint(e);
e.Graphics.DrawLine(new Pen(Color.DarkGreen), 1,1, 3, 20 );
e.Graphics.DrawRectangle(new Pen(Color.Black), 10, 10, 20, 32 );
}
}
}
You can generally do this with any object that lets you get a handle for a "Graphics" object (like a printer).