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. Regions in GDI+

Regions in GDI+

Scheduled Pinned Locked Moved C / C++ / MFC
questionwinformsgraphics
9 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
    Anonymous
    wrote on last edited by
    #1

    When creating regions in GDI+ what is returned? Creating a region in the usual GDI returns a HRGN but what is returned in GDI+? A pointer? If so can I use that pointer stored in a struct for later use? :confused:

    L S 2 Replies Last reply
    0
    • A Anonymous

      When creating regions in GDI+ what is returned? Creating a region in the usual GDI returns a HRGN but what is returned in GDI+? A pointer? If so can I use that pointer stored in a struct for later use? :confused:

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You get Region class instance which is wrapper for HRGN and works like MFC CRgn. You can work with it as with instance of any other class.

      1 Reply Last reply
      0
      • A Anonymous

        When creating regions in GDI+ what is returned? Creating a region in the usual GDI returns a HRGN but what is returned in GDI+? A pointer? If so can I use that pointer stored in a struct for later use? :confused:

        S Offline
        S Offline
        Srini Kella
        wrote on last edited by
        #3

        What is the diff. between GDI and GDI+?

        N 1 Reply Last reply
        0
        • S Srini Kella

          What is the diff. between GDI and GDI+?

          N Offline
          N Offline
          NormDroid
          wrote on last edited by
          #4

          GDI is the base graphical system that comes with Windows XP/2K/NT/ME etc. If supports base drawing primatives and has limited image support. GDI+ is shipped as a DLL which you can use in your application for 2K/NT/ME this must be shipped with your app. (~1.6mb). What you give is rich support for images, gradient brushes, text etc. etc. The programming model also simplifies the use of GDI: EXAMPLE: WCHAR string[] = L"Draw text in a rectangle by passing a RectF to the DrawString method."; FontFamily fontFamily(L"Arial"); Font font(&fontFamily, 12, FontStyleBold, UnitPoint); RectF rectF(30.0f, 10.0f, 100.0f, 122.0f); SolidBrush solidBrush(Color(255, 0, 0, 255)); graphics.DrawString(string, -1, &font, rectF, NULL, &solidBrush); Pen pen(Color(255, 0, 0, 0)); graphics.DrawRectangle(&pen, rectF); ... GDI+ is supported by .NET by default. Normski. - Professional Windows Programmer

          S J 3 Replies Last reply
          0
          • N NormDroid

            GDI is the base graphical system that comes with Windows XP/2K/NT/ME etc. If supports base drawing primatives and has limited image support. GDI+ is shipped as a DLL which you can use in your application for 2K/NT/ME this must be shipped with your app. (~1.6mb). What you give is rich support for images, gradient brushes, text etc. etc. The programming model also simplifies the use of GDI: EXAMPLE: WCHAR string[] = L"Draw text in a rectangle by passing a RectF to the DrawString method."; FontFamily fontFamily(L"Arial"); Font font(&fontFamily, 12, FontStyleBold, UnitPoint); RectF rectF(30.0f, 10.0f, 100.0f, 122.0f); SolidBrush solidBrush(Color(255, 0, 0, 255)); graphics.DrawString(string, -1, &font, rectF, NULL, &solidBrush); Pen pen(Color(255, 0, 0, 0)); graphics.DrawRectangle(&pen, rectF); ... GDI+ is supported by .NET by default. Normski. - Professional Windows Programmer

            S Offline
            S Offline
            Srini Kella
            wrote on last edited by
            #5

            Thank you verymuch for your detailed response.

            1 Reply Last reply
            0
            • N NormDroid

              GDI is the base graphical system that comes with Windows XP/2K/NT/ME etc. If supports base drawing primatives and has limited image support. GDI+ is shipped as a DLL which you can use in your application for 2K/NT/ME this must be shipped with your app. (~1.6mb). What you give is rich support for images, gradient brushes, text etc. etc. The programming model also simplifies the use of GDI: EXAMPLE: WCHAR string[] = L"Draw text in a rectangle by passing a RectF to the DrawString method."; FontFamily fontFamily(L"Arial"); Font font(&fontFamily, 12, FontStyleBold, UnitPoint); RectF rectF(30.0f, 10.0f, 100.0f, 122.0f); SolidBrush solidBrush(Color(255, 0, 0, 255)); graphics.DrawString(string, -1, &font, rectF, NULL, &solidBrush); Pen pen(Color(255, 0, 0, 0)); graphics.DrawRectangle(&pen, rectF); ... GDI+ is supported by .NET by default. Normski. - Professional Windows Programmer

              J Offline
              J Offline
              Jay Beckert
              wrote on last edited by
              #6

              I like the GDI+ compared to GDI just for the image support alone. I still find it confusing since to me it seems you have to convert some things to GDI+. For example Rect to Crect when you use GetClientRect() or creating a bmp with CreateCompatibleBitmap() then using the HBITMAP handle for GDI+ Bitmap::FromHBITMAP(). Or am I missing something? Other than that I love the new bush and image classes.

              1 Reply Last reply
              0
              • N NormDroid

                GDI is the base graphical system that comes with Windows XP/2K/NT/ME etc. If supports base drawing primatives and has limited image support. GDI+ is shipped as a DLL which you can use in your application for 2K/NT/ME this must be shipped with your app. (~1.6mb). What you give is rich support for images, gradient brushes, text etc. etc. The programming model also simplifies the use of GDI: EXAMPLE: WCHAR string[] = L"Draw text in a rectangle by passing a RectF to the DrawString method."; FontFamily fontFamily(L"Arial"); Font font(&fontFamily, 12, FontStyleBold, UnitPoint); RectF rectF(30.0f, 10.0f, 100.0f, 122.0f); SolidBrush solidBrush(Color(255, 0, 0, 255)); graphics.DrawString(string, -1, &font, rectF, NULL, &solidBrush); Pen pen(Color(255, 0, 0, 0)); graphics.DrawRectangle(&pen, rectF); ... GDI+ is supported by .NET by default. Normski. - Professional Windows Programmer

                J Offline
                J Offline
                Jay Beckert
                wrote on last edited by
                #7

                It's actually making sense to me now. The graphics object is associated with a dc then you can use that graphics object to draw, paint or what ever you can dream of. You can even have multiple graphics objects associated with a dc and each one is independent which I think is pretty cool. I was trying to use multiple dc's associated with multiple graphics objects and wondering why each object I had was independent. LOL It's just one big wrapper for GDI. Looks like MS is trying to integrate GDI+ more closely to DirectX.

                N 1 Reply Last reply
                0
                • J Jay Beckert

                  It's actually making sense to me now. The graphics object is associated with a dc then you can use that graphics object to draw, paint or what ever you can dream of. You can even have multiple graphics objects associated with a dc and each one is independent which I think is pretty cool. I was trying to use multiple dc's associated with multiple graphics objects and wondering why each object I had was independent. LOL It's just one big wrapper for GDI. Looks like MS is trying to integrate GDI+ more closely to DirectX.

                  N Offline
                  N Offline
                  NormDroid
                  wrote on last edited by
                  #8

                  Jay If this makes you feel any better, I wrote my 2nd windows app. a tile puzzle game similar to the apple one. I tried to use a DC for each tile... No No No. any way a good way of learning Win32/GDI I still have the source code 'circa 93 maybe a good time to revamp and submit as a codeproject app. :~ Normski. - Professional Windows Programmer

                  J 1 Reply Last reply
                  0
                  • N NormDroid

                    Jay If this makes you feel any better, I wrote my 2nd windows app. a tile puzzle game similar to the apple one. I tried to use a DC for each tile... No No No. any way a good way of learning Win32/GDI I still have the source code 'circa 93 maybe a good time to revamp and submit as a codeproject app. :~ Normski. - Professional Windows Programmer

                    J Offline
                    J Offline
                    Jay Beckert
                    wrote on last edited by
                    #9

                    I keep maintaining a 2D chat client/server app and every time I set out to learn something new or better I apply it to my app. It was my first windows app that I attempted. My wife likes these 2D chats and their kinda of fun. I told her I could program one better. ;) Three years later and I'm still making it better. :~ LOL I was a big windows hater in the beginning and was determined to stay Unix/Linux or Dos based - that quickly changed when I seen the bigger paycheck. So everything for a reason. Since going for the windows based work I'd have to say I'v learned more than ever from the experience. It would be cool to see how you did your game - That is if you really want to give it up. I might do another app for codeproject dealing with unlimited dynamic menu sub items for a bookmark idea I did. Sort of like IE explorer. I never seen decent examples of that. Anyways I'm rambling on. :zzz: Cheers Norm

                    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