Time Bookings Visual Display

前端 未结 3 1708
有刺的猬
有刺的猬 2020-12-19 18:20

I have a system which manages Vehicles and Staff, when you click on their name based on a date you should be able to see the times that they are available on that day.

3条回答
  •  有刺的猬
    2020-12-19 18:45

    Your best bet is to create a custom control inheriting from a similar control, for your example something along the lines of a picture-box may be beneficial. For a (slightly outdated C++) walkthough of custom controls see: http://msdn.microsoft.com/en-us/library/ms364048(v=vs.80).aspx

    As far as custom-drawing setup goes: http://msdn.microsoft.com/en-us/library/windows/desktop/bb761817(v=vs.85).aspx

    As a generalization, the idea is as follows: Capture the WM_PAINT event, and in that event render a pre-drawn image to the control (this is most often done by creating a paint surface, then copying that into the render-able pain-area of the control) this method avoids any 'flicker'.

    The drawing commands are mostly simple, 'drawline(xy_start, xy_end).

    Finally, for handling the time of day, if you take the (rendersurface.height / (24*60)) you will have a converstion from time to pixels. eg:

    double convert_Size = (rendersurface.height / (24*60)); //height / Hours_in_day * Minites
    int time = (hour * 60) + minite_past_hour;
    Pixels_from_top = time * convert_Size;
    

    Pixels_from_top is now the pixel-y coordinate of that time during the day.

提交回复
热议问题