Hi,
I update my gadgeteer environment to “NETMF and Gadgeteer Package 2014 R5”.
Then my program can’t show bitmap image on Display N18.
my code is.
public void ShowDeviceInfo(string deviceId, string ipAddr)
{
var bmp = new Bitmap((int)display.Width, 40);
int strHeight;
int strWidth;
bmp.DrawText(deviceId, RenderingFont, Colors.White, 2, 2);
RenderingFont.ComputeExtent(deviceId, out strWidth, out strHeight);
bmp.DrawText(ipAddr, RenderingFont, Colors.White, 2, strHeight + 2);
display.Draw(bmp);
}
public void DrawStatus(string status)
{
Bitmap bmp = new Bitmap((int)display.Width, 20);
bmp.DrawText(status, RenderingFont, Colors.Red, 0, 0);
display.Draw(bmp, 0, 120);
}
public Bitmap DrawLabelAndValues(string[] labels, string[] values, uint marginX)
{
Bitmap bmp = new Bitmap((int)display.Width - (int)marginX, 60);
var lineYs = new int[labels.Length];
int strHeight;
int strWidth;
int widthMax = 0;
int lineY = 0;
for (int i = 0; i < labels.Length; i++)
{
lineYs[i] = lineY;
RenderingFont.ComputeExtent(labels[i], out strWidth, out strHeight);
if (widthMax < strWidth) widthMax = strWidth;
bmp.DrawText(labels[i], RenderingFont, Colors.Orange, 0, lineY);
lineY += strHeight;
}
for (int i = 0; i < values.Length; i++)
{
bmp.DrawText(values[i], RenderingFont, Colors.Orange, widthMax, (int)lineYs[i]);
}
display.Draw(bmp, (int)marginX, 40);
return bmp;
}
display is instance of DisplayN18.
what’s wrong?