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. PolyDraw - How to fill?

PolyDraw - How to fill?

Scheduled Pinned Locked Moved C / C++ / MFC
helptutorialquestion
8 Posts 3 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.
  • P Offline
    P Offline
    Paulraj G
    wrote on last edited by
    #1

    Hi... I have created a polydraw.

    CPaintDC dc (this);

    CRect rect;
    GetClientRect (&rect);
    CPen pen (PS\_SOLID, 0, RGB (0, 0, 255));
    CPen\* pOldPen = dc.SelectObject (&pen);
    POINT aPoint3\[7\] = { 10, 10, 100, 150, 150, 150, 10, 100, 500,150,150, 100, 10, 10 };
    BYTE types\[7\] = {PT\_MOVETO, PT\_LINETO, PT\_LINETO, PT\_BEZIERTO,PT\_BEZIERTO, PT\_BEZIERTO, PT\_LINETO};
    dc.PolyDraw(aPoint3,types,7);
    dc.SelectObject (pOldPen);
    

    Now i want to fill this polydraw. How can do that? Any help will be appriciated... Thanks...

    G.Paulraj

    _ 1 Reply Last reply
    0
    • P Paulraj G

      Hi... I have created a polydraw.

      CPaintDC dc (this);

      CRect rect;
      GetClientRect (&rect);
      CPen pen (PS\_SOLID, 0, RGB (0, 0, 255));
      CPen\* pOldPen = dc.SelectObject (&pen);
      POINT aPoint3\[7\] = { 10, 10, 100, 150, 150, 150, 10, 100, 500,150,150, 100, 10, 10 };
      BYTE types\[7\] = {PT\_MOVETO, PT\_LINETO, PT\_LINETO, PT\_BEZIERTO,PT\_BEZIERTO, PT\_BEZIERTO, PT\_LINETO};
      dc.PolyDraw(aPoint3,types,7);
      dc.SelectObject (pOldPen);
      

      Now i want to fill this polydraw. How can do that? Any help will be appriciated... Thanks...

      G.Paulraj

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

      Use CDC::FloodFill or CDC::ExtFloodFill.

      «_Superman_»
      I love work. It gives me something to do between weekends.

      Microsoft MVP (Visual C++)

      Polymorphism in C

      P 1 Reply Last reply
      0
      • _ _Superman_

        Use CDC::FloodFill or CDC::ExtFloodFill.

        «_Superman_»
        I love work. It gives me something to do between weekends.

        Microsoft MVP (Visual C++)

        Polymorphism in C

        P Offline
        P Offline
        Paulraj G
        wrote on last edited by
        #3

        Thanks super man. FloodFill and ExtFloodFill asks HTC. how can get that variable from my code.

        G.Paulraj

        _ 1 Reply Last reply
        0
        • P Paulraj G

          Thanks super man. FloodFill and ExtFloodFill asks HTC. how can get that variable from my code.

          G.Paulraj

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

          What do you mean by HTC? You have to specify a point that lies within the bounding lines and the color of the lines. You need to find some way to get this point.

          «_Superman_»
          I love work. It gives me something to do between weekends.

          Microsoft MVP (Visual C++)

          Polymorphism in C

          P 1 Reply Last reply
          0
          • _ _Superman_

            What do you mean by HTC? You have to specify a point that lies within the bounding lines and the color of the lines. You need to find some way to get this point.

            «_Superman_»
            I love work. It gives me something to do between weekends.

            Microsoft MVP (Visual C++)

            Polymorphism in C

            P Offline
            P Offline
            Paulraj G
            wrote on last edited by
            #5

            Hi... I am using visual studio 2008. The syntax for FloodFill is FloodFill(HTC htc, int x, int y, COLERREF color); if i use like FloodFill(10,100,RGB(255,255,255));, there will be a syntax error like FlootFill does not take 3 arguments.

            G.Paulraj

            C 1 Reply Last reply
            0
            • P Paulraj G

              Hi... I am using visual studio 2008. The syntax for FloodFill is FloodFill(HTC htc, int x, int y, COLERREF color); if i use like FloodFill(10,100,RGB(255,255,255));, there will be a syntax error like FlootFill does not take 3 arguments.

              G.Paulraj

              C Offline
              C Offline
              Cedric Moonen
              wrote on last edited by
              #6

              As mentioned by Superman, you have to use FloodFill from CDC, not the the global function (and it is HDC, not HTC). So, call FloddFill on the paint DC that you already have.

              Cédric Moonen Software developer
              Charting control [v3.0] OpenGL game tutorial in C++

              P 1 Reply Last reply
              0
              • C Cedric Moonen

                As mentioned by Superman, you have to use FloodFill from CDC, not the the global function (and it is HDC, not HTC). So, call FloddFill on the paint DC that you already have.

                Cédric Moonen Software developer
                Charting control [v3.0] OpenGL game tutorial in C++

                P Offline
                P Offline
                Paulraj G
                wrote on last edited by
                #7

                Thanks Cédric Moonen. dc.FloodFill(1,1,RGB(255,255,255)); i have called like above. but full screen color has been changed. how to change the color of that particular polydraw area. thanks...

                G.Paulraj

                _ 1 Reply Last reply
                0
                • P Paulraj G

                  Thanks Cédric Moonen. dc.FloodFill(1,1,RGB(255,255,255)); i have called like above. but full screen color has been changed. how to change the color of that particular polydraw area. thanks...

                  G.Paulraj

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

                  The x and y has to be inside the polygon. 1, 1 lies outside in your case. Try 15, 15.

                  «_Superman_»
                  I love work. It gives me something to do between weekends.

                  Microsoft MVP (Visual C++)

                  Polymorphism in C

                  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