示例#1
0
        public void Create(int x, int y, Equipment equipment)
        {
            if (y + mainRec.Height > size.Y)
            {
                mainRec.Y = (int)(size.Y - mainRec.Height);
            }
            else
            {
                mainRec.Y = y;
            }
            if (x + mainRec.Width > size.X)
            {
                mainRec.X = (int)(size.X - mainRec.Width);
            }
            else
            {
                mainRec.X = x;
            }

            text = equipment.GetName() + Environment.NewLine + Environment.NewLine;
            string[] temp       = equipment.GetText().Split(' ');
            string   tempstring = temp[0];

            for (int i = 1; i < temp.Length; i++)
            {
                if (font.MeasureString(tempstring + " " + temp[i]).X > mainRec.Width - (offset * 2))
                {
                    text      += tempstring + Environment.NewLine;
                    tempstring = temp[i];
                }
                else
                {
                    tempstring += " " + temp[i];
                }
                if (i == temp.Length - 1)
                {
                    text += tempstring + Environment.NewLine;
                }
            }

            int a = 0;
        }
示例#2
0
        public string Text(int i)
        {
            string text = equipment.GetName() + " " + 20 * i + " Pts";

            return(text);
        }