So doing some drawing in a drop down and when I dont transform it it draws as expected. However when I transform the brush 90 degrees, for ex. it seems to also transform the rectangle. However if I adjust for that then it draws outside the border as if the rectangle isnt transformed. I think my rectangle and brush rectangle are out of alignment causing it to tile or draw out of the border.

Its an 11 x 10 pixel rectangle and the first column of pixels is the "margin" resulting in a 10 x 10 square.

No transform
Name:  Unsure1.png
Views: 282
Size:  2.6 KB

Transform 90
Name:  Unsure2.png
Views: 311
Size:  2.1 KB

Transform 45
Name:  Unsure3.png
Views: 303
Size:  6.5 KB



Code:
Pen pen = new Pen(Color.Black, 1);
Graphics rectGraphics;
Bitmap img = new Bitmap(11, 10);
rectGraphics = Graphics.FromImage(img);
rectGraphics.DrawLine(pen, 2, 0, 9, 0); //rounded rectangle
rectGraphics.DrawLine(pen, 10, 1, 10, 8); //rounded rectangle
rectGraphics.DrawLine(pen, 9, 9, 2, 9); //rounded rectangle
rectGraphics.DrawLine(pen, 1, 8, 1, 1); //rounded rectangle

Rectangle innards = new Rectangle(2, 1, 8, 8);
LinearGradientBrush lgb = new LinearGradientBrush(innards, Color.White, Color.White, 0, false);

ColorBlend cb = new ColorBlend();
cb.Positions = new[] { 0.0f, 0.5f, 1.0f };
cb.Colors = new[] { Color.White, Color.Pink, Color.Red };
lgb.InterpolationColors = cb;
lgb.RotateTransform(90);

rectGraphics.FillRectangle(lgb, innards); //fill rectangle innards
pen.Dispose();
rectGraphics.Dispose();