Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Draw filled circle

Draw filled circle

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anu_Bala
    wrote on last edited by
    #1

    Hi, I want to draw very small red,green color circle. So i use Ellipse fuctionality. But its draw as hollow. I want filled circle with different brush color. How can i do that?

    Anu

    _ L M K 4 Replies Last reply
    0
    • A Anu_Bala

      Hi, I want to draw very small red,green color circle. So i use Ellipse fuctionality. But its draw as hollow. I want filled circle with different brush color. How can i do that?

      Anu

      _ Offline
      _ Offline
      _Superman_
      wrote on last edited by
      #2

      Create the colored brush using CreateSolidBrush. Use SelectObject to select the brush into the device context used in the first parameter of Ellipse.

      «_Superman_» I love work. It gives me something to do between weekends.
      Microsoft MVP (Visual C++)

      A 1 Reply Last reply
      0
      • _ _Superman_

        Create the colored brush using CreateSolidBrush. Use SelectObject to select the brush into the device context used in the first parameter of Ellipse.

        «_Superman_» I love work. It gives me something to do between weekends.
        Microsoft MVP (Visual C++)

        A Offline
        A Offline
        Anu_Bala
        wrote on last edited by
        #3

        Ellipse has 4 parameters.X,y,width,height only.

        Anu

        _ 1 Reply Last reply
        0
        • A Anu_Bala

          Ellipse has 4 parameters.X,y,width,height only.

          Anu

          _ Offline
          _ Offline
          _Superman_
          wrote on last edited by
          #4

          http://msdn.microsoft.com/en-us/library/dd162510(VS.85).aspx[^]

          «_Superman_» I love work. It gives me something to do between weekends.
          Microsoft MVP (Visual C++)

          1 Reply Last reply
          0
          • A Anu_Bala

            Hi, I want to draw very small red,green color circle. So i use Ellipse fuctionality. But its draw as hollow. I want filled circle with different brush color. How can i do that?

            Anu

            L Offline
            L Offline
            LittleYellowBird
            wrote on last edited by
            #5

            To fill the Ellipse when you draw it, you need first to create a Brush of the correct colour and then load it into the current Device Context. Then when you call the Ellipse function it will fill it with the correct colour. :) Something like this ....

            CBrush brMine;
            CBrush \*pOldBrush = NULL;
            brMine.CreateSolidBrush(crRed);				
            pOldBrush = pDC->SelectObject(&brRed);
            

            Then draw your Ellipse. :)

            Ali

            1 Reply Last reply
            0
            • A Anu_Bala

              Hi, I want to draw very small red,green color circle. So i use Ellipse fuctionality. But its draw as hollow. I want filled circle with different brush color. How can i do that?

              Anu

              M Offline
              M Offline
              Mohan Ramachandra
              wrote on last edited by
              #6

              Try this...

                     CDC \*pDC = GetDC();
              	CRect rect;
              	GetClientRect(rect);
              	CBrush brush;
              	brush.CreateSolidBrush(RGB(255,0,0));
              	CBrush \*pOldBrush= pDC->SelectObject(&brush);
              	pDC->Ellipse(rect);
              	pDC->SelectObject(pOldBrush);
              	::ReleaseDC(m\_hWnd,pDC->m\_hDC );
              
              1 Reply Last reply
              0
              • A Anu_Bala

                Hi, I want to draw very small red,green color circle. So i use Ellipse fuctionality. But its draw as hollow. I want filled circle with different brush color. How can i do that?

                Anu

                K Offline
                K Offline
                KarstenK
                wrote on last edited by
                #7

                CDC::FillRgn() CRgn::CreateEllipticRgn() read the docs of the function onemore time. :-O

                Press F1 for help or google it. Greetings from Germany

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups