Results 1 to 3 of 3

Thread: ActiveX control in design mode

  1. #1

    Thread Starter
    New Member
    Join Date
    Sep 2002
    Posts
    2

    ActiveX control in design mode

    I am making an ActiveX control in a separate project, to compile it into an OCX. Its purpose is to display a graph and have two forms for exporting and printing.

    It contains a UserControl for the displaying of the chart, and two forms.

    When I include the compiled OCX in the project, I see a regular UserControl icon in the Components toolbox. Can I have my own icon there?

    When I put the control on a form I can resize it, but not move it around, as the UserControl reacts to the mouse and keyboard events. How can I stop the UserControl (and the controls on it) to stop doing that? When do I have to add the Ambient.UserControl code?

    Thanks!!!
    Jerry

  2. #2
    PowerPoster
    Join Date
    Aug 2000
    Location
    India
    Posts
    2,288
    Use the ToolBoxBitamp property of the UserControl to specify your custom image. But remember, the dimension should be 16 X 15 pixels, otherwise it will be scaled to that sized.

    Use the Ambient.Usermode to determine if the usercontrol is on the form or not.
    VB Code:
    1. If Ambient.Usermode  then
    2. 'this is run time mode
    3. Else
    4. 'this is VB design mode
    5. End If

  3. #3

    Thread Starter
    New Member
    Join Date
    Sep 2002
    Posts
    2
    Thanks for the TollBoxBitmap tip!

    I knew about the Ambient property, but didn't know where to put it to prevent the whole UserControl to receive events in design mode. I solved the problem by setting all contained controls to Enabled = False.

    Thanks!
    Jerry

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