Closed supermac closed 2 years ago
Hi.
Yes sure. You can load any icon you want, for example like so: var bitmap = KeyBitmap.Create.FromFile("icon.png")
and send it to any key deck.SetKeyBitmap(keyId, bitmap)
.
Thanks for the reply.
I know this option, but when I use it, the title of the button disappears and you only see this bitmap.
What I ask is if you can change only the icon of the button (on background), without losing the title.
And on the other hand if it is possible to change the title??
Could you post the code that you are using now?
It's a simple example:
if (Btn_Botonera.Style == (Style)FindResource("BotonGris")) { var deck = StreamDeck.OpenDevice(); deck.SetBrightness(100); deck.KeyStateChanged += Deck_KeyPressed; Btn_Botonera.Style = (Style)FindResource("BotonAzul");
var bitmap = KeyBitmap.Create.FromFile(@"C:\streamdeck_key_play.png");
deck.SetKeyBitmap(9, bitmap);
}
I configure Stream Deck XL with a button with a title, for example, "1998". What I need is to change the background color, but keep the "1998". But now when I press the button, the image appears but the text disappears.
Thanks in advance!
What do you mean with "configure a title?". StreamDeckSharp is a pretty slim abstraction around the stream deck hardware (HID interface). You basically only send images to the device. Once you title is baked into the image neither your stream deck nor StreamDeckSharp know that the image contains text. Everything inside a KeyBitmap is just pixels.
If you want to change the image but not the text you basically have to write a class that remembers the old value for the image and the title (for example in a field) and generate a new KeyBitmap from scratch if one of those values changes.
I'm currently on mobile but if you send me a few details about how you are currently generating images with a title I can probably help you.
Do you have a repository on GitHub? Would probably be simpler instead of sending code in the comments.
I'm closing this ticket because of inactivity. Let me know if you need more help.
Hi everyone!
Is it possible to change the title of a button? and its icon?
Thanks.