0

In MFC: If I use CBrush like "CBrush brush; CDC* pDC = GetDC();pDC->Ellipse(start.x,start.y,end.x,end.y);", what color of the ellipse's interior will be?

Al2O3
  • 3,103
  • 4
  • 26
  • 52

1 Answers1

3

You're not using the brush or assigning it anything; it's simply a variable declaration. It serves absolutely no purpose, so you'd see whatever color was set for the brush in pDC.

If you've done nothing to change it, the interior of the ellipsis will be whatever the default background color is for the device context in pDC.

Ken White
  • 123,280
  • 14
  • 225
  • 444
  • Then what color of the ellipse's interior will be? pDC is "CDC* pDC = GetDC();" no more codes about brush. – Al2O3 Sep 22 '12 at 02:22
  • I answered that - whatever color the brush in `pDC` is set to be. What part of that isn't clear? You've done nothing to change what the device context (contained in `pDC`) already has. My question to you is "What happens when you try it?". – Ken White Sep 22 '12 at 02:25
  • Thank you after all, maybe my question is not so clear, so I changed it. – Al2O3 Sep 22 '12 at 02:29
  • The answer is still the same: It's whatever color the brush in `pDC` is, no matter how many times you ask it. :-) – Ken White Sep 22 '12 at 02:30
  • I think you can help me solve the headache in "http://stackoverflow.com/questions/12532470/why-function-ellipse-are-needed-twice-here-to-draw-an-ellipse", thanks. – Al2O3 Sep 22 '12 at 02:41