We would like to build a community for Small Basic programmers of any age who like to code. Everyone from total beginner to guru is welcome. Click here to register and share your programming journey!


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Button with icons
#6
Hi,

The best way is to create your button images and save or create in a png and load from a file.  You can save multiple images for a button or buttons and split the images as required using LDImage.SplitImage.

Another approach is to draw the images as you have done and check when a mouse is clicked if it is inside the button.  This is fairly simple to achieve, but won't easily give you the MouseOver effect that make a button clearer.

You can create an image in SB code directly, setting each pixel value, see LDImage.GetImagePixels for example.  This I would only consider in last resort for dynamic button design that isn't known at compile time - more complex and generally unnecessay.

As a slightly simpler approach you can create an image from a part of the screen, see LDImage.Capture rather than directly from a file (I still recommend using a file) - this requires the image to be visible on screen so may create some flicker as it creates the image.

See WSQS642.000-0 which uses the last method which is closest to what you want I think, but its a bit tricky, but fun as well.
Reply


Messages In This Thread
Button with icons - by martmen - 02-08-2026, 11:07 AM
RE: Button with icons - by Scout - 02-08-2026, 08:05 PM
RE: Button with icons - by AbsoluteBeginner - 02-09-2026, 08:11 AM
RE: Button with icons - by litdev - 02-09-2026, 10:08 AM
RE: Button with icons - by martmen - 02-09-2026, 01:37 PM
RE: Button with icons - by litdev - 02-09-2026, 04:25 PM
RE: Button with icons - by martmen - 02-09-2026, 06:33 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)