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. call standard-draw of a control

call standard-draw of a control

Scheduled Pinned Locked Moved C / C++ / MFC
question
4 Posts 2 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.
  • B Offline
    B Offline
    baerten
    wrote on last edited by
    #1

    Hello everybody, I like to draw a small border inside my CEdit. To "highlight" it. I use already OnEraseBgnd to fill the entire CEdit in another color. But in OnEraseBgnd I can't draw a small border, because the entire Background will be redrawn. If I handle OnPaint(), it works, but in this case, I need to redraw the entire control myself (text, background, etc ...) Is there a function-call to draw the standard-appearance, and after it, I start to draw myself on it? I tested already to call the Parent OnPaint() ( CEdit::OnPaint() ) but this won't work. Big thanks for any idea or basic instruction :) Greetings

    C 1 Reply Last reply
    0
    • B baerten

      Hello everybody, I like to draw a small border inside my CEdit. To "highlight" it. I use already OnEraseBgnd to fill the entire CEdit in another color. But in OnEraseBgnd I can't draw a small border, because the entire Background will be redrawn. If I handle OnPaint(), it works, but in this case, I need to redraw the entire control myself (text, background, etc ...) Is there a function-call to draw the standard-appearance, and after it, I start to draw myself on it? I tested already to call the Parent OnPaint() ( CEdit::OnPaint() ) but this won't work. Big thanks for any idea or basic instruction :) Greetings

      C Offline
      C Offline
      Code o mat
      wrote on last edited by
      #2

      baerten wrote:

      I tested already to call the Parent OnPaint() ( CEdit::OnPaint() ) but this won't work.

      -elaborate this a bit, please.

      > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Computers are evil, EVIL i tell you!! <

      B 1 Reply Last reply
      0
      • C Code o mat

        baerten wrote:

        I tested already to call the Parent OnPaint() ( CEdit::OnPaint() ) but this won't work.

        -elaborate this a bit, please.

        > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Computers are evil, EVIL i tell you!! <

        B Offline
        B Offline
        baerten
        wrote on last edited by
        #3

        Thanks for your post. OnPaint is called in my control to paint/draw on the control. If I don't handle the WM_PAINT Message, the initial Drawing-Functions are called and the control is correctly drawn. If I handle this Message, the control is blank, no drawings on it. I need to draw all myself. I want to call a function into OnPaint to draw the initial/standard drawings (Background, Text, ...) and after this, I make some small paintings on it. Because I don't want to draw the entire CEdit by myself to simply draw 4 lines on it (an extra border in red) I hope I could explain it better Thanks :)

        C 1 Reply Last reply
        0
        • B baerten

          Thanks for your post. OnPaint is called in my control to paint/draw on the control. If I don't handle the WM_PAINT Message, the initial Drawing-Functions are called and the control is correctly drawn. If I handle this Message, the control is blank, no drawings on it. I need to draw all myself. I want to call a function into OnPaint to draw the initial/standard drawings (Background, Text, ...) and after this, I make some small paintings on it. Because I don't want to draw the entire CEdit by myself to simply draw 4 lines on it (an extra border in red) I hope I could explain it better Thanks :)

          C Offline
          C Offline
          Code o mat
          wrote on last edited by
          #4

          I'm not sure i completely understand but why don't you just let OnPaint do it's job and afterwards draw your border? E.g. like this:

          CMyGreatEdit::OnPaint()
          {
          __super::OnPaint(); //Let the base do the complete drawing of the control
          CDC *dc = GetDC();
          //draw your border wherever you need to using the dc...
          ReleaseDC(dc);
          }

          > The problem with computers is that they do what you tell them to do and not what you want them to do. < > Computers are evil, EVIL i tell you!! <

          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