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. Drawing in an SDI view?

Drawing in an SDI view?

Scheduled Pinned Locked Moved C / C++ / MFC
c++csscomgraphicsquestion
2 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.
  • F Offline
    F Offline
    Fredrik Skog
    wrote on last edited by
    #1

    I have an SDI app where I am using Chris Maunder's MFC grid control. In View::OnInitialUpdate() I init some headers of the grid. In View::OnDraw() I try to fill the grid with data from the Doc. But I only get some kind of frames around the cells instead of cells with data in. And I cannot manually edit these cells after trying to fill them. Am I going about it the wrong way or what :confused: Cheers, Fredrik
    Sonork ID: 100.11430:PhatBoy
    "Felix qui potuit rerum cognoscere causas."

    A 1 Reply Last reply
    0
    • F Fredrik Skog

      I have an SDI app where I am using Chris Maunder's MFC grid control. In View::OnInitialUpdate() I init some headers of the grid. In View::OnDraw() I try to fill the grid with data from the Doc. But I only get some kind of frames around the cells instead of cells with data in. And I cannot manually edit these cells after trying to fill them. Am I going about it the wrong way or what :confused: Cheers, Fredrik
      Sonork ID: 100.11430:PhatBoy
      "Felix qui potuit rerum cognoscere causas."

      A Offline
      A Offline
      Alexander Wiseman
      wrote on last edited by
      #2

      Hello! If you have a view which uses Chris Maunder's MFC grid control, then you the grid control should fill up the entire view area, and thus perform all the drawing. You should not put anything into OnDraw, because that function either will never be called, or will be called multiple times, giving you undesireable results. Read the part in Chris Maunder's article about how to have a grid control in a view to make sure you have properly implemented sizing the control, etc. In order to add data to the grid, I suggest one of two things: 1) Add the data in your OnInitialUpdate function, along with your initialization of the grid headers. 2) Make another function where you add the data and call this function sometime later in your application. In other words, you shouldn't use OnDraw to fill the grid. :-D Bit of a long-winded answer, but I hope that helps! ;P (The part of Chris's article about having a grid control in a view is very useful to get that up and running properly) P.S. I like your signature: 'Felix qui potuit rerum cognoscere causas.', which means 'Happy is he who is able to know the causes of things.'. Take a look at my sig! :cool: Sincerely, Alexander Wiseman Est melior esse quam videri It is better to be than to seem

      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