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. how to write a string to my picture which is maintained by a Bitmap(GDI+) object?

how to write a string to my picture which is maintained by a Bitmap(GDI+) object?

Scheduled Pinned Locked Moved C / C++ / MFC
graphicswinformshelptutorialquestion
9 Posts 4 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.
  • S Offline
    S Offline
    samfromcn
    wrote on last edited by
    #1

    I have a parent window, it has a Bitmap(GDI+) data member which draws a picture as background when OnPaint is called. I create an Edit control and type a string in it. now I want to write the string to the background picture, at the exact position the Edit control be. how to do that? help please:confused: I ever called DrawText in OnOK, find when OnPaint is called, my string will be covered by background. so I want to make the string be part of background picture, but I don't konw how to do. help, help, help....... -- modified at 2:39 Thursday 18th May, 2006

    H G L S 5 Replies Last reply
    0
    • S samfromcn

      I have a parent window, it has a Bitmap(GDI+) data member which draws a picture as background when OnPaint is called. I create an Edit control and type a string in it. now I want to write the string to the background picture, at the exact position the Edit control be. how to do that? help please:confused: I ever called DrawText in OnOK, find when OnPaint is called, my string will be covered by background. so I want to make the string be part of background picture, but I don't konw how to do. help, help, help....... -- modified at 2:39 Thursday 18th May, 2006

      H Offline
      H Offline
      Hamid Taebi
      wrote on last edited by
      #2

      you can see example in msdn CString str; CEdit m_Edit1; m_Edit1.GetWindowText(str); graphics.DrawString( A2W(str), 11, &myFont, origin, &blackBrush);_**


      **_

      whitesky


      -- modified at 2:01 Thursday 18th May, 2006

      S 1 Reply Last reply
      0
      • S samfromcn

        I have a parent window, it has a Bitmap(GDI+) data member which draws a picture as background when OnPaint is called. I create an Edit control and type a string in it. now I want to write the string to the background picture, at the exact position the Edit control be. how to do that? help please:confused: I ever called DrawText in OnOK, find when OnPaint is called, my string will be covered by background. so I want to make the string be part of background picture, but I don't konw how to do. help, help, help....... -- modified at 2:39 Thursday 18th May, 2006

        L Offline
        L Offline
        Laxman Auti
        wrote on last edited by
        #3

        Use DrawText or Textout API's Knock out 'T' from CAN'T , You 'CAN' if you think you 'CAN' :cool:

        S 1 Reply Last reply
        0
        • S samfromcn

          I have a parent window, it has a Bitmap(GDI+) data member which draws a picture as background when OnPaint is called. I create an Edit control and type a string in it. now I want to write the string to the background picture, at the exact position the Edit control be. how to do that? help please:confused: I ever called DrawText in OnOK, find when OnPaint is called, my string will be covered by background. so I want to make the string be part of background picture, but I don't konw how to do. help, help, help....... -- modified at 2:39 Thursday 18th May, 2006

          G Offline
          G Offline
          Ganesh_T
          wrote on last edited by
          #4

          When you type the text after that you can check the value of Enter Key and set make the edit control transparent. Cheers "Peace of mind through Technology"

          S 1 Reply Last reply
          0
          • S samfromcn

            I have a parent window, it has a Bitmap(GDI+) data member which draws a picture as background when OnPaint is called. I create an Edit control and type a string in it. now I want to write the string to the background picture, at the exact position the Edit control be. how to do that? help please:confused: I ever called DrawText in OnOK, find when OnPaint is called, my string will be covered by background. so I want to make the string be part of background picture, but I don't konw how to do. help, help, help....... -- modified at 2:39 Thursday 18th May, 2006

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            like this USES_CONVERSION; Graphics graphics(GetDC()->m_hDC) ; Image * img ; ImageAttributes imAttrib; img = Image::FromFile(A2W("c:\\A.jpg")) ; graphics.DrawImage(img,Rect(0,0,378,350), 0,0,img ->GetWidth(),img ->GetHeight(),//if picture is 378*350 UnitPixel,&imAttrib); CString str; str="Hello frined"; //m_Edit1.GetWindowText(str); Font Font(L"System", 16); PointF origin(50,50); SolidBrush Brush(Color(255,255,255)); graphics.DrawString(A2W(str),str.GetLength(),&Font,origin,&Brush);_**


            **_

            whitesky


            1 Reply Last reply
            0
            • H Hamid Taebi

              you can see example in msdn CString str; CEdit m_Edit1; m_Edit1.GetWindowText(str); graphics.DrawString( A2W(str), 11, &myFont, origin, &blackBrush);_**


              **_

              whitesky


              -- modified at 2:01 Thursday 18th May, 2006

              S Offline
              S Offline
              samfromcn
              wrote on last edited by
              #6

              in fact, what I realy want is not type string on window directly. I have a Bitmap object, I want add the string into the picture, then every time the picture be drawed(OnPaint function be called), the string will show out. I want the string to be part of the background picture, splice them as one picture.;) sorry, my English not very good, sometimes I expressed wrong ideas. thank you.

              1 Reply Last reply
              0
              • L Laxman Auti

                Use DrawText or Textout API's Knock out 'T' from CAN'T , You 'CAN' if you think you 'CAN' :cool:

                S Offline
                S Offline
                samfromcn
                wrote on last edited by
                #7

                in fact, what I realy want is not type string on window directly. I have a Bitmap object, I want add the string into the picture, then every time the picture be drawed(OnPaint function be called), the string will show out. I want the string to be part of the background picture, splice them as one picture. sorry, my English not very good, sometimes I expressed wrong ideas. thank you.

                1 Reply Last reply
                0
                • G Ganesh_T

                  When you type the text after that you can check the value of Enter Key and set make the edit control transparent. Cheers "Peace of mind through Technology"

                  S Offline
                  S Offline
                  samfromcn
                  wrote on last edited by
                  #8

                  sorry, I think I express the wrong idea. please read my reply to other persons. thank you.

                  1 Reply Last reply
                  0
                  • S samfromcn

                    I have a parent window, it has a Bitmap(GDI+) data member which draws a picture as background when OnPaint is called. I create an Edit control and type a string in it. now I want to write the string to the background picture, at the exact position the Edit control be. how to do that? help please:confused: I ever called DrawText in OnOK, find when OnPaint is called, my string will be covered by background. so I want to make the string be part of background picture, but I don't konw how to do. help, help, help....... -- modified at 2:39 Thursday 18th May, 2006

                    S Offline
                    S Offline
                    samfromcn
                    wrote on last edited by
                    #9

                    Asking for help!!!:|

                    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