Exemple #1
0
        private void prizeListLv_RetrieveVirtualItem(object sender, RetrieveVirtualItemEventArgs e)
        {
            if (this.prizes == null || this.prizes.Count == 0)
            {
                return;
            }
            ListViewItem item  = new ListViewItem();
            var          prize = prizes.GetPrize(e.ItemIndex);

            item.Text = prize.Name;
            item.SubItems.Add(prize.Num.ToString());
            item.SubItems.Add(prize.Picpath);
            e.Item = item;
        }
Exemple #2
0
        // 重画抽奖页面缩略图
        private void PaintDrawPage()
        {
            Image im = imdb.DrawBg;

            if (im == null)
            {
                MessageBox.Show("没有设置抽奖背景图");
                return;
            }
            Bitmap        bit = new Bitmap(imdb.ScreenSize.Width, imdb.ScreenSize.Height);
            Graphics      g   = Graphics.FromImage(bit);
            PaintNameView vi  = new PaintNameView(new Rectangle(0, 0, imdb.ScreenSize.Width, imdb.ScreenSize.Height),
                                                  new Rectangle(config.maskX, config.maskY, config.maskW, config.maskH),
                                                  config,
                                                  imdb,
                                                  null);

            if (prizes.Count <= 0)
            {
                vi.SetPrize(new Prize("一等奖", 5, ""));
            }
            else
            {
                vi.SetPrize(prizes.GetPrize(0));
            }
            List <Person> ps = new List <Person>();

            ps.Add(new Person("张三"));
            ps.Add(new Person("李四"));
            vi.PaintResult(ps, g);
            //    vi.PaintCancel(g);

            drawPage.Image = bit;
        }
Exemple #3
0
 private void SetDrawingStatus()
 {
     if (status == DrawStatus.Drawing)
     {
         return;
     }
     if (prizeCB.SelectedIndex < 0)
     {
         MessageBox.Show("没有选择奖项");
         return;
     }
     prizeCB.Enabled  = false;
     timer1.Enabled   = true;
     cancelBt.Enabled = true;
     stopBt.Enabled   = true;
     startBt.Enabled  = false;
     status           = DrawStatus.Drawing;
     paintview.SetInterval(INTERVAL);
     paintview.SetPersons(noprizePersons);
     paintview.SetPrize(prizes.GetPrize(prizeCB.SelectedIndex));
 }
Exemple #4
0
        private void DrawDrawingStatus(Graphics g)
        {
            Image img = imdb.DrawBg;

            // 画背景
            g.DrawImage(img, new Rectangle(0, 0, showPic.Width, showPic.Height), new Rectangle(0, 0, img.Width, img.Height), GraphicsUnit.Pixel);
            // 画标题
            Color tcolor = ColorTranslator.FromHtml(config.tFont.colorStr);

            Font       tFont = new Font(config.tFont.family, config.tFont.size);
            SolidBrush bru1  = new SolidBrush(Color.FromArgb(tcolor.R, tcolor.G, tcolor.B));

            SizeF tsize = g.MeasureString(prizes.GetPrize(prizeCB.SelectedIndex).Name, tFont);

            g.DrawString(prizes.GetPrize(prizeCB.SelectedIndex).Name, tFont, bru1, showPic.Width / 2 - (tsize.Width / 2), showPic.Height / 20);


            // 画文字遮挡
            Color      mcolor = System.Drawing.ColorTranslator.FromHtml(config.colorStr);
            SolidBrush bru2   = new SolidBrush(Color.FromArgb(200, mcolor.R, mcolor.G, mcolor.B));
            RectangleF mrect  = new RectangleF(showPic.Width / 5 / 2, showPic.Height / 4 - showPic.Height / 8, showPic.Width - showPic.Width / 5, showPic.Height - showPic.Height / 4);

            g.FillRectangle(bru2, mrect);
            // 画文字
            Color      fcolor = System.Drawing.ColorTranslator.FromHtml(config.mFont.colorStr);
            Font       mFont  = new Font(config.mFont.family, config.mFont.size);
            SolidBrush bru3   = new SolidBrush(Color.FromArgb(fcolor.R, fcolor.G, fcolor.B));

            winList = noprizePersons.GetRandomList(prizes.GetPrize(prizeCB.SelectedIndex).Num);
            int   ia       = 1;
            SizeF fsize    = g.MeasureString("一二三四五", mFont);
            float interval = fsize.Height * 2;

            foreach (var a1 in winList)
            {
                RectangleF textrect = new RectangleF(showPic.Width / 5 / 2 + fsize.Width,
                                                     showPic.Height / 4 - showPic.Height / 8 + ia * interval,
                                                     mrect.Right - (showPic.Width / 5 / 2 + fsize.Width),
                                                     interval * 2);
                if (config.isShowName > 0)
                {
                    g.DrawString(a1.Name, mFont, bru3, showPic.Width / 5 / 2, showPic.Height / 4 - showPic.Height / 8 + ia * interval);
                }
                if (config.isShowText > 0)
                {
                    g.DrawString(a1.Text, mFont, bru3, textrect);
                }


                ia++;
            }
        }