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


C# Renderer.DrawLayer方法代码示例

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


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

示例1: DrawControl

    ////////////////////////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////////////////////   
    protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
    {                  
      SkinLayer layer = Skin.Layers["Control"];      
      SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null;
      Color col = (layer.Text != null) ? layer.Text.Colors.Enabled : Color.White;
      Point offset = new Point(layer.Text.OffsetX, layer.Text.OffsetY);        
               
      renderer.DrawLayer(this, layer, rect);
     
      if (font != null && Text != null && Text != "")
      {                      
        renderer.DrawString(this, layer, Text, new Rectangle(rect.Left, rect.Top + layer.ContentMargins.Top, rect.Width, Skin.ClientMargins.Top - layer.ContentMargins.Horizontal), false, offset.X, offset.Y, false);
      } 
    }
开发者ID:Kammikazy,项目名称:Neoforce-Mono,代码行数:17,代码来源:GroupPanel.cs

示例2: DrawControl

		////////////////////////////////////////////////////////////////////////////                          

		////////////////////////////////////////////////////////////////////////////
		protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
		{
			base.DrawControl(renderer, rect, gameTime);

			SkinLayer l1 = Skin.Layers["Control"];
			SkinLayer l2 = Skin.Layers["Selection"];

			int vsize = LineHeight();
			Color col = Color.White;

			for (int i = 0; i < Items.Count; i++)
			{
				int mod = i > 0 ? 2 : 0;
				int left = rect.Left + l1.ContentMargins.Left + vsize;
				int h = vsize - mod - (i < (Items.Count - 1) ? 1 : 0);
				int top = rect.Top + l1.ContentMargins.Top + (i * vsize) + mod;


				if (Items[i].Separated && i > 0)
				{
					Rectangle r = new Rectangle(left, rect.Top + l1.ContentMargins.Top + (i * vsize), LineWidth() - vsize + 4, 1);
					renderer.Draw(Manager.Skin.Controls["Control"].Layers[0].Image.Resource, r, l1.Text.Colors.Enabled);
				}
				if (ItemIndex != i)
				{
					if (Items[i].Enabled)
					{
						Rectangle r = new Rectangle(left, top, LineWidth() - vsize, h);
						renderer.DrawString(this, l1, Items[i].Text, r, false);
						col = l1.Text.Colors.Enabled;
					}
					else
					{
						Rectangle r = new Rectangle(left + l1.Text.OffsetX,
													top + l1.Text.OffsetY,
													LineWidth() - vsize, h);
						renderer.DrawString(l1.Text.Font.Resource, Items[i].Text, r, l1.Text.Colors.Disabled, l1.Text.Alignment);
						col = l1.Text.Colors.Disabled;
					}
				}
				else
				{
					if (Items[i].Enabled)
					{
						Rectangle rs = new Rectangle(rect.Left + l1.ContentMargins.Left,
													 top,
													 Width - (l1.ContentMargins.Horizontal - Skin.OriginMargins.Horizontal),
													 h);
						renderer.DrawLayer(this, l2, rs);

						Rectangle r = new Rectangle(left,
													top, LineWidth() - vsize, h);

						renderer.DrawString(this, l2, Items[i].Text, r, false);
						col = l2.Text.Colors.Enabled;
					}
					else
					{
						Rectangle rs = new Rectangle(rect.Left + l1.ContentMargins.Left,
													 top,
													 Width - (l1.ContentMargins.Horizontal - Skin.OriginMargins.Horizontal),
													 vsize);
						renderer.DrawLayer(l2, rs, l2.States.Disabled.Color, l2.States.Disabled.Index);

						Rectangle r = new Rectangle(left + l1.Text.OffsetX,
													top + l1.Text.OffsetY,
													LineWidth() - vsize, h);
						renderer.DrawString(l2.Text.Font.Resource, Items[i].Text, r, l2.Text.Colors.Disabled, l2.Text.Alignment);
						col = l2.Text.Colors.Disabled;
					}

				}

				if (Items[i].Image != null)
				{
					Rectangle r = new Rectangle(rect.Left + l1.ContentMargins.Left + 3,
												rect.Top + top + 3,
												LineHeight() - 6,
												LineHeight() - 6);
					renderer.Draw(Items[i].Image, r, Color.White);
				}

				if (Items[i].Items != null && Items[i].Items.Count > 0)
				{
					renderer.Draw(Manager.Skin.Images["Shared.ArrowRight"].Resource, rect.Left + LineWidth() - 4, rect.Top + l1.ContentMargins.Top + (i * vsize) + 8, col);
				}
			}
		}
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:91,代码来源:ContextMenu.cs

示例3: DrawControl

        /// <summary>
        /// Draws the main menu.
        /// </summary>
        /// <param name="renderer">Render management object.</param>
        /// <param name="rect">Destination region where the menu will be drawn.</param>
        /// <param name="gameTime">Snapshot of the application's timing values.</param>
        protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
        {
            SkinLayer l1 = Skin.Layers["Control"];
            SkinLayer l2 = Skin.Layers["Selection"];
            rs = new Rectangle[Items.Count];

            // Draw the menu background.
            renderer.DrawLayer(this, l1, rect, ControlState.Enabled);

            int prev = l1.ContentMargins.Left;

            // Draw all menu entries.
            for (int i = 0; i < Items.Count; i++)
            {
                MenuItem mi = Items[i];

                int tw = (int)l1.Text.Font.Resource.MeasureString(mi.Text).X + l1.ContentMargins.Horizontal;
                rs[i] = new Rectangle(rect.Left + prev, rect.Top + l1.ContentMargins.Top, tw, Height - l1.ContentMargins.Vertical);
                prev += tw;

                // Is not the selected entry?
                if (ItemIndex != i)
                {
                    // Draw in the enabled state?
                    if (mi.Enabled && Enabled)
                    {
                        renderer.DrawString(this, l1, mi.Text, rs[i], ControlState.Enabled, false);
                    }

                    // Draw in the disabled state?
                    else
                    {
                        renderer.DrawString(this, l1, mi.Text, rs[i], ControlState.Disabled, false);
                    }
                }

                // Selected menu entry to draw.
                else
                {
                    // Draw enabled state with selection?
                    if (Items[i].Enabled && Enabled)
                    {
                        renderer.DrawLayer(this, l2, rs[i], ControlState.Enabled);
                        renderer.DrawString(this, l2, mi.Text, rs[i], ControlState.Enabled, false);
                    }

                    // Draw disabled state with selection.
                    else
                    {
                        renderer.DrawLayer(this, l2, rs[i], ControlState.Disabled);
                        renderer.DrawString(this, l2, mi.Text, rs[i], ControlState.Disabled, false);
                    }
                }
            }
        }
开发者ID:Rfvgyhn,项目名称:Neoforce,代码行数:61,代码来源:MainMenu.cs

示例4: DrawControl

        /// <summary>
        /// Draws the window and all child controls.
        /// </summary>
        /// <param name="renderer">Render management object.</param>
        /// <param name="rect">Destination region where the window will be drawn.</param>
        /// <param name="gameTime">Snapshot of the application's timing values.</param>
        protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
        {
            SkinLayer l1 = captionVisible ? Skin.Layers[lrCaption] : Skin.Layers[lrFrameTop];
            SkinLayer l2 = Skin.Layers[lrFrameLeft];
            SkinLayer l3 = Skin.Layers[lrFrameRight];
            SkinLayer l4 = Skin.Layers[lrFrameBottom];
            SkinLayer l5 = Skin.Layers[lrIcon];
            LayerStates s1, s2, s3, s4;
            SpriteFont f1 = l1.Text.Font.Resource;
            Color c1 = l1.Text.Colors.Enabled;

            // Window has focus?
            if ((Focused || (Manager.FocusedControl != null && Manager.FocusedControl.Root == this.Root)) && ControlState != ControlState.Disabled)
            {
                s1 = l1.States.Focused;
                s2 = l2.States.Focused;
                s3 = l3.States.Focused;
                s4 = l4.States.Focused;
                c1 = l1.Text.Colors.Focused;
            }

            // Window is disabled?
            else if (ControlState == ControlState.Disabled)
            {
                s1 = l1.States.Disabled;
                s2 = l2.States.Disabled;
                s3 = l3.States.Disabled;
                s4 = l4.States.Disabled;
                c1 = l1.Text.Colors.Disabled;
            }

            // Window not active or child control has focus?
            else
            {
                s1 = l1.States.Enabled;
                s2 = l2.States.Enabled;
                s3 = l3.States.Enabled;
                s4 = l4.States.Enabled;
                c1 = l1.Text.Colors.Enabled;
            }

            // Draw the window layer.
            renderer.DrawLayer(Skin.Layers[lrWindow], rect, Skin.Layers[lrWindow].States.Enabled.Color, Skin.Layers[lrWindow].States.Enabled.Index);

            // Need to draw the window border?
            if (borderVisible)
            {
                // Draw caption layer or top frame layer, then draw the left, right, and bottom frame layers.
                renderer.DrawLayer(l1, new Rectangle(rect.Left, rect.Top, rect.Width, l1.Height), s1.Color, s1.Index);
                renderer.DrawLayer(l2, new Rectangle(rect.Left, rect.Top + l1.Height, l2.Width, rect.Height - l1.Height - l4.Height), s2.Color, s2.Index);
                renderer.DrawLayer(l3, new Rectangle(rect.Right - l3.Width, rect.Top + l1.Height, l3.Width, rect.Height - l1.Height - l4.Height), s3.Color, s3.Index);
                renderer.DrawLayer(l4, new Rectangle(rect.Left, rect.Bottom - l4.Height, rect.Width, l4.Height), s4.Color, s4.Index);

                // Draw the window icon if there is one and the window caption is displayed.
                if (iconVisible && (icon != null || l5 != null) && captionVisible)
                {
                    Texture2D i = (icon != null) ? icon : l5.Image.Resource;
                    renderer.Draw(i, GetIconRect(), Color.White);
                }

                int icosize = 0;
                if (l5 != null && iconVisible && captionVisible)
                {
                    icosize = l1.Height - l1.ContentMargins.Vertical + 4 + l5.OffsetX;
                }

                // Draw the close button if visible.
                int closesize = 0;
                if (btnClose.Visible)
                {
                    closesize = btnClose.Width - (btnClose.Skin.Layers[lrButton].OffsetX);
                }

                // Create the rectangle defining the remaining caption area to draw text in.
                Rectangle r = new Rectangle(rect.Left + l1.ContentMargins.Left + icosize,
                                            rect.Top + l1.ContentMargins.Top,
                                            rect.Width - l1.ContentMargins.Horizontal - closesize - icosize,
                                            l1.Height - l1.ContentMargins.Top - l1.ContentMargins.Bottom);
                int ox = l1.Text.OffsetX;
                int oy = l1.Text.OffsetY;

                // Draw the window title in the caption area remaining.
                renderer.DrawString(f1, Text, r, c1, l1.Text.Alignment, ox, oy, true);
            }
        }
开发者ID:Rfvgyhn,项目名称:Neoforce,代码行数:91,代码来源:Window.cs

示例5: DrawControl

        ////////////////////////////////////////////////////////////////////////////
        protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
        {
            if (Left + Width > 1600)
                Left = 1600 - Width;

            if (Top + Height + 40 > 850)
                Top = 850 - Height - 20;

            rect.Width = Math.Max(rect.Width, rLine.Width + 20);
            renderer.DrawLayer(this, Skin.Layers[0], rect);
            
            if (lines != null)
            {
                int y = 5;

                foreach (LineInfo line in lines)
                {
                    // prepare bounding rect
                    rLine.X = rect.X + 5;
                    rLine.Y = rect.Y + y;
                    rLine.Height = line.LineHeight;

                    renderer.DrawString(this, Skin.Layers[0], line.StrippedText, rLine, true);

                    foreach (IconPosition icon in line.Icons)
                        renderer.Draw(_iconDict[icon.IconName], icon.Rect, Color.White);

                    foreach (LinkPosition link in line.Links)
                        renderer.DrawString(Skin.Layers[0].Text.Font.Resource, link.Link, link.Rect.X + 2, link.Rect.Y + y - 3, Color.DarkRed);

                    y += line.LineHeight;
                }
            }
        }
开发者ID:mrommel,项目名称:MiRo.SimHexWorld,代码行数:35,代码来源:EnhancedToolTip.cs

示例6: DrawControl

        /// <summary>
        /// Draws the button control.
        /// </summary>
        /// <param name="renderer">Rendering management object.</param>
        /// <param name="rect">Destination rectangle.</param>
        /// <param name="gameTime">Snapshot of the application's timing values.</param>
        protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
        {
            // Toggle button in pressed state?
            if (mode == ButtonMode.PushButton && pushed)
            {
                SkinLayer l = Skin.Layers[lrButton];
                renderer.DrawLayer(l, rect, l.States.Pressed.Color, l.States.Pressed.Index);

                // Does the layer's pressed state have an overlay?
                if (l.States.Pressed.Overlay)
                {
                    // Draw the overlay on top of the button.
                    renderer.DrawLayer(l, rect, l.Overlays.Pressed.Color, l.Overlays.Pressed.Index);
                }
            }

            else
            {
                // Standard button. ButtonBase can handle drawing.
                base.DrawControl(renderer, rect, gameTime);
            }

            SkinLayer layer = Skin.Layers[lrButton];
            SpriteFont font = (layer.Text != null && layer.Text.Font != null) ? layer.Text.Font.Resource : null;
            Color col = Color.White;
            int ox = 0; int oy = 0;

            // Standard button pressed?
            if (ControlState == ControlState.Pressed)
            {
                if (layer.Text != null) col = layer.Text.Colors.Pressed;
                ox = 1; oy = 1;
            }

            // Button has an image to apply?
            if (glyph != null)
            {
                // Draw the button image.
                Margins cont = layer.ContentMargins;
                Rectangle r = new Rectangle(rect.Left + cont.Left,
                                            rect.Top + cont.Top,
                                            rect.Width - cont.Horizontal,
                                            rect.Height - cont.Vertical);
                renderer.DrawGlyph(glyph, r);
            }

            else
            {
                // Draw the button text.
                renderer.DrawString(this, layer, Text, rect, true, ox, oy);
            }
        }
开发者ID:Rfvgyhn,项目名称:Neoforce,代码行数:58,代码来源:Button.cs

示例7: Render

    ////////////////////////////////////////////////////////////////////////////
    
    ////////////////////////////////////////////////////////////////////////////
    internal override void Render(Renderer renderer, GameTime gameTime)
    {      
      if (Visible && Shadow)
      {        
        SkinControl c = Manager.Skin.Controls[skShadow];
        SkinLayer l = c.Layers[lrShadow];

        Color cl = Color.FromNonPremultiplied(l.States.Enabled.Color.R, l.States.Enabled.Color.G, l.States.Enabled.Color.B, Alpha);

        renderer.Begin(BlendingMode.Default);
        renderer.DrawLayer(l, new Rectangle(Left - c.OriginMargins.Left, Top - c.OriginMargins.Top, Width + c.OriginMargins.Horizontal, Height + c.OriginMargins.Vertical), cl, 0);
        renderer.End();
      }
      base.Render(renderer, gameTime);
    }
开发者ID:Kammikazy,项目名称:Neoforce-Mono,代码行数:18,代码来源:Window.cs

示例8: DrawControl

    ////////////////////////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////////////////////   
    protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
    {
      RecalcParams();
      
      SkinLayer p = Skin.Layers["Control"];
      SkinLayer l = Skin.Layers["Scale"];            
      
      float ratio = 0.66f;
      int h = (int)(ratio * rect.Height);
      int t = rect.Top + (Height - h) / 2;      
            
      float px = ((float)value / (float)range);
      int w = (int)Math.Ceiling(px * (rect.Width - p.ContentMargins.Horizontal - btnSlider.Width)) + 2;
            
      if (w < l.SizingMargins.Vertical) w = l.SizingMargins.Vertical;
      if (w > rect.Width - p.ContentMargins.Horizontal) w = rect.Width - p.ContentMargins.Horizontal;
      
      Rectangle r1 = new Rectangle(rect.Left + p.ContentMargins.Left, t + p.ContentMargins.Top, w, h - p.ContentMargins.Vertical);
            
      base.DrawControl(renderer, new Rectangle(rect.Left, t, rect.Width, h), gameTime);      
      if (scale) renderer.DrawLayer(this, l, r1);      
    }
开发者ID:Kammikazy,项目名称:Neoforce-Mono,代码行数:25,代码来源:TrackBar.cs

示例9: DrawControl

        /// <summary>
        /// Draws the checkbox control.
        /// </summary>
        /// <param name="renderer">Render management object.</param>
        /// <param name="rect">Destination rectangle.</param>
        /// <param name="gameTime">Snapshot of the application's timing values.</param>
        protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
        {
            // Grab the checked skin layer and skin font.
            SkinLayer layer = Skin.Layers[lrChecked];
            SkinText font = Skin.Layers[lrChecked].Text;

            // Umm. See if we actually need the unchecked layer and font...
            if (!state)
            {
                layer = Skin.Layers[lrCheckBox];
                font = Skin.Layers[lrCheckBox].Text;
            }

            rect.Width = layer.Width;
            rect.Height = layer.Height;
            Rectangle rc = new Rectangle(rect.Left + rect.Width + 4, rect.Y, Width - (layer.Width + 4), rect.Height);

            renderer.DrawLayer(this, layer, rect);
            renderer.DrawString(this, layer, Text, rc, false, 0, 0);
        }
开发者ID:Rfvgyhn,项目名称:Neoforce,代码行数:26,代码来源:CheckBox.cs

示例10: DrawControl

		////////////////////////////////////////////////////////////////////////////                          

		////////////////////////////////////////////////////////////////////////////
		protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
		{
			CheckLayer(Skin, "Control");
			CheckLayer(Skin, "Scale");

			base.DrawControl(renderer, rect, gameTime);

			if (Value > 0 || mode == ProgressBarMode.Infinite)
			{
				SkinLayer p = Skin.Layers["Control"];
				SkinLayer l = Skin.Layers["Scale"];
				Rectangle r = new Rectangle(rect.Left + p.ContentMargins.Left,
											rect.Top + p.ContentMargins.Top,
											rect.Width - p.ContentMargins.Vertical,
											rect.Height - p.ContentMargins.Horizontal);

				float perc = ((float)value / range) * 100;
				int w = (int)((perc / 100) * r.Width);
				Rectangle rx;
				if (mode == ProgressBarMode.Default)
				{
					if (w < l.SizingMargins.Vertical) w = l.SizingMargins.Vertical;
					rx = new Rectangle(r.Left, r.Top, w, r.Height);
				}
				else
				{
					int s = r.Left + w;
					if (s > r.Left + p.ContentMargins.Left + r.Width - (r.Width / 4)) s = r.Left + p.ContentMargins.Left + r.Width - (r.Width / 4);
					rx = new Rectangle(s, r.Top, (r.Width / 4), r.Height);
				}

				renderer.DrawLayer(this, l, rx);
			}
		}
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:37,代码来源:ProgressBar.cs

示例11: DrawControl

 ////////////////////////////////////////////////////////////////////////////       
        
 ////////////////////////////////////////////////////////////////////////////   
 protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
 {      
   RecalcParams();                        
  
   SkinLayer bg = Skin.Layers[strRail];      
   renderer.DrawLayer(bg, rect, Color.White, bg.States.Enabled.Index);
 }
开发者ID:VivekRajagopal,项目名称:Neoforce-Mono,代码行数:10,代码来源:ScrollBar.cs

示例12: DrawControl

 ////////////////////////////////////////////////////////////////////////////                          
 
 ////////////////////////////////////////////////////////////////////////////
 protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
 {                      
   renderer.DrawLayer(this, Skin.Layers[0], rect);
   renderer.DrawString(this, Skin.Layers[0], Text, rect, true);
 }
开发者ID:Kammikazy,项目名称:Neoforce-Mono,代码行数:8,代码来源:ToolTip.cs

示例13: DrawControl

        /// <summary>
        /// Draws the tab control.
        /// </summary>
        /// <param name="renderer">Render management object.</param>
        /// <param name="rect">Destination region where the tab control will be drawn.</param>
        /// <param name="gameTime">Snapshot of the application's timing values.</param>
        protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
        {
            SkinLayer l1 = Skin.Layers["Control"];
            SkinLayer l2 = Skin.Layers["Header"];
            Color col = this.Color != UndefinedColor ? this.Color : Color.White;

            Rectangle r1 = new Rectangle(rect.Left, rect.Top + l1.OffsetY, rect.Width, rect.Height - l1.OffsetY);

            if (tabPages.Count <= 0)
            {
                r1 = rect;
            }

            base.DrawControl(renderer, r1, gameTime);

            // Has tab pages to draw?
            if (tabPages.Count > 0)
            {
                Rectangle prev = new Rectangle(rect.Left, rect.Top + l2.OffsetY, 0, l2.Height);

                for (int i = 0; i < tabPages.Count; i++)
                {
                    SpriteFont font = l2.Text.Font.Resource;
                    Margins margins = l2.ContentMargins;
                    Point offset = new Point(l2.OffsetX, l2.OffsetY);
                    if (i > 0) prev = tabPages[i - 1].HeaderRect;

                    // Create the header region rectangle for each tab page.
                    tabPages[i].CalcRect(prev, font, margins, offset, i == 0);
                }

                for (int i = tabPages.Count - 1; i >= 0; i--)
                {
                    // Get the layer color and index for the current tab page.
                    int li = tabPages[i].Enabled ? l2.States.Enabled.Index : l2.States.Disabled.Index;
                    Color lc = tabPages[i].Enabled ? l2.Text.Colors.Enabled : l2.Text.Colors.Disabled;

                    // Is the current tab page header hovered?
                    if (i == hoveredIndex)
                    {
                        // Update index and color values.
                        li = l2.States.Hovered.Index;
                        lc = l2.Text.Colors.Hovered;
                    }

                    // Calculate the region where text is displayed in the header, respecting content margin values.
                    Margins m = l2.ContentMargins;
                    Rectangle rx = tabPages[i].HeaderRect;
                    Rectangle sx = new Rectangle(rx.Left + m.Left, rx.Top + m.Top, rx.Width - m.Horizontal, rx.Height - m.Vertical);

                    // Draw the header for the unselected tab pages.
                    if (i != selectedIndex)
                    {
                        renderer.DrawLayer(l2, rx, col, li);
                        renderer.DrawString(l2.Text.Font.Resource, tabPages[i].Text, sx, lc, l2.Text.Alignment);
                    }
                }

                // Calculate the region where text is displayed in the header, respecting content margin values.
                Margins mi = l2.ContentMargins;
                Rectangle ri = tabPages[selectedIndex].HeaderRect;
                Rectangle si = new Rectangle(ri.Left + mi.Left, ri.Top + mi.Top, ri.Width - mi.Horizontal, ri.Height - mi.Vertical);

                // Draw the header for the selected tab page.
                renderer.DrawLayer(l2, ri, col, l2.States.Focused.Index);
                renderer.DrawString(l2.Text.Font.Resource, tabPages[selectedIndex].Text, si, l2.Text.Colors.Focused, l2.Text.Alignment, l2.Text.OffsetX, l2.Text.OffsetY, false);
            }
        }
开发者ID:Rfvgyhn,项目名称:Neoforce,代码行数:74,代码来源:TabControl.cs

示例14: DrawControl

        /// <summary>
        /// Draws the track bar control.
        /// </summary>
        /// <param name="renderer">Render management object.</param>
        /// <param name="rect">Destination region where the control will be drawn.</param>
        /// <param name="gameTime">Snapshot of the application's timing values.</param>
        protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
        {
            RecalcParams();

            SkinLayer p = Skin.Layers["Control"];
            SkinLayer l = Skin.Layers["Scale"];

            // Scales down the height of the track bar to allow room for the scale to be drawn.
            float ratio = 0.66f;
            int h = (int)(ratio * rect.Height);
            int t = rect.Top + (Height - h) / 2;

            float px = ((float)value / (float)range);
            int w = (int)Math.Ceiling(px * (rect.Width - p.ContentMargins.Horizontal - btnSlider.Width)) + 2;

            // NOTE: Should this be using horizontal sizing margins?
            if (w < l.SizingMargins.Vertical)
            {
                w = l.SizingMargins.Vertical;
            }

            if (w > rect.Width - p.ContentMargins.Horizontal)
            {
                w = rect.Width - p.ContentMargins.Horizontal;
            }

            // Create the region for the track bar scale.
            Rectangle r1 = new Rectangle(rect.Left + p.ContentMargins.Left, t + p.ContentMargins.Top, w, h - p.ContentMargins.Vertical);
            base.DrawControl(renderer, new Rectangle(rect.Left, t, rect.Width, h), gameTime);

            if (scale)
            {
                renderer.DrawLayer(this, l, r1);
            }
        }
开发者ID:Rfvgyhn,项目名称:Neoforce,代码行数:41,代码来源:TrackBar.cs

示例15: DrawControl

    ////////////////////////////////////////////////////////////////////////////

    ////////////////////////////////////////////////////////////////////////////
    protected override void DrawControl(Renderer renderer, Rectangle rect, GameTime gameTime)
    {      
      SkinLayer l = Skin.Layers[0];

      // We render background of the tooltip
      renderer.DrawLayer(this, l, rect);           
            
      Rectangle rc1 = Rectangle.Empty;
      if (image != null)
      {        
        // Now we draw image in the left top corner of the tooltip
        rc1 = new Rectangle(l.ContentMargins.Left, l.ContentMargins.Top + 4, IconSize, IconSize);
        renderer.Draw(image, rc1, Color.White);
      }
      
      // Text is rendered next to the image
      rect = new Rectangle(rc1.Right, rect.Top + 4, rect.Width, rect.Height);           
      
      // We alter text alignment from the default skin
      l.Text.Alignment = Alignment.TopLeft;
      renderer.DrawString(this, l, Text, rect, true);
    }
开发者ID:brunoduartec,项目名称:port-ploobsengine,代码行数:25,代码来源:CustomToolTip.cs


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