SimpleGraphics DisplayRectangle, cornerRadius and fillColor

I’m using a Spider with a TE35. Whenever I use a DisplayRectangle with a cornerRadius, it’s as though the fillColor is ignored. I tried the same thing with opacity levels 0, 128, and 255, and 256. cornerRadius 1-3. Will not show fill color until I remove cornerRadius.

Also not finding an option for a fill color for DisplayEllipse.

The SimpleGraphics interface is… simple. It does not have the full set of methods that is available with a bitmap.

But there is hope… Check the thread below for a way to gain access to the internal bitmap which SimpleGraphics uses. You can then do it all…;.

https://www.ghielectronics.com/community/forum/topic?id=4368&page=1#msg41572

1 Like

Thanks Mike, that looks really handy.

@ NXTwoThou, glad you have your spider working. if possible when reporting issues to a forum, it would be really nice if you copy-pasted your example code. Saves folks trying to reproduce from having to re-write the code, potentially introducing or changing critical pieces… true even in these simple cases.

Will post a simple example when I get back to work. Honestly I just had a rectangle taking up half the screen. As soon as I put in anything for cornerRadius and opacity, the fill no longer worked. The cornerRadius was definitely working.

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");
}