Ejemplo n.º 1
0
        public void SetTitle(string text)
        {
            DpiScale dpiScale = new DpiScale(CreateGraphics());

            lblTitle.Text = text;
            GetRowStyle(lblTitle).Height = lblTitle.Height + dpiScale.ScaleFloatY(6);
            if (GetRowStyle(lblTitle).Height < m_labelHeight)
            {
                GetRowStyle(lblTitle).Height = m_labelHeight;
            }
        }
Ejemplo n.º 2
0
 private void ShowCommentsSection(bool bShow)
 {
     if (bShow)
     {
         DpiScale dpiScale = new DpiScale(CreateGraphics());
         GetRowStyle(txtComments).Height = dpiScale.ScaleFloatY(20);
     }
     else
     {
         GetRowStyle(txtComments).Height = 0;
     }
 }
Ejemplo n.º 3
0
 private void SetIwadInfoLabel()
 {
     if (GameFile != null && IsIwad(GameFile) && SelectedGameProfile is GameFile)
     {
         DpiScale dpiScale = new DpiScale(CreateGraphics());
         tblFiles.RowStyles[0].Height = dpiScale.ScaleFloatY(40);
         pbInfo.Image = Properties.Resources.bon2b;
         lblInfo.Text = string.Format("These files will automatically be added{0} when this IWAD is selected for play.", Environment.NewLine);
     }
     else
     {
         tblFiles.RowStyles[0].Height = 0;
     }
 }
Ejemplo n.º 4
0
        public void SetStatistics(IGameFile gameFile, IEnumerable <IStatsData> stats)
        {
            if (stats.Any())
            {
                DpiScale dpiScale = new DpiScale(CreateGraphics());
                ctrlStats.Visible             = true;
                GetRowStyle(ctrlStats).Height = dpiScale.ScaleFloatY(120);

                ctrlStats.SetStatistics(gameFile, stats);

                lblLastMap.Text = stats.OrderByDescending(x => x.RecordTime).First().MapName;
            }
            else
            {
                ctrlStats.Visible             = false;
                GetRowStyle(ctrlStats).Height = 0;
                lblLastMap.Text = "N/A";
            }
        }
Ejemplo n.º 5
0
        public void SetTitle(string text)
        {
            if (lblTitle.Text == text)
            {
                return;
            }

            DpiScale dpiScale = new DpiScale(CreateGraphics());

            lblTitle.Text = text;

            float height = lblTitle.Height + dpiScale.ScaleFloatY(6);

            if (height < m_labelHeight)
            {
                height = m_labelHeight;
            }

            GetRowStyle(lblTitle).Height = height;
        }
Ejemplo n.º 6
0
        private void DrawProgress(Point pt, int count, int total, string text)
        {
            Graphics g        = CreateGraphics();
            DpiScale dpiScale = new DpiScale(g);
            int      offsetX  = dpiScale.ScaleIntX(1);
            int      offsetY  = dpiScale.ScaleIntY(1);

            int       height = Height - offsetX;
            int       width  = Width - offsetY;
            Pen       pen    = new Pen(Color.Black, 1.0f);
            Rectangle rect   = new Rectangle(pt, new Size(width, height));

            g.DrawRectangle(pen, rect);

            double percent = 0;

            if (total > 0)
            {
                percent = count / (double)total;
            }
            width = (int)((Width - offsetX) * percent);

            pt.Offset(offsetX, offsetY);
            rect = new Rectangle(pt, new Size(rect.Width - offsetX, rect.Height - offsetY));
            Brush     bgBrush     = new LinearGradientBrush(rect, Color.DarkGray, Color.LightGray, 90.0f);
            Rectangle percentRect = new Rectangle(rect.Location, new Size(width, rect.Height));
            Brush     brush       = GetPercentBrush(rect, percent);

            g.FillRectangle(bgBrush, rect);
            if (percent > 0)
            {
                g.FillRectangle(brush, percentRect);
                pt.Offset(-offsetX, -offsetY);
                g.DrawRectangle(GetPrecentPen(percent), new Rectangle(pt, new Size(percentRect.Width + offsetX, percentRect.Height + offsetY)));
            }

            Brush  fontBrush = new SolidBrush(Color.Black);
            PointF position  = new PointF(pt.X + dpiScale.ScaleIntX(8), pt.Y + dpiScale.ScaleFloatY(2.5f));

            g.DrawString(text, new Font(FontFamily.GenericSerif, 10.0f, FontStyle.Bold), fontBrush, position);
        }
Ejemplo n.º 7
0
        public void SetStatistics(IGameFile gameFile, IEnumerable <IStatsData> stats)
        {
            if (stats.Any())
            {
                DpiScale dpiScale = new DpiScale(CreateGraphics());
                ctrlStats.Visible             = true;
                GetRowStyle(ctrlStats).Height = dpiScale.ScaleFloatY(120);

                ctrlStats.SetStatistics(gameFile, stats);

                // Many maps can be saved at the same time, ordering by record time is not guaranteed to preserve the original order
                // Order by StatID to ensure the latest one is used
                lblLastMap.Text = stats.OrderByDescending(x => x.RecordTime).ThenByDescending(x => x.StatID).First().MapName;
            }
            else
            {
                ctrlStats.Visible             = false;
                GetRowStyle(ctrlStats).Height = 0;
                lblLastMap.Text = "N/A";
            }
        }
Ejemplo n.º 8
0
        private void DrawProgress(Point pt, int count, int total, string text)
        {
            Graphics g        = CreateGraphics();
            DpiScale dpiScale = new DpiScale(g);
            int      offsetX  = dpiScale.ScaleIntX(1);
            int      offsetY  = dpiScale.ScaleIntY(1);

            int       height = Height - offsetY;
            int       width  = Width - offsetX;
            Pen       pen    = new Pen(Color.Black, 1.0f);
            Rectangle rect   = new Rectangle(pt, new Size(width, height));

            g.DrawRectangle(pen, rect);

            double percent = 0;

            if (total > 0)
            {
                percent = count / (double)total;
            }

            width = Width - offsetX;
            if (total != 0)
            {
                width = (int)(width * percent);
            }

            pt.Offset(offsetX, offsetY);
            rect = new Rectangle(pt, new Size(rect.Width - offsetX, rect.Height - offsetY));
            Brush     bgBrush     = new LinearGradientBrush(rect, Color.DarkGray, Color.LightGray, 90.0f);
            Rectangle percentRect = new Rectangle(rect.Location, new Size(width, rect.Height));
            Brush     brush       = GetPercentBrush(rect, percent, total);

            g.FillRectangle(bgBrush, rect);
            if (width > 0)
            {
                g.FillRectangle(brush, percentRect);
                pt.Offset(-offsetX, -offsetY);
                g.DrawRectangle(GetPrecentPen(percent, total), new Rectangle(pt, new Size(percentRect.Width + offsetX, percentRect.Height + offsetY)));
            }

            SizeF  size     = g.MeasureDisplayString(text, DisplayFont);
            var    offset   = (height - size.Height) / 2;
            PointF position = new PointF(pt.X + dpiScale.ScaleIntX(8), pt.Y + offset + dpiScale.ScaleFloatY(2.5f));

            g.DrawString(text, DisplayFont, FontBrush, position);
        }