当前位置: 首页>>代码示例>>C#>>正文


C# IGraphic.DrawString方法代码示例

本文整理汇总了C#中IGraphic.DrawString方法的典型用法代码示例。如果您正苦于以下问题:C# IGraphic.DrawString方法的具体用法?C# IGraphic.DrawString怎么用?C# IGraphic.DrawString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IGraphic的用法示例。


在下文中一共展示了IGraphic.DrawString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowPageSelector

 /// <summary>
 /// Shows the page selector.(Pages in shop)
 /// </summary>
 /// <param name="graphObject">Graphic render object</param>
 private void ShowPageSelector(IGraphic graphObject)
 {
   if (_towerIcons.Count > Settings.LinesInOnePage * Settings.MaxTowersInLine)
   {
     ShopPageSelectorAction((int i, int dy, int xMouse, int yMouse) =>
     {
       //String
       graphObject.DrawString("Page " + (i + 1).ToString(CultureInfo.InvariantCulture), new Font("Arial", 14 * Scaling), new SolidBrush(Color.Black),
         new Point(
           Convert.ToInt32((_paginatorPos.X + (i % ElementsDelta) * ("Page " + (i + 1).ToString(CultureInfo.InvariantCulture)).Length * Settings.PixelsForOneSymbol) * Scaling),
           Convert.ToInt32((_paginatorPos.Y + PaginatorElementHeight * dy) * Scaling)));
       //Border line
       Color penColor = ((i + 1) == CurrentShopPage) ? Color.Red : Color.White;
       graphObject.DrawRectangle(new Pen(penColor, Settings.PenWidth * Scaling), BuildRectPageSelector(i, dy));
       return false;
     });
   }
 }
开发者ID:tupieurods,项目名称:tower-defense-csharp-opengl.gamelogic,代码行数:22,代码来源:TowerShop.cs

示例2: ShowTower

 /// <summary>
 /// Shows the tower.
 /// </summary>
 /// <param name="canva">The canva.</param>
 /// <param name="visibleStart">The visible start.</param>
 /// <param name="visibleFinish">The visible finish.</param>
 internal void ShowTower(IGraphic canva, Point visibleStart, Point visibleFinish)
 {
   //Checking, is tower visible map area or not
   bool flag = (((ArrayPos.X + 1) * Settings.ElemSize/* - CurrentTowerParams.AttackRadius */< visibleFinish.X * Settings.ElemSize) ||
                ((ArrayPos.Y + 1) * Settings.ElemSize/* - CurrentTowerParams.AttackRadius */< visibleFinish.Y * Settings.ElemSize));
   //if ((ArrayPos.Y >= VisibleFinish.Y) || (ArrayPos.X >= VisibleFinish.X))
   //if ((Flag)&&((ArrayPos.X < (VisibleStart.X-1)) || (ArrayPos.Y < (VisibleStart.Y-1))))
   if ((flag) && (!(((ArrayPos.X + 1) * Settings.ElemSize/* + CurrentTowerParams.AttackRadius */> visibleStart.X * Settings.ElemSize) ||
     ((ArrayPos.Y + 1) * Settings.ElemSize/* + CurrentTowerParams.AttackRadius */> visibleStart.Y * Settings.ElemSize))))
     flag = false;
   if (!flag) return;
   canva.DrawImage(CurrentTowerParams.Picture,
     Convert.ToInt32((-(CurrentTowerParams.Picture.Width / 2) + (ArrayPos.X + 1 - visibleStart.X) * Settings.ElemSize) * Scaling + Settings.DeltaX),
     Convert.ToInt32((-(CurrentTowerParams.Picture.Height / 2) + (ArrayPos.Y + 1 - visibleStart.Y) * Settings.ElemSize) * Scaling + Settings.DeltaY),
     Convert.ToInt32(CurrentTowerParams.Picture.Width * Scaling), Convert.ToInt32(CurrentTowerParams.Picture.Height * Scaling));
   if (_wasCrit == 0) return;
   _wasCrit--;
   //Critical strike notification
   canva.DrawString(
     string.Format("{0}!", CurrentTowerParams.Damage * CurrentTowerParams.CritMultiple),
       new Font("Arial", 20), new SolidBrush(Color.Red),
       new PointF(
         (-(CurrentTowerParams.Picture.Width / 2) + (ArrayPos.X + 1 - visibleStart.X) * Settings.ElemSize) * Scaling + Settings.DeltaX,
         (-(CurrentTowerParams.Picture.Height / 2) + (ArrayPos.Y + 1 - visibleStart.Y) * Settings.ElemSize) * Scaling + Settings.DeltaY));
 }
开发者ID:tupieurods,项目名称:tower-defense-csharp-opengl.gamelogic,代码行数:31,代码来源:Tower.cs


注:本文中的IGraphic.DrawString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。