コード例 #1
0
        public FrmEditShopItem(PrintShopItem item, int artistAttendingID = -1)
        {
            InitializeComponent();
            TxtNotes.SetWatermark("Optional");
            TxtPrice.SetWatermark("NFS If Blank");

            ShopItem = item ?? new PrintShopItem();
            if (artistAttendingID > -1)
            {
                ShopItem.ArtistAttendingID = artistAttendingID;
            }
            if (item == null)
            {
                return;
            }

            LblShowNumber.Text = ShopItem.ShowNumber != null?ShopItem.ShowNumber.ToString() : "TBD";

            TxtTitle.Text             = ShopItem.Title;
            TxtMedia.Text             = ShopItem.Media;
            NumQuantitySent.Value     = ShopItem.QuantitySent;
            TxtPrice.Text             = ShopItem.Price.ToString();
            TxtNotes.Text             = ShopItem.Notes ?? "";
            TxtLocation.Text          = ShopItem.LocationCode ?? "";
            CmbCategory.SelectedIndex = ShopItem.Category != null?CmbCategory.FindString(ShopItem.Category) : 0;
        }
コード例 #2
0
        private Bitmap DrawPrintShopLabel(PrintShopItem item, PrintPageEventArgs e)
        {
            var fontTextBold = new Font("Lucida Sans", 12, FontStyle.Bold);
            var fontText     = new Font("Lucida Sans", 10);
            var leftCentered = new StringFormat {
                LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Near
            };
            var rightCentered = new StringFormat {
                LineAlignment = StringAlignment.Center, Alignment = StringAlignment.Far
            };

            var settings    = new PrinterSettings();
            var resX        = settings.DefaultPageSettings.PrinterResolution.X;
            var resY        = settings.DefaultPageSettings.PrinterResolution.Y;
            var imageWidth  = (int)(resX * 2.5);
            var imageHeight = resY;

            var image = new Bitmap(imageWidth, imageHeight);

            image.SetResolution(resX, resY);
            var gfx      = Graphics.FromImage(image);
            var currentY = 0F;

            var text      = item.Title;
            var textLines = WrapText(text, image.Width, fontTextBold);

            foreach (string line in textLines)
            {
                gfx.DrawString(line, fontTextBold, Brushes.Black, new RectangleF(0, currentY, image.Width, fontTextBold.GetHeight(gfx)), leftCentered);
                currentY += (float)(fontTextBold.GetHeight(gfx) * 1.05);
            }
            if (textLines.Count == 1)
            {
                currentY += (float)(fontTextBold.GetHeight(gfx) * 1.05);
            }
            text = Artist.DisplayName;
            gfx.DrawString(text, fontText, Brushes.Black, new RectangleF(0, currentY, image.Width, fontText.GetHeight(gfx)), leftCentered);
            text = item.Price.ToString("C");
            gfx.DrawString(text, fontText, Brushes.Black, new RectangleF(0, currentY, image.Width, fontText.GetHeight(gfx)), rightCentered);

            gfx.Dispose();

            var resized = new Bitmap(image, image.Width / 6, image.Height / 6);

            return(resized);
        }
コード例 #3
0
ファイル: Classes.cs プロジェクト: LVerhulst4321/Capricon
        internal PrintShopItem Clone()
        {
            var copy = new PrintShopItem
            {
                ArtID             = ArtID,
                ArtistAttendingID = ArtistAttendingID,
                ArtistName        = ArtistName,
                Category          = Category,
                CheckedIn         = CheckedIn,
                LastError         = LastError,
                LocationCode      = LocationCode,
                Media             = Media,
                Notes             = Notes,
                Price             = Price,
                ShowNumber        = ShowNumber,
                Title             = Title,
                QuantitySent      = QuantitySent,
                QuantitySold      = QuantitySold,
                IsCharity         = IsCharity
            };

            return(copy);
        }