私は楕円のパスに沿って回転する線を描くことを試みています。なぜ第二2つの楕円は完全に白です...Pen :: DashPatternを設定した楕円を描画しないと、期待どおりの結果が得られないのはなぜですか?
http://www.joncage.co.uk/media/img/BadPattern.png
を:生産...
void EllipseDisplayControl::OnPaint(PaintEventArgs^ e)
{
Graphics^ gfx = e->Graphics;
gfx->SmoothingMode = Drawing2D::SmoothingMode::AntiAlias;
int width = 100;
int height = 10;
for(int i = 0; i < 15; i ++)
{
Drawing::Pen^ myPen = (Drawing::Pen^) Drawing::Pens::RoyalBlue->Clone(); //use the standard blue as a start point
myPen->Color = Drawing::Color::FromArgb(64, 32, 111, 144);
myPen->Width = 3;
myPen->DashStyle = Drawing::Drawing2D::DashStyle::Solid;
gfx->DrawEllipse(myPen, 0, 50+i*20, width, height); // Draw the blue ring
float ellipseCircumference = Math::PI * Math::Sqrt(2* (Math::Pow(0.5*width,2) + Math::Pow(0.5*height,2)));
array<Single>^ pattern = {4, ellipseCircumference};
Drawing::Pen^ myPen2 = (Drawing::Pen^) Drawing::Pens::White->Clone(); //use the standard blue as a start point
myPen2->DashPattern = pattern;
myPen2->DashOffset = i*10;
gfx->DrawEllipse(myPen2, 0, 50+i*20, width, height); // Draw the rotating white dot
}
}
:残念ながら、私の解決策はいくつかの問題を持っているようですか? ...どうすれば問題を回避できますか?
典型的なGDI +損失。 –