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


C# Microsoft.DrawText方法代码示例

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


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

示例1: Render

        public void Render(Microsoft.SPOT.Bitmap screen)
        {
            screen.DrawLine(Color.White, 2, 0, AGENT.Size / 2, AGENT.Size, AGENT.Size / 2);

            DateTime now = DateTime.Now;
            int counter = (int)now.DayOfWeek;
            counter++;
            int left = buffer;
            IForecast nowForecast = null;
            bool needsDate = false;
            DateTime lastUpdated = DateTime.Now;
            for (int x = 0; x <= days; x++)
            {
                if (counter >= 7) counter = 0;
                string dayName = System.Globalization.DateTimeFormatInfo.CurrentInfo.DayNames[counter];
                if (dayName.Length >= 3) dayName = dayName.Substring(0, 3);
                int width = drawing.MeasureString(dayName, font);
                screen.DrawText(dayName, font, Color.White, left, top);
                if (WeatherProvider != null && WeatherProvider.CurrentWeekForecast != null && WeatherProvider.CurrentWeekForecast.Count > 0)
                {
                    IForecast current = WeatherProvider.CurrentWeekForecast[0] as IForecast;
                    var startDate = now.Date.AddDays(x);
                    foreach (IForecast f in WeatherProvider.CurrentWeekForecast)
                    {
                        if (f.TimeStamp.Year == now.Date.Year && f.TimeStamp.Month == now.Date.Month && f.TimeStamp.Day == now.Date.Day)
                            nowForecast = f;
                        if (startDate.Year == f.TimeStamp.Year && startDate.Month == f.TimeStamp.Month && startDate.Day == f.TimeStamp.Day)
                        {
                            Debug.Print("Found match");
                            current = f;
                            break;
                        }
                    }
                    if (current != null)
                    {
                        needsDate = true;
                        screen.DrawText(current.Temperature.ToString(), font, Color.White, left + 4, top + font.Height + 2);
                        lastUpdated = current.TimeStamp;
                    }
                }
                counter++;
                if (counter > 6) counter = 0;
                left += width + buffer;
            }
            if (nowForecast != null)
            {
                string display = nowForecast.Temperature.ToString();
                int forecastLeft = AGENT.Size - drawing.MeasureString(display, bigfont);
                screen.DrawText(display, bigfont, Color.White, forecastLeft, (AGENT.Size / 2) + 2);
                needsDate = true;
                lastUpdated = nowForecast.TimeStamp;
            }
            if (needsDate)
            {
                screen.DrawText(lastUpdated.ToString(), smallFont, Color.White, 3, (AGENT.Size / 2) - smallFont.Height - 1);

            }

        }
开发者ID:Hector47,项目名称:AGENT.Contrib,代码行数:59,代码来源:WeatherWatchFace.cs

示例2: Render

        public void Render(Microsoft.SPOT.Bitmap screen)
        {
           
            int height = width/2;
            
            drawing.DrawBattery(screen, new Point(AGENT.Contrib.Device.Size/2 - width/2, AGENT.Contrib.Device.Size/2 - height/2), width, height, 1,
                                Color.White, Color.Black, charging, AGENT.Contrib.Hardware.Battery.Level);

            screen.DrawText("width:" + width.ToString() + ", height:" + height.ToString(), font, Color.White, 0,
                            AGENT.Contrib.Device.Size - font.Height);
         
        }
开发者ID:nothingmn,项目名称:AGENT.Contrib,代码行数:12,代码来源:BatterySizesFace.cs

示例3: Draw

        public void Draw(string text, float x, float y, float width, float height, Microsoft.DirectX.Direct3D.Font font)
        {

            _background.Begin(SpriteFlags.AlphaBlend);
            _background.Transform = Matrix.Scaling(width / _window_texture_width, height / _window_texture_height, 0) * Matrix.Translation(x, y, 0);

            _background.Draw(_window_background, Vector3.Empty, Vector3.Empty, Color.White.ToArgb());

            _text_rectangle.X = (int)x + Padding;
            _text_rectangle.Y = (int)y + Padding;
            _text_rectangle.Width = (int)width - (2 * Padding);
            _text_rectangle.Height = (int)height - (2 * Padding);

            _background.Transform = Matrix.Scaling(1, 1, 1);
            font.DrawText(_background, text, _text_rectangle, Format, Foreground);
            if (Activated)
            {
                Activated = false;
            }
            _background.End();
        }
开发者ID:wshanshan,项目名称:DDD,代码行数:21,代码来源:Obj_Window.cs

示例4: DrawCenteredText

        public bool DrawCenteredText(Microsoft.DirectX.Direct3D.Font font, string text, int x, int y, int color)
        {
            int centeredX = 0;
            int centeredY = 0;
            Rectangle rect;

            if ((font == null) || (text == null) || (text.Length <= 0))
            {
                return false;
            }

            rect = font.MeasureString(null, text, DrawTextFormat.None, color);

            centeredX = x - rect.Width / 2;
            centeredY = y - rect.Height / 2;
            if (font.DrawText(null, text, centeredX, centeredY, color) == 0)
            {
                return false;
            }

            return true;
        }
开发者ID:wshanshan,项目名称:DDD,代码行数:22,代码来源:MapPlayfieldContainer.cs

示例5: DrawObjectID

 public void DrawObjectID(Canvas canvas, Microsoft.DirectX.Direct3D.Font font)
 {
     if (ID != string.Empty)
     {
         _text_rect = font.MeasureString(null, ID, DrawTextFormat.Center, TextColor);
         _text_rect.X = (SpriteArea.X + ((SpriteArea.Width - _text_rect.Width) / 2)) - 5;
         _text_rect.Y = SpriteArea.Bottom;
         _text_rect.Width += 10;
         canvas.DrawFillRect(_text_rect, _textbox_color_material);
    
         font.DrawText(null, ID, _text_rect, DrawTextFormat.Center, TextColor);
     }
 }
开发者ID:wshanshan,项目名称:DDD,代码行数:13,代码来源:MappableObject.cs

示例6: PrintString

		private void PrintString(string text,float x,float y,float z,Color color,Microsoft.DirectX.Direct3D.Font printFont) {
			Vector3 screenPoint=new Vector3(x,y,z);
			screenPoint.Project(device.Viewport,device.Transform.Projection,device.Transform.View,device.Transform.World);
			printFont.DrawText(null,text,new Point((int)Math.Ceiling(screenPoint.X),(int)Math.Floor(screenPoint.Y)),color);
		}
开发者ID:mnisl,项目名称:OD,代码行数:5,代码来源:ToothChartDirectX.cs

示例7: render

        public void render(ref Device device, ref Microsoft.DirectX.Direct3D.Font directxFont)
        {
            if (this.functions != null && this.functions.Count > 0)
            {
                // Render this module name and bounding box

                // Draw the module name
                directxFont.DrawText(null, name, x, y, Color.White);

                // TODO: Draw the module border
            }
        }
开发者ID:obarhleam,项目名称:FunctionHacker,代码行数:12,代码来源:oVisLookup.cs

示例8: DisplayScore

 //Display flying score
 public void DisplayScore(Microsoft.DirectX.Direct3D.Font font)
 {
     font.DrawText(null, "+" + scorenum, pos, Color.LightCyan);
 }
开发者ID:KylerWilkins,项目名称:OldPro3,代码行数:5,代码来源:ScoreFlying.cs

示例9: DrawSpecial

        public override void DrawSpecial(Microsoft.DirectX.Direct3D.Font font, RectangleF overlay_rect, Rectangle text_rect, Canvas canvas)
        {

            _overlay_rect = overlay_rect;
            _text_rect = text_rect;
            _progressbar_rect = text_rect;
            _border_rect = text_rect;

           

            if ((OwnerID == DDD_Global.Instance.PlayerID) && (DrawProgressBar))
            {

                _progressbar_rect.Y += text_rect.Height;
                _progressbar_rect.Height = _ProgressBarHeight_;
                _progressbar_rect.Width = _ProgressBarWidth_;
                _progressbar_rect.X += ((text_rect.Width - _progressbar_rect.Width) / 2);

                _border_rect.Height = _ProgressBarHeight_ + _text_rect.Height + 2;

                canvas.DrawFillRect(_border_rect, _textbox_color_material);

                DrawObjectID(canvas, font);
                canvas.DrawRect(_border_rect, BorderColor);

                if (FuelCapacity > 0)
                {
                    canvas.DrawProgressBar(_progressbar_rect,
                        progress_bar_background_material,
                        progress_bar_foreground_material,
                        FuelAmount / FuelCapacity);
                }
                else
                {
                    canvas.DrawProgressBar(_progressbar_rect,
                        progress_bar_background_material,
                        progress_bar_foreground_material,
                        0);
                }
            }
            else
            {
                if (DrawUnmanagedAssetLabel)
                {
                    DrawObjectID(canvas, font);
                    canvas.DrawRect(_border_rect, BorderColor);
                }

            }



            foreach (DDDObjects attacker in Attackers)
            {
                float _destinationX = attacker.SpriteArea.X + (attacker.SpriteArea.Width / 2);
                float _destinationY = attacker.SpriteArea.Y + (attacker.SpriteArea.Height / 2);
                canvas.DrawLine(Color.Red, 1,
                    SpriteArea.X + (SpriteArea.Width / 2),
                    SpriteArea.Y + (SpriteArea.Height / 2),
                    _destinationX,
                    _destinationY
                    );
                //engagment_rect.X = (int)(_destinationX - 3);
                //engagment_rect.Y = (int)(_destinationY - 3);
                //engagment_rect.Height = 6;
                //engagment_rect.Width = 6;
                //canvas.DrawFillRect(engagment_rect, red_material);
            }

            if (IsBeingAttacked)
            {
                engagment_rect = font.MeasureString(null, _engagementTimeStr, DrawTextFormat.Center | DrawTextFormat.VerticalCenter, Color.Red);
                engagment_rect.Width += 10;
                engagment_rect.X = (int)(_overlay_rect.X + (_overlay_rect.Width - engagment_rect.Width) / 2);
                engagment_rect.Y = (int)(_overlay_rect.Y + (_overlay_rect.Height - engagment_rect.Height) / 2);
                canvas.DrawFillRect(engagment_rect, black_material);
                canvas.DrawRect(engagment_rect, Color.Red);
                font.DrawText(null, _engagementTimeStr, engagment_rect, DrawTextFormat.Center | DrawTextFormat.VerticalCenter, Color.Red);
            }


            // Draw object "Tags"
            if (Tag != string.Empty && (DDD_Global.Instance.TagPosition != TagPositionEnum.INVISIBLE))
            {
                Rectangle tag_rect = font.MeasureString(null, Tag, DrawTextFormat.Center, Color.Black);

                switch (DDD_Global.Instance.TagPosition)
                {
                    case TagPositionEnum.ABOVE:
                        tag_rect.Y = (int)(overlay_rect.Y - tag_rect.Height);
                        tag_rect.X = (int)(overlay_rect.X + ((overlay_rect.Width - tag_rect.Width) * .5f));
                        break;
                    case TagPositionEnum.BELOW:
                        if (!DrawUnmanagedAssetLabel && (OwnerID != DDD_Global.Instance.PlayerID))
                        {
                            tag_rect.Y = (int)(overlay_rect.Bottom + 1);
                            tag_rect.X = (int)(overlay_rect.X + ((overlay_rect.Width - tag_rect.Width) * .5f));
                        }
                        else
                        {
//.........这里部分代码省略.........
开发者ID:wshanshan,项目名称:DDD,代码行数:101,代码来源:MapObjects.cs

示例10: Draw

        public bool Draw(Microsoft.DirectX.Direct3D.Font font, Rectangle client_rect, int offsetx, int offsety)
        {

            temp.X = client_rect.X - offsetx;
            temp.Y = client_rect.Y - offsety;
            
            if (offsety < client_rect.Bottom)
            {
                font.DrawText(null, _text, client_rect.X - (int)offsetx, offsety, Foreground);
                return true;
            }
            return false;

        }
开发者ID:wshanshan,项目名称:DDD,代码行数:14,代码来源:PanelTextRegion.cs

示例11: Render

			public int Render(DrawArgs drawArgs, int x, int y, int yOffset, int width, int height, 
				Microsoft.DirectX.Direct3D.Font drawingFont,
				Microsoft.DirectX.Direct3D.Font wingdingsFont,
				Microsoft.DirectX.Direct3D.Font worldwinddingsFont, 
				LayerMenuItem mouseOverItem)
			{
				if(ParentControl == null)
					ParentControl = drawArgs.parentControl;

				this._x = x;
				this._y = y + yOffset;
				this._width = width;

				int consumedHeight = 20;
				
				System.Drawing.Rectangle textRect = drawingFont.MeasureString(null,
					m_renderableObject.Name,
					DrawTextFormat.None,
					System.Drawing.Color.White.ToArgb());

				consumedHeight = textRect.Height;

				if (m_renderableObject.Description != null && m_renderableObject.Description.Length > 0 && !(m_renderableObject is WorldWind.Renderable.Icon))
				{
					System.Drawing.SizeF rectF = DrawArgs.Graphics.MeasureString(
						m_renderableObject.Description,
						drawArgs.defaultSubTitleFont,
						width - (this._itemXOffset + this._expandArrowXSize + this._checkBoxXOffset)
						);
				
					consumedHeight += (int)rectF.Height + 15;
				}

				lastConsumedHeight = consumedHeight;
				// Layer manager client area height
				int totalHeight = height - y;

				updateList();

				if(yOffset >= -consumedHeight)
				{
					// Part of item or whole item visible
					int color = m_renderableObject.IsOn ? itemOnColor : itemOffColor;
					if(mouseOverItem==this)
					{
						if(!m_renderableObject.IsOn)
							// mouseover + inactive color (black)
							color = 0xff << 24;
						MenuUtils.DrawBox(m_parent.ClientLeft,_y,m_parent.ClientWidth,consumedHeight,0,
							World.Settings.menuOutlineColor, drawArgs.device);
					}

					if(m_renderableObject is WorldWind.Renderable.RenderableObjectList)
					{
						RenderableObjectList rol = (RenderableObjectList)m_renderableObject;
						if(!rol.DisableExpansion)
						{
							worldwinddingsFont.DrawText(
								null,
								(this.isExpanded ? "L" : "A"),
								new System.Drawing.Rectangle(x + this._itemXOffset, _y, this._expandArrowXSize, height),
								DrawTextFormat.None,
								color );
						}
					}

					string checkSymbol = null;
					if(m_renderableObject.ParentList != null && m_renderableObject.ParentList.ShowOnlyOneLayer)
						// Radio check
						checkSymbol = m_renderableObject.IsOn ? "O" : "P";
					else				
						// Normal check
						checkSymbol = m_renderableObject.IsOn ? "N" : "F";

					worldwinddingsFont.DrawText(
							null,
							checkSymbol,
							new System.Drawing.Rectangle(
							x + this._itemXOffset + this._expandArrowXSize,
							_y,
							this._checkBoxXOffset,
							height),
							DrawTextFormat.NoClip,
							color );


					drawingFont.DrawText(
						null,
						m_renderableObject.Name,
						new System.Drawing.Rectangle(
						x + this._itemXOffset + this._expandArrowXSize + this._checkBoxXOffset,
						_y,
						width - (this._itemXOffset + this._expandArrowXSize + this._checkBoxXOffset),
						height),
						DrawTextFormat.None,
						color );

					if(m_renderableObject.Description != null && m_renderableObject.Description.Length > 0 && !(m_renderableObject is WorldWind.Renderable.Icon))
					{
						drawArgs.defaultSubTitleDrawingFont.DrawText(
//.........这里部分代码省略.........
开发者ID:jpespartero,项目名称:WorldWind,代码行数:101,代码来源:Menu.cs


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