예제 #1
0
        ///////////////////////////////////////////////////////////////////////////////
        // Inherited methods                                                         //
        ///////////////////////////////////////////////////////////////////////////////
        #region OVERRIDES

        /// <summary>
        /// Overridden <see cref="VGElement.Draw(Graphics)"/>.
        /// Draws text with the owning brush and font onto given
        /// graphics context.
        /// </summary>
        /// <param name="graphics">Graphics context to draw on.</param>
        /// <exception cref="ArgumentNullException">Thrown, when graphics object is null.</exception>
        public override void Draw(Graphics graphics)
        {
            if (graphics == null)
            {
                throw new ArgumentNullException("Graphics object should not be null.");
            }

            RectangleF innerBounds = this.DrawFillAndEdge(graphics);

            if (this.currentTransform != graphics.Transform)
            {
                this.currentTransform = graphics.Transform;
                if (this.flashControl != null)
                {
                    Rectangle newBounds = GetTransformedBounds(this.currentTransform, innerBounds);
                    if (this.flashControl.InvokeRequired)
                    {
                        SetBoundsDelegate setBoundsMethod = new SetBoundsDelegate(this.flashControl.SetBounds);
                        this.flashControl.Invoke(setBoundsMethod, newBounds.X, newBounds.Y, newBounds.Width, newBounds.Height);
                    }
                    else
                    {
                        this.flashControl.Bounds = newBounds;
                    }
                }
            }

            this.DrawFlashObject(graphics, innerBounds);

            // Draw name and selection frame if applicable
            base.Draw(graphics);
        }
예제 #2
0
        public void RegisterInterface(IUpdate iUpdate)
        {
            BeginPaint    = new BeginPaintDelegate(iUpdate.BeginPaint);
            EndPaint      = new EndPaintDelegate(iUpdate.EndPaint);
            SetBounds     = new SetBoundsDelegate(iUpdate.SetBounds);
            Synchronize   = new SynchronizeDelegate(iUpdate.Synchronize);
            DesktopResize = new DesktopResizeDelegate(iUpdate.DesktopResize);
            BitmapUpdate  = new BitmapUpdateDelegate(iUpdate.BitmapUpdate);
            Palette       = new PaletteDelegate(iUpdate.Palette);
            PlaySound     = new PlaySoundDelegate(iUpdate.PlaySound);
            SurfaceBits   = new SurfaceBitsDelegate(iUpdate.SurfaceBits);

            update->BeginPaint    = Marshal.GetFunctionPointerForDelegate(BeginPaint);
            update->EndPaint      = Marshal.GetFunctionPointerForDelegate(EndPaint);
            update->SetBounds     = Marshal.GetFunctionPointerForDelegate(SetBounds);
            update->Synchronize   = Marshal.GetFunctionPointerForDelegate(Synchronize);
            update->DesktopResize = Marshal.GetFunctionPointerForDelegate(DesktopResize);
            update->BitmapUpdate  = Marshal.GetFunctionPointerForDelegate(BitmapUpdate);
            update->Palette       = Marshal.GetFunctionPointerForDelegate(Palette);
            update->PlaySound     = Marshal.GetFunctionPointerForDelegate(PlaySound);
            update->SurfaceBits   = Marshal.GetFunctionPointerForDelegate(SurfaceBits);
        }
예제 #3
0
        public void RegisterInterface(IUpdate iUpdate)
        {
            BeginPaint = new BeginPaintDelegate(iUpdate.BeginPaint);
            EndPaint = new EndPaintDelegate(iUpdate.EndPaint);
            SetBounds = new SetBoundsDelegate(iUpdate.SetBounds);
            Synchronize = new SynchronizeDelegate(iUpdate.Synchronize);
            DesktopResize = new DesktopResizeDelegate(iUpdate.DesktopResize);
            BitmapUpdate = new BitmapUpdateDelegate(iUpdate.BitmapUpdate);
            Palette = new PaletteDelegate(iUpdate.Palette);
            PlaySound = new PlaySoundDelegate(iUpdate.PlaySound);
            SurfaceBits = new SurfaceBitsDelegate(iUpdate.SurfaceBits);

            update->BeginPaint = Marshal.GetFunctionPointerForDelegate(BeginPaint);
            update->EndPaint = Marshal.GetFunctionPointerForDelegate(EndPaint);
            update->SetBounds = Marshal.GetFunctionPointerForDelegate(SetBounds);
            update->Synchronize = Marshal.GetFunctionPointerForDelegate(Synchronize);
            update->DesktopResize = Marshal.GetFunctionPointerForDelegate(DesktopResize);
            update->BitmapUpdate = Marshal.GetFunctionPointerForDelegate(BitmapUpdate);
            update->Palette = Marshal.GetFunctionPointerForDelegate(Palette);
            update->PlaySound = Marshal.GetFunctionPointerForDelegate(PlaySound);
            update->SurfaceBits = Marshal.GetFunctionPointerForDelegate(SurfaceBits);
        }
예제 #4
0
파일: VGFlash.cs 프로젝트: DeSciL/Ogama
    ///////////////////////////////////////////////////////////////////////////////
    // Inherited methods                                                         //
    ///////////////////////////////////////////////////////////////////////////////
    #region OVERRIDES

    /// <summary>
    /// Overridden <see cref="VGElement.Draw(Graphics)"/>.  
    /// Draws text with the owning brush and font onto given 
    /// graphics context.
    /// </summary>
    /// <param name="graphics">Graphics context to draw on.</param>
    /// <exception cref="ArgumentNullException">Thrown, when graphics object is null.</exception>
    public override void Draw(Graphics graphics)
    {
      if (graphics == null)
      {
        throw new ArgumentNullException("Graphics object should not be null.");
      }

      RectangleF innerBounds = this.DrawFillAndEdge(graphics);

      if (this.currentTransform != graphics.Transform)
      {
        this.currentTransform = graphics.Transform;
        if (this.flashControl != null)
        {
          Rectangle newBounds = GetTransformedBounds(this.currentTransform, innerBounds);
          if (this.flashControl.InvokeRequired)
          {
            SetBoundsDelegate setBoundsMethod = new SetBoundsDelegate(this.flashControl.SetBounds);
            this.flashControl.Invoke(setBoundsMethod, newBounds.X, newBounds.Y, newBounds.Width, newBounds.Height);
          }
          else
          {
            this.flashControl.Bounds = newBounds;
          }
        }
      }

      this.DrawFlashObject(graphics, innerBounds);

      // Draw name and selection frame if applicable
      base.Draw(graphics);
    }