Results 1 to 5 of 5

Thread: Drawing on a form

  1. #1

    Thread Starter
    Addicted Member Sand_Hawk's Avatar
    Join Date
    Dec 2001
    Location
    The Netherlands
    Posts
    138

    Drawing on a form

    Hi,

    I want to create my own Controls by using API calls. I have some lil' experience with creating controls from building further on an exsiting control. Is there a tutorial on how to draw these things from scratch? I mean not by using an existing control but just take an empty form and draw all the lines.

    Thnx

    Sand Hawk
    - We wish to assimilate more information.

  2. #2
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    All drawing, whether on a form or a control, is performed on the given window's device context .

    You can get a handle to this device context (e.g Form.HDC) and pass that to the large number of drawing functions that take this as one of their parameters.
    For example, if you wanted a control that looked like a frame, you could use the DrawEdge method or to paint a picture onto the control you could use the BitBlt method.


    HTH,
    Duncan

  3. #3

    Thread Starter
    Addicted Member Sand_Hawk's Avatar
    Join Date
    Dec 2001
    Location
    The Netherlands
    Posts
    138
    Can you point me to a tut that explains this is a simple matter? I have done so GDI drawing with C++ but I want some more explanation about it in VB.

    Thnx

    Sand Hawk

  4. #4
    Frenzied Member MerrionComputin's Avatar
    Join Date
    Apr 2001
    Location
    Dublin, Ireland
    Posts
    1,616
    Drawing in VB (other than by using the intrinsic controls) uses exactly the same API calls as drawing using GDI in C++.

    The only difference is that you have to explicitly import (declare) those functions and their associated constants before you can use them.

    I have done this in the EventVB.dll for simplicity sake - see the link under "device context" in the above post. However if you do not wish to use a third party dll then you can find most of the function declarations in the API Function Loader applet that comes with VB.

  5. #5
    jim mcnamara
    Guest
    Go to www.allapi.net

    There are several examples of using GDI on forms.

    Go into api list, search for the api's below, and look at the tutorials & examples for each one.

    DrawFrameControl
    DrawIcon
    Arc
    PolyBezier

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width