Error Invalid parameter used

When I run the CreateBackGround method, there is an occured error as following: A first chance exception of type 'System.ArgumentException' occurred in system.drawing.dll Additional information: Invalid parameter used. //Code in here public override GoObject CreateBackGround(GraphicalElement oGraphicalElement){
GoRoundedRectangle shape = new GoRoundedRectangle(); shape.Reshapable = false; Pen p = new Pen(new HatchBrush(HatchStyle.DottedGrid,Color.Black)); p.DashPattern = new float[4] { 1, 3, 6, 3 }; shape.Pen = p;//error in here. shape.Size = new SizeF(40.0f,40.0f); shape.Selectable = true; shape.Resizable = true; shape.Movable = true; return shape;
}

Your code looks OK to me, and when I try it, it works just fine. (Although because the pen is so thin, you really can’t see the hatch pattern.)
Maybe this is a .NET bug that shows up on your system. What platforms are you using?
Another possibility: are you running this code in a different thread from your Form’s thread?

Hi Walter,
I used the .NET 1.1.4322 SP1
I didn’t use thread in my program.
I’ll review my program.