Showing results 1 to 8 of 8

Thread: change font size of ActiveX ListBox

  1. #1

    Frage change font size of ActiveX ListBox

    Hi there!
    I use a ActiveX-Element "Microsoft Forms 2.0 ListBox-Control" on my screen and add some entries to it. But unfortunately the fontsize is much too small.
    How can I set the font size of the control? It doesn't matter if at runtime or design mode. I even could use a CD_ListBox instead of MS_ListBox.
    This is my code so far:
    zenOn.IElement zElementlstSorts = this.Project.DynPictures().Item("Sorts").Elements().Item("lstSorts");
    Microsoft.Vbe.Interop.Forms.ListBox JobListBox = zElementlstSorts.AktiveX() as Microsoft.Vbe.Interop.Forms.ListBox;
    List jobList = GetJobList();
    object[] jobIDs = new object[jobList.Count];
    object defaultParameter = null;
    for (int incID = 0; incID < jobList.Count; incID++)
        jobIDs[incID] = jobList[incID].id;
        JobListBox.AddItem(ref jobIDs[incID], ref defaultParameter);
    can anyone please help?
    Last edited by professor_hubert_farnsworth : 5th March 2013 at 11:20 Reason: formatting

  2. #2

    Default Re: change font size of ActiveX ListBox

    Hello to Mars university and welcome to the forum

    May I ask why you try to use the MS Forms activeX control? The zenon dynamic element combo-listbox is quite versatile and also allows adjusting the font. Entries can be created dynamically using string variables.

    Best regards,

  3. #3

    Frage Re: change font size of ActiveX ListBox

    I think this dynamic ListBox of Zenon insn't already implemented in Zenon V6.51 SP0 Build 12, is it?

    As a workaround I set the font size using VBA (element properties --> VBA --> Init).
    But now I have the next problem:

    I added several values to the listbox and now I want to know, which entry is selected by the user. the best way would be to react to the ListBox.Click event, but I don't know how to do that. I tried to add a handler but that didn't work:
    JobListBox.Click += new Microsoft.Vbe.Interop.Forms.MdcListEvents_ClickEventHandler(JobListBox_Click);
    leads to the error (in german):
    "Das COM-Objekt des Typs \"System.__ComObject\" kann nicht in den Ereignisschnittstellentyp \"Microsoft.Vbe.Interop.Forms.MdcListEvents_Event\" umgewandelt werden. Dieser Vorgang konnte nicht durchgeführt werden, da der QueryInterface-Aufruf an die COM-Komponente für die Schnittstelle mit der IID \"{A506E572-CABA-3342-A385-6775CA7206F0}\" aufgrund des Fehlers \"Schnittstelle nicht unterstützt (Ausnahme von HRESULT: 0x80004002 (E_NOINTERFACE))\" nicht durchgeführt werden konnte und die Quellschnittstelle mit der IID \"{8BD21D22-EC42-11CE-9E0D-00AA006002F3}\" von der COM-Komponente nicht unterstützt wird."

    and when I use a button click instead of an event the code:
    leads to the error: "unknown name".
    But in the VSTA watch window I can see the value if I add a watch to JobListBox and then enlarge the object properties (if I enter JobListBox.ListIndex directly it is not working).

    I'm a little confused.
    Any ideas or solutions?

  4. #4
    josefm Gast

    Lächeln Re: change font size of ActiveX ListBox


    hopefully I got markclemens right, there is the zenon element "Combo-/Listbox" which you can use. Maybe you read through the F1 help and you'll find out that it is a suitable way of using a Combo-/Listbox in zenon

    Otherwise please let me know, why it is not working for you

    Best regards
    Attached Thumbnails Attached Thumbnails combobox listbox element.PNG  

  5. #5

    Default Re: change font size of ActiveX ListBox

    okay, I put the Combo-/Listbox on my screen and read the F1 help and every manual I could find, but I can't figure out how to fill it at runtime.
    I'm using Zenon V6.51 SP0 Build 12.
    Can you give me advice how to fill a number of entries into the ListBox at runtime? The number of entries must be dynamic, for it is not known at design time and can even change during runtime.
    Thanks a lot in advance

  6. #6
    tobiassedlmeier Gast

    Default Re: change font size of ActiveX ListBox

    The zenon Combo-/Listbox can dynamicly fill in the runtime with the zenon Version 7.00 or higher. With the Version 6.51 it is not possible.

  7. #7

    Default Re: change font size of ActiveX ListBox

    that's what I thought, too.
    I'm already on my way to get things working using a combination of VBA and VSTA.
    Anyway, thanks for the support.

  8. #8
    martins Gast

    Default AW: change font size of ActiveX ListBox


    I had that problem once too - getting the index of the selection is not that easy.
    One way could be to do it with a WPF control - which is a bit more complicated than using the ActiveX element - create a User Control Library with a simple ListBox element in it and use a public property to get the selection and write that into zenon.

    I'll let you know if something else comes to my mind how to do this

    best regards (and two thumbs up for the Futurama reference)

Similar Threads

  1. Unable to display graphics in original size
    By jjplaw in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 3
    Last Post: 4th June 2012, 10:36
  2. zenOn 6.21 Size of the ringbuffer
    By cypress329 in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 3
    Last Post: 22nd February 2011, 05:55
  3. Font List Import
    By massinger in forum VBA
    Replies: 2
    Last Post: 16th November 2010, 16:20
  4. Wie kann ich im VBA für TextOut den Font ändern?
    By jung_dieffenbacher in forum VBA
    Replies: 0
    Last Post: 4th March 2010, 10:03
  5. Screen Size Problems
    By douglasm in forum Engineering Studio & Service Engine (former zenon Editor & Runtime)
    Replies: 1
    Last Post: 23rd June 2009, 07:36

Posting Rules

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