Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You implement a form designer almost like a normal GUI. You have stuff you can drag (your widgets), you have stuff you can click (your buttons) and you have stuff you can select (your placed widgets) and that's really about it.</p> <hr> <p><strong>Q: Now, how do you display a window in a GUI?</strong><br> A: You paint it, simple as that. </p> <p><strong>Q: And how do you keep stuff inside that window?</strong><br> A: You check against the bounds of the "parent" object. You could almost say that a form designer is like a little game and you have a scene graph holding all your widgets, connected by parent-child-relations. </p> <p><strong>Q: Then, how do you select stuff in a GUI?</strong><br> A: Check the current mouse position on-click against the bounds of all (near) widgets (a scene graph only helps here, like a quadtree). </p> <p><strong>Q: How do you align widgets on a grid?</strong><br> A: For the grid alignment, let's have a simple example: Say your real resolution is <code>100px</code> on the x-axis, but you want your grid to only have a resolution of <code>10px</code> on x. Now say you move your widget by <code>28px</code> in real resolution. To get the grid resolution, you simply divide by <code>10</code>, get <code>2.8</code>, round that, and finally move the widget <code>3</code> tiles on x. The rounding is the key here. only if the grid movement is <code>&gt;= ?.5</code>, you snap to the next tile. Otherwise you simple stay at the old one.</p> <hr> <p>Hope this can give you a general hint on how to start a form designer. Have fun. :)<br> (PS: Don't know about any specific WinAPI/MFC functions/class to help you along, sorry.)</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload