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


C# DrawState类代码示例

本文整理汇总了C#中DrawState的典型用法代码示例。如果您正苦于以下问题:C# DrawState类的具体用法?C# DrawState怎么用?C# DrawState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: DrawBackground

 protected void DrawBackground(Graphics g, DrawState state)
 {
     Rectangle rc = ClientRectangle;
     // Draw background
     if (state == DrawState.Normal || state == DrawState.Disable)
     {
         g.FillRectangle(new SolidBrush(SystemColors.Control), rc);
         using (SolidBrush rcBrush = state == DrawState.Disable ?
             new SolidBrush(SystemColors.ControlDark) :
             new SolidBrush(SystemColors.ControlDarkDark))
         {
             // Draw border rectangle
             g.DrawRectangle(new Pen(rcBrush), rc.Left, rc.Top, rc.Width - 1, rc.Height - 1);
         }
     }
     else if ( state == DrawState.Hot || state == DrawState.Pressed  )
     {
         // Erase whaterver that was there before
         if ( state == DrawState.Hot )
             g.FillRectangle(new SolidBrush(ColorUtil.VSNetSelectionColor), rc);
         else
             g.FillRectangle(new SolidBrush(ColorUtil.VSNetPressedColor), rc);
         // Draw border rectangle
         g.DrawRectangle(SystemPens.Highlight, rc.Left, rc.Top, rc.Width-1, rc.Height-1);
     }
 }
开发者ID:sillsdev,项目名称:CarlaLegacy,代码行数:26,代码来源:ButtonEx.cs

示例2: OnLostFocus

 protected override void OnLostFocus(EventArgs e)
 {
     // Set state to Normal
       base.OnLostFocus(e);
       drawState = DrawState.Normal;
       Invalidate();
 }
开发者ID:tiankongldp,项目名称:MyTestApplication,代码行数:7,代码来源:TextBoxEx.cs

示例3: DrawBackground

        protected void DrawBackground( Graphics g, DrawState state )
        {
            Rectangle rc = ClientRectangle;

              // Draw background
              if( state == DrawState.Normal || state == DrawState.Disable )
              {
            g.FillRectangle( SystemBrushes.Control, rc );

            Pen p = ( state == DrawState.Disable ) ? SystemPens.ControlDark : SystemPens.ControlDarkDark;

            // Draw border rectangle
            g.DrawRectangle( p, rc.Left, rc.Top, rc.Width-1, rc.Height-1);

              }
              else if( state == DrawState.Hot || state == DrawState.Pressed  )
              {
            // Erase whaterver that was there before
            if ( state == DrawState.Hot )
              g.FillRectangle( ColorUtil.VSNetSelectionBrush, rc );
            else
              g.FillRectangle( ColorUtil.VSNetPressedBrush, rc );

            // Draw border rectangle
            g.DrawRectangle( SystemPens.Highlight, rc.Left, rc.Top, rc.Width-1, rc.Height-1 );
              }
        }
开发者ID:tiankongldp,项目名称:MyTestApplication,代码行数:27,代码来源:ButtonEx.cs

示例4: Start

 void Start()
 {
     _drawStates = new DrawState[_pinchDetectors.Length];
       for (int i = 0; i < _pinchDetectors.Length; i++) {
     _drawStates[i] = new DrawState(this);
       }
 }
开发者ID:emomper23,项目名称:PsychVR,代码行数:7,代码来源:PinchDraw.cs

示例5: DrawImageEventArgs

 //=====================================================================
 /// <summary>Constructor</summary>
 /// <param name="graphics">The graphics context</param>
 /// <param name="state">The drawing state of the item</param>
 /// <param name="offset">The image offset if scrolled</param>
 /// <param name="drawFocus">A flag indicating whether or not to draw the focus rectangle on return</param>
 public DrawImageEventArgs(Graphics graphics, DrawState state, Point offset, bool drawFocus)
 {
     this.Graphics = graphics;
     this.DrawState = state;
     this.ImageOffset = offset;
     this.DrawFocus = drawFocus;
 }
开发者ID:exaphaser,项目名称:ImageMaps,代码行数:13,代码来源:DrawImageEventArgs.cs

示例6: ChangeDrawState

        public void ChangeDrawState(DrawState drawState, int id)
        {
            //選択できる範囲外だったら何もせずに終了
            if (!CanChangeDrawState(drawState, id)) return;

            switch (drawState)
            {
                case DrawState.MapChip:
                    MapChipPalletViewModel.DrawMapState.Set(id);
                    ObjectChipPalletViewModel.SelectCancel();
                    _current = MapChipPalletViewModel;
                    break;

                case DrawState.ObjChip:
                    ObjectChipPalletViewModel.DrawObjectState.Set(id);
                    MapChipPalletViewModel.SelectCancel();
                    _current = ObjectChipPalletViewModel;
                    break;

                case DrawState.Empty:
                    //何もしない
                    break;
                default:
                    throw new ArgumentOutOfRangeException("drawState");
            }
        }
开发者ID:lltcggie,项目名称:StageMapEditor,代码行数:26,代码来源:PalletViewModelManager.cs

示例7: OnMouseEnter

 protected override void OnMouseEnter(EventArgs e)
 {
     // Set state to hot
       base.OnMouseEnter(e);
       drawState = DrawState.Hot;
       Invalidate();
 }
开发者ID:tiankongldp,项目名称:MyTestApplication,代码行数:7,代码来源:RadioButtonEx.cs

示例8: BindShader

		protected override IShader BindShader(DrawState state, bool maskOnly)
		{
			Xen.Ex.Graphics2D.Statistics.DrawGraphLine shader = state.GetShader<Xen.Ex.Graphics2D.Statistics.DrawGraphLine>();

			if (dirty)
			{
				float x = widthScale;
				for (int i = 0; i < graphData.Length; i++)
				{
					int index = (i + this.index) % graphData.Length;
					float good = 0;

					if (goodValue != 0)
					{
						good = values[index];
						good = (good - Math.Abs(goodValue)) / goodValue;
					}
					graphData[i] = new Vector4(x, values[index] * maxValueInv, 0, good);
					x += widthScale;
				}
				dirty = false;
			}

			shader.GraphLine = this.graphData;

			return shader;
		}
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:27,代码来源:Stats.cs

示例9: OnGotFocus

 protected override void OnGotFocus(EventArgs e)
 {
     // Set state to Hot
       base.OnGotFocus(e);
       drawState = DrawState.Hot;
       Invalidate();
 }
开发者ID:tiankongldp,项目名称:MyTestApplication,代码行数:7,代码来源:TextBoxEx.cs

示例10: Begin

		/// <summary>
		/// Begin the modifier (This method is called by the DrawTarget)
		/// </summary>
		/// <param name="state"></param>
		public void Begin(DrawState state)
		{
			enabledBuffer = enabled;
			this.cameras = state.Camera;

			if (enabledBuffer)
				state.Cullers.PushPostCuller(this);
		}
开发者ID:shadarath,项目名称:Wirtualna-rzeczywistosc,代码行数:12,代码来源:CullTestVisualizer.cs

示例11: MatrixCalc

 public MatrixCalc(MatrixOp op, MatrixSource provider, MatrixSource source, DrawState state)
 {
     #if DEBUG
     this.state = state;
     #endif
     this.op = op;
     this.provider = provider;
     this.source = source;
 }
开发者ID:TormentedEmu,项目名称:OpenUO,代码行数:9,代码来源:MatrixCalc.cs

示例12: DrawButtonState

        protected void DrawButtonState(Graphics g, DrawState state)
        {
            DrawBackground(g, state);
            Rectangle rc = ClientRectangle;

            bool hasText = false;
            bool hasImage = Image != null;
            Size textSize = new Size(0,0);
            if ( Text != string.Empty && Text != "" )
            {
                hasText = true;
                textSize = TextUtil.GetTextSize(g, Text, Font);
            }

            int imageWidth = 0;
            int imageHeight = 0;
            if ( hasImage )
            {
                SizeF sizeF = Image.PhysicalDimension;
                imageWidth = (int)sizeF.Width;
                imageHeight = (int)sizeF.Height;
                // We are assuming that the button image is smaller than
                // the button itself
                if ( imageWidth > rc.Width || imageHeight > rc.Height)
                {
                    Debug.WriteLine("Image dimensions need to be smaller that button's dimension...");
                    return;
                }
            }

            int x, y;
            if ( hasText && !hasImage )
            {
                // Text only drawing
                x = (Width - textSize.Width)/2;
                y = (Height - textSize.Height)/2;
                DrawText(g, Text, state, x, y);
            }
            else if ( hasImage && !hasText )
            {
                // Image only drawing
                x = (Width - imageWidth)/2;
                y = (Height - imageHeight)/2;
                DrawImage(g, state, Image, x, y);
            }
            else
            {
                // Text and Image drawing
                x = (Width - textSize.Width - imageWidth -2)/2;
                y = (Height - imageHeight)/2;
                DrawImage(g, state, Image, x, y);
                x += imageWidth + 2;
                y = (Height - textSize.Height)/2;
                DrawText(g, Text, state, x, y);
            }
        }
开发者ID:sillsdev,项目名称:CarlaLegacy,代码行数:56,代码来源:ButtonEx.cs

示例13: OnMouseLeave

 protected override void OnMouseLeave(EventArgs e)
 {
   // Set state to Normal
   base.OnMouseLeave(e);
   if ( !ContainsFocus )
   {
     drawState = DrawState.Normal;
     Invalidate();
   }
 }
开发者ID:ewosp,项目名称:sycorax,代码行数:10,代码来源:CheckBoxEx.cs

示例14: DrawButtonState

        protected void DrawButtonState( Graphics g, DrawState state )
        {
            DrawBackground( g, state );
              Rectangle rc = ClientRectangle;
              Rectangle rcText = Rectangle.Inflate( ClientRectangle, -1, -1 );

              // draw Image
              if( Image != null )
              {
            SizeF sizeF   = Image.PhysicalDimension;
            int imgWidth  = (int)sizeF.Width;
            int imgHeight = (int)sizeF.Height;

            StringAlignment imgVAlign = GetVerticalAlign( ImageAlign );
            StringAlignment imgHAlign = GetHorizontalAlign( ImageAlign );

            int minWid = Width - 2, minHg = Height - 2;

            minWid = Math.Min( minWid, imgWidth );
            minHg = Math.Min( minHg, imgHeight );

            int xPos = Math.Min( minHg, minWid ) + 2;

            Bitmap bmp = new Bitmap( Image, new Size( minWid, minHg ) );

            int y = 1;

            if( imgVAlign == StringAlignment.Center )
            {
              y = ( Height - bmp.Height ) / 2;
            }
            else if( imgVAlign == StringAlignment.Far )
            {
              y = ( Height - bmp.Height - 1 );
            }

            switch( imgHAlign )
            {
              case StringAlignment.Near:
            rcText.X = xPos;  rcText.Width -= xPos;
            DrawImage( g, state, bmp, 2+(xPos-minWid)/2, y );
            break;

              case StringAlignment.Far:
            rcText.Width = rcText.Right - xPos;
            DrawImage( g, state, bmp, rcText.Right + (xPos-minWid)/2 - 2, y );
            break;
            }

            bmp.Dispose();
              }

              // draw Text
              DrawText( g, Text, state, rcText );
        }
开发者ID:tiankongldp,项目名称:MyTestApplication,代码行数:55,代码来源:ButtonEx.cs

示例15: Draw

        public override void Draw(IOutputCommand output, DrawState state, object param)
		{
            double I, J;
            if (!TryGetVariable('I', out I))
            {
                I = 0;
            }
            if (!TryGetVariable('J', out J))
            {
                J = 0;
            }

            output.DrawArc(this,param, Convert(Movetype, state), CalculatedStartPosition, CalculatedEndPosition,new Framework.Tools.Drawing.Point3D() { X=I, Y=J},true);
       }
开发者ID:aiten,项目名称:CNCLib,代码行数:14,代码来源:G02Command.cs


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