// Get characters from the printer
        private void UpGet_Click(object sender, EventArgs e)
        {
            bool Success;
            int  bytesPerCharacter = (charHeight + 7) / 8 * charWidth;

            CleanUpGrid();
            // Build the blank image
            stripes = new long[Count][];
            for (int i = 0; i < stripes.Length; i++)
            {
                stripes[i] = new long[charWidth];
            }
            bmGrid = StripesToBitMap(stripes);
            BitMapToImage();

            if (EIP.StartSession())
            {
                if (EIP.ForwardOpen())
                {
                    byte[] data;
                    for (int i = 0; i <= Count; i++)
                    {
                        if ((Layout)cbLayout.SelectedIndex == Layout.Fixed)
                        {
                            AttrData attr = EIP.GetAttrData(ccUP.User_Pattern_Fixed);
                            data    = EIP.FormatOutput(attr.Get, new int[] { dotMatrixCode, Registration + i });
                            Success = EIP.GetAttribute(ClassCode.User_pattern, (byte)ccUP.User_Pattern_Fixed, data);
                        }
                        else
                        {
                            AttrData attr = EIP.GetAttrData(ccUP.User_Pattern_Free);
                            data    = EIP.FormatOutput(attr.Get, new int[] { charHeight, charWidth, Registration + i });
                            Success = EIP.GetAttribute(ClassCode.User_pattern, (byte)ccUP.User_Pattern_Free, data);
                        }
                        if (Success)
                        {
                            int hdrLen = cbLayout.SelectedIndex == (int)Layout.Fixed ? 2 : 4;
                            if (EIP.GetDataLength == bytesPerCharacter + hdrLen)
                            {
                                stripes[i] = BytesToStripe(charHeight, EIP.GetData, hdrLen);
                                bmGrid     = StripesToBitMap(stripes);
                                BitMapToImage();
                                grpGrid.Invalidate();
                            }
                        }
                        else
                        {
                            EIP.LogIt("User Pattern Upload Failed.  Aborting Upload!");
                            break;
                        }
                    }
                }
                EIP.ForwardClose();
            }
            EIP.EndSession();
            // Build the real image
            bmGrid = StripesToBitMap(stripes);
            BitMapToImage();
            SetButtonEnables();
        }
        void ApplyTheme(Control ContainerControl)
        {
            if (ContainerControl is Form)
            {
                (ContainerControl as Form).Paint += new PaintEventHandler(c_Paint);
                (ContainerControl as Form).Invalidate(true);
            }

            foreach (Control ctrl in ContainerControl.Controls)
            {
                if (ctrl is GroupBox)
                {
                    GroupBox gBox = ctrl as GroupBox;

                    gBox.Paint += new PaintEventHandler(c_Paint);
                    gBox.Invalidate();
                    gBox.ForeColor = System.Drawing.Color.White;
                    ApplyTheme(gBox);

                    gBox.ForeColor = System.Drawing.Color.White;
                    ApplyTheme(gBox);

                    gBox.MouseDown += new MouseEventHandler(GroupBox_MouseDown);
                }

                if (ctrl is Label)
                {
                    Label lbl = ctrl as Label;
                    if (lbl.Name == "lblTitle")
                    {
                        lbl.BackColor = System.Drawing.Color.Gray;
                        lbl.ForeColor = System.Drawing.Color.White;
                        continue;
                    }
                    lbl.ForeColor = System.Drawing.Color.WhiteSmoke;
                    lbl.BackColor = System.Drawing.Color.Transparent;
                }
                if (ctrl is CheckBox)
                {
                    CheckBox chk = ctrl as CheckBox;
                    chk.ForeColor = System.Drawing.Color.White;
                    chk.BackColor = System.Drawing.Color.Transparent;
                }

                if (ctrl is TextBox)
                {
                    TextBox txt = ctrl as TextBox;
                    if (txt != null)
                    {
                        txt.BorderStyle = BorderStyle.FixedSingle;
                        txt.ForeColor   = System.Drawing.Color.White;
                        txt.BackColor   = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
                    }
                }
                if (ctrl is Button)
                {
                    Button btn = ctrl as Button;
                    if (btn != null)
                    {
                        btn.BackColor = System.Drawing.SystemColors.ControlDarkDark;
                        btn.FlatStyle = System.Windows.Forms.FlatStyle.Popup;
                        btn.ForeColor = System.Drawing.Color.Transparent;
                        btn.UseVisualStyleBackColor = false;
                    }
                }

                if (ctrl is ComboBox)
                {
                    ComboBox cb = ctrl as ComboBox;
                    cb.FlatStyle = FlatStyle.Popup;
                    cb.BackColor = System.Drawing.Color.Gray;
                    cb.ForeColor = System.Drawing.Color.White;
                }

                if (ctrl is LinkLabel)
                {
                    LinkLabel lbl = ctrl as LinkLabel;
                    lbl.LinkColor = System.Drawing.Color.White;
                }
            }
        }