Gluing together bits from the rest of my code to give an over complicated example. At the end of DisplayRectangle, remove the ); and uncomment out. For the opacity, I’ve tried 0, 128, 255, 256 all with the same result.
GT.Color Color_ButtonBorder = GT.Color.FromRGB(64, 64, 64);
GT.Color Color_Button = GT.Color.FromRGB(200, 200, 200);
ButtonFont = Resources.GetFont(Resources.FontResources.NinaB);
int ScreenWidth = 240;
int ScreenHeight = 320;
const int NumberOfLines = 7;
int LineHeight;
private void DrawButton(int x, int y, int w, int h, string Message, GT.Color TextColor, GT.Color BackColor)
{
try
{
Screen.DisplayRectangle(Color_ButtonBorder, 1, BackColor, (uint)x, (uint)y, (uint)w, (uint)h); //, 3, 256);
y += (h / 2 - ButtonFont.Height / 2);
Screen.DisplayTextInRectangle(Message, (uint)x, (uint)y, (uint)w, (uint)ButtonFont.Height, TextColor, ButtonFont, GTM.Module.DisplayModule.SimpleGraphicsInterface.TextAlign.Center);
}
catch (Exception ex) { PrintDebug("DrawButton " + ex.Message); }
}
private void DrawButton(int linedown, string Message, GT.Color TextColor, GT.Color BackColor)
{
int x = 0;
int y = (LineHeight * linedown);
int w = ScreenWidth;
int h = LineHeight;
DrawButton(x, y, w, h, Message, TextColor, BackColor);
}
private void DrawButton(int linedown, string Message, GT.Color TextColor)
{
DrawButton(linedown, Message, TextColor, Color_Button);
}
private void DrawButton(int linedown, string Message)
{
DrawButton(linedown, Message, GT.Color.Black);
}
private void DrawSomething()
{
Screen = Board_Display.SimpleGraphics;
ScreenWidth = (int)Screen.Width;
ScreenHeight = (int)Screen.Height;
LineHeight = ScreenHeight / (NumberOfLines + 1);
DrawButton(0,"This is a button");
}