none
Another Fremyextensions question RRS feed

  • Question

  • Is it possible to add an image to a button instead of text?

    I like to add a button but use an image instead of start/stop;

    ' Create button
    MyButton = Controls.AddButton(150, 22, "Start/Stop")
    Controls.Move(MyButton, 5, 150)
    Controls.RegisterMouseUpEvent(MyButton, "ButtonClick")
    Monday, August 31, 2009 6:08 PM

Answers

  • Thanks Fremy,
    I can use it.

    I copy your code and past into it's own SB file and I get the meesage "Cannot find "zoom" in controls" for this line;
    'Controls.Zoom(Image1, 0.25)

    The same thing happens when I copied some code from the samples on your web page, "Cannot find "AnimateShape" in graphicswindow" for this line;
    GraphicsWindow.AnimateShape(MyImage, GraphicsWindow.Width-125, 0, 1080)

    I eliminated these lines and the program runs and I can get the logic of the code. just wondering if it something I'm doing wrong?

    Again, thanks for your help.


    When you look at the {Small Basic}/lib/ folder, which version is shown for FC.dll ? It should be 2.2.0.0. (latest version). If you're not using the latest version, you can download the latest at the same link as before. I've done some updates last days. Introducing Zoom is one of them.

    BTW, GraphicsWindow.AnimateShape is a Small Basic v0.2 and less function. My samples were wrotten at this time. Now, I think it's Shapes.Animate.
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    Monday, August 31, 2009 7:43 PM

All replies

  • In pure WPF, yes. But my extension only cover small area of the whole WPF spec, as this is only a complement to Small Basic, not a way to transform Small Basic into a full-powered language (something he could never become).

    But they are workarounds. You could use AddImage to put an image beside the button, and use the same RegisterMouseUpEvent on the image than on the button. That would have a satisfaisant result.

    GraphicsWindow.Show()
    Controls.LoadTheme("Vista")
    IconPath = "http://static.socialgo.com/icons/48/30.png"
    IconPath = ImageList.LoadImage(IconPath)
    Button1 = Controls.AddButton(150, 25, "       Ask a question")
    Image1 = Controls.AddImage(IconPath)
    Controls.Zoom(Image1, 0.25)

    Controls.Move(Button1, 25, 25)
    Controls.Move(Image1, 32, 5)

    Controls.RegisterMouseUpEvent(Button1, "OnClick")
    Controls.RegisterMouseUpEvent(Image1, "OnClick")

    Sub OnClick
      Dialogs.ShowMessageAsInformation("Click handled!")
    EndSub

    It's not perfect, but it works.


    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    Monday, August 31, 2009 6:51 PM
  • Thanks Fremy,
    I can use it.

    I copy your code and past into it's own SB file and I get the meesage "Cannot find "zoom" in controls" for this line;
    'Controls.Zoom(Image1, 0.25)

    The same thing happens when I copied some code from the samples on your web page, "Cannot find "AnimateShape" in graphicswindow" for this line;
    GraphicsWindow.AnimateShape(MyImage, GraphicsWindow.Width-125, 0, 1080)

    I eliminated these lines and the program runs and I can get the logic of the code. just wondering if it something I'm doing wrong?

    Again, thanks for your help.

    Monday, August 31, 2009 7:26 PM
  • Thanks Fremy,
    I can use it.

    I copy your code and past into it's own SB file and I get the meesage "Cannot find "zoom" in controls" for this line;
    'Controls.Zoom(Image1, 0.25)

    The same thing happens when I copied some code from the samples on your web page, "Cannot find "AnimateShape" in graphicswindow" for this line;
    GraphicsWindow.AnimateShape(MyImage, GraphicsWindow.Width-125, 0, 1080)

    I eliminated these lines and the program runs and I can get the logic of the code. just wondering if it something I'm doing wrong?

    Again, thanks for your help.


    When you look at the {Small Basic}/lib/ folder, which version is shown for FC.dll ? It should be 2.2.0.0. (latest version). If you're not using the latest version, you can download the latest at the same link as before. I've done some updates last days. Introducing Zoom is one of them.

    BTW, GraphicsWindow.AnimateShape is a Small Basic v0.2 and less function. My samples were wrotten at this time. Now, I think it's Shapes.Animate.
    Fremy - Developer in VB.NET, C# and JScript ... - Feel free to try my extension
    Monday, August 31, 2009 7:43 PM