I'm drawing on a (square) bitmap on a Windows form a list of objects that include ellipses. I'm generating many properties for these objects randomly. I want to rotate the ellipses to give them more variation than the plain horizontal and vertical look. I'm giving each ellipse a random number between 0 and 360 to use to rotate them. To rotate them, I'm trying to use RotateTransform. The relevant part of the code can be seen below under the "ElseIf" part of the "If" statement, where I'm drawing the ellipses.

If I just use RotateTransform as I have it here, many of the ellipses get drawn. But it looks to me that the rotation is taking place around the (0,0) point of origin. (I'm not sure.) If so, then I think the only ellipses I see drawn are the ones that have a rotation number (of the 360 number that I'm using) that allows them to hit the bitmap. Most of them aren't getting drawn on the bitmap.

What I thought I should be doing is have the Location point of each ellipse fall somewhere on the square bitmap, which I'm doing, but then have the rotation take place around that Location point, so the Location point isn't moved somewhere by the RotateTransform. I thought that TranslateTransform would allow me to do that, but I've tried to use it with no success. If I'm lucky, I might see one or two ellipses drawn out of dozens that are in the list. I'm not sure how to use it.

My question is this: What is a correct way to rotate my ellipses so that they are all kept on the bitmap and drawn on the bitmap. Thanks for any help.

By the way, this line,

which appears in the code below, seems to be needed because without it, it seems that the rotation affects where the other (non-ellipse) objects (in the first part of the "If" statement) get drawn. It's as if I have to undo the rotation (the negative sign) after I do it so it doesn't mess everything up.

For drawindex = 0 To Form1.ListOfLines.Count - 1

            If Form1.ListOfLines(drawindex).Name = "Object 1" Or Form1.ListOfLines(drawindex).Name = "Object 2" Then

                Form1.myPen = New Pen(Drawing.Color.FromArgb(Form1.ListOfLines(drawindex).Alpha, Form1.ListOfLines(drawindex).R,
                                                       Form1.ListOfLines(drawindex).G, Form1.ListOfLines(drawindex).B)) With
                                                       {.Width = Form1.ListOfLines(drawindex).Thickness,
                                                        .CustomEndCap = New Drawing2D.AdjustableArrowCap(Form1.ListOfLines(drawindex).CapNum1,
                                                                                                         Form1.ListOfLines(drawindex).CapNum2, False)}

                objGraphics.DrawLine(Form1.myPen, Form1.ListOfLines(drawindex).StartPoint, Form1.ListOfLines(drawindex).EndPoint)


            ElseIf Form1.ListOfLines(drawindex).Name = "Ellipse" Then

                Form1.myPen = New Pen(Color.FromArgb(Form1.ListOfLines(drawindex).Alpha, Form1.ListOfLines(drawindex).R,
                                                                 Form1.ListOfLines(drawindex).G, Form1.ListOfLines(drawindex).B)) With
                                                                 {.Width = Form1.ListOfLines(drawindex).Thickness}

                ' This line is commented out. objGraphics.TranslateTransform(Form1.ListOfLines(drawindex).EllipseLocationX,

                objGraphics.DrawEllipse(Form1.myPen, Form1.ListOfLines(drawindex).EllipseLocationX, Form1.ListOfLines(drawindex).EllipseLocationY,
                                        Form1.ListOfLines(drawindex).EllipseWidth, Form1.ListOfLines(drawindex).EllipseHeight)


            End If