As shown in the picture, slowly and step out of the
Serial Communication class
Public System.IO.Ports.SerialPort SerialPort = null;
SerialPort = new System.IO.Ports.SerialPort ("COM1");
Serialport.baudrate =19200;
Serialport.databits = 8;
Serialport.stopbits = System.IO.Ports.StopBits.One;
serialport.parity = System.IO.Ports.Parity.None;
Serialport.open ();
///<summary>///print bitmap logo///</summary> <param name= "bitmap" ></param> public void PrintBitmap2 (bitmap bitmap) {i NT Width=bitmap.
Width-1; int Height = (int) (bitmap.
Height)/8;
int spacenum= (int) (244-width)/2;
int x0,x1, x2=0,x3=0,x4=0,x5=0,x6=0,x7=0;
byte[] PBuf = new byte[1024*1024];
int point = 0;
pbuf[point++] = 27;
pbuf[point++] = (byte) ' 3 ';
pbuf[point++] = 16;
pbuf[point++] = 27;
pbuf[point++] = (byte) ' R ';
pbuf[point++] = 0; Func<color, bool> isnearwhite = color => {if color. A + color. B + color. G + color.
R >= 255 + + + +) {return false;
return true;
}; for (int n = 0; n < HeigHt
n++) {pbuf[point++] = 27;
pbuf[point++] = (byte) ' * ';
pbuf[point++] = 0;
pbuf[point++] = (byte) (width+spacenum);
pbuf[point++] = 0;
for (int i = 0; i< spacenum; i++) {pbuf[point++] = 0;
for (int i = 0; i < Width; i++) {x0=0;
x1=0;
x2=0;
x3=0;
x4=0;
x5=0;
x6=0;
x7=0; if (Isnearwhite (bitmap).
GetPixel (i,0+ (n*8))) x0 = 128; if (Isnearwhite (bitmap).
GetPixel (I, 1 + (n * 8))) x1 = 64; if (Isnearwhite (bitmap).
GetPixel (I, 2 + (n * 8))) x2 = 32; if (Isnearwhite (bitmap). GetPixel (I, 3 + (n * 8))) x3 = 16; if (Isnearwhite (bitmap).
GetPixel (I, 4 + (n * 8))) x4 = 8; if (Isnearwhite (bitmap).
GetPixel (I, 5 + (n * 8))) x5 = 4; if (Isnearwhite (bitmap).
GetPixel (I, 6 + (n * 8))) x6 = 2; if (Isnearwhite (bitmap).
GetPixel (I, 7 + (n * 8))) X7 = 1;
Pbuf[point++]= (Byte) (x0 ^ x1 ^ x2 ^ x3 ^ x4 ^ x5 ^ x6 ^x7);
} pbuf[point++] = 13;
pbuf[point++] = 10;
} serialport.write (PBuf, 0, point); }