Beispiel #1
0
        private void LoadBackgroundImage()
        {
            try
            {
                if (PosApplication.Instance.Services.ApplicationService.LoginWindowImage != null)
                {
                    this.BackgroundImage = PosApplication.Instance.Services.ApplicationService.LoginWindowImage;
                }
                else
                {
                    int imageId = VisualProfile.ImageId;

                    // Only attempy load if we have an image ID
                    if (imageId > 0)
                    {
                        LayoutData layoutData = new LayoutData(ApplicationSettings.Database.LocalConnection, ApplicationSettings.Database.DATAAREAID);
                        using (DataTable pictureTable = layoutData.GetPicture(imageId))
                        {
                            byte[] pictureData = (byte[])pictureTable.Rows[0]["PICTURE"];

                            if (pictureData.Length > 0)
                            {
                                this.BackgroundImage = LSRetailPosis.ButtonGrid.GUIHelper.GetBitmap(pictureData);
                            }
                        }
                    }
                }

                // Set background image layout
                if (this.BackgroundImage != null)
                {
                    // Set to Center. Note if this is set to Tile (default) colors are rendered correctly e.g. White in images is rendered light gray
                    this.BackgroundImageLayout = ImageLayout.Center;
                }
            }
            catch (Exception ex)
            {
                NetTracer.Warning(ex, "LogOnForm.LoadBackgroundImage() exception loading background image");
            }
        }