This class represents the information needed by graphics to paint when necessary.
示例#1
0
		public override void DrawSelf(DrawEvent de)
		{
            IGraphPort graphPort = de.GraphPort;

            graphPort.DrawGradientRectangle(fGradient);
            graphPort.DrawRectangle(fBorderPen, fBorder);
		}
示例#2
0
		// We override this one because we want to be able to draw the
		// background, raised or sunken, depending on our state
        public override void DrawBackground(DrawEvent devent)
		{
			if (Depressed && Tracking)
				GUIStyle.Default.DrawSunkenRect(devent.GraphPort, (int)Origin.x, (int)Origin.y, Frame.Width, Frame.Height);
			else
				GUIStyle.Default.DrawRaisedRect(devent.GraphPort, (int)Origin.x, (int)Origin.y, Frame.Width, Frame.Height);
		}
示例#3
0
    public void OnDraw(DrawEvent devent)
	{
        IGraphPort graphPort = devent.GraphPort;


		Kernel32.GetLocalTime(out fThisTime);

        fPen = Guid.NewGuid();
        fBrush = Guid.NewGuid();
        graphPort.CreateCosmeticPen(PenStyle.Dash, RGBColor.Black, fPen);
        graphPort.CreateBrush(GDI32.BS_SOLID, 0, RGBColor.Red, fBrush);
        
        //graphPort.DrawingColor = RGBColor.Red;
        graphPort.UseDefaultBrush();
        graphPort.UseDefaultPen();
        graphPort.SetDefaultPenColor(RGBColor.Black);
        graphPort.SetDefaultBrushColor(RGBColor.Red);

        DrawHour(graphPort);

        DrawMinutes(graphPort);

        DrawSeconds(graphPort);

        // Copy the current time to being the last time
        fLastTime.Hour = fThisTime.Hour;
        fLastTime.Minute = fThisTime.Minute;
        fLastTime.Second = fThisTime.Second;

        // Restore the world transform so drawing
        // is normal for whomever is next
        //graphPort.SetWorldTransform(oldTransform);
    }
示例#4
0
	public override void Draw(DrawEvent devent)
	{
		Point[] dstPoints=null;
		
		dstPoints = new Point[] {
			new Point(fLastFrame.Left, fLastFrame.Top),
			new Point(fLastFrame.Right,fLastFrame.Top),
			new Point(fLastFrame.Left, fLastFrame.Bottom)};

		// Draw the little piece of the destination bitmap to refresh where the graphis has been
		bitmapGraphics.DrawImage(DestinationPixelBuffer, dstPoints, fLastFrame, GraphicsUnit.Pixel);

		// Now draw the graphic in it's new position
        int left = fStartFrame.Left + (int)Math.Floor((fXDistance * CompletionPercentage)+0.5);
        int top = fStartFrame.Top + (int)Math.Floor((fYDistance * CompletionPercentage) + 0.5);

		fCurrentFrame = new Rectangle(left, top, fStartFrame.Width,fStartFrame.Height);
		bitmapGraphics.ScaleBitmap(SourcePixelBuffer, fCurrentFrame);


		Point [] srcPoints = new Point[] {
				new Point(fCurrentFrame.Left, fCurrentFrame.Top),
				new Point(fCurrentFrame.Right,fCurrentFrame.Top),
				new Point(fCurrentFrame.Left, fCurrentFrame.Bottom)};
		
		if (dstPoints!=null)
			GraphPort.DrawImage(bitmapBuffer, dstPoints, fLastFrame, GraphicsUnit.Pixel);
		
        GraphPort.DrawImage(bitmapBuffer, srcPoints, fCurrentFrame, GraphicsUnit.Pixel);

		fLastFrame = fCurrentFrame;
	}
示例#5
0
 public override void Draw(DrawEvent devent)
 {
     if (null != fShard)
     {
         fShard.Draw(devent);
     }
 }
示例#6
0
    public override void DrawSelf(DrawEvent devent)
	{
		//fGraphPort.Clear(Color.White);
		//fGraphPort.DrawImage(fProductWheel.Image, fProductWheel.Frame);
		//fGraphPort.DrawImage(fFeatureWheel.Image, fFeatureWheel.Frame);

		//graphPort.DrawImage(fBacking,new RectangleF(0,0,Width,Height));
	}
示例#7
0
        public override void OnPaint(DrawEvent dea)
        {
            base.OnPaint(dea);

            IGraphPort graphPort = dea.GraphPort;

            //Console.WriteLine("GUIStyleWindow.OnPaint");
        }
示例#8
0
 public override void OnPaint(DrawEvent devent)
 {
     if ((null != picture))
     {
         // Draw the original and modified image to the screen
         devent.GraphPort.PixBlt(picture, 0, 0);
         devent.GraphPort.PixBlt(copyBuffer, 0, picture.Height + 10);
     }
 }
示例#9
0
 public override void DrawSelf(DrawEvent devent)
 {
     if (null != Image)
     {
         if (!fUseOpacity)
             devent.GraphPort.PixBlt(Image, Origin.X, Origin.Y);
         else
             devent.GraphPort.PixBlt(Image, Origin.X, Origin.Y);
     }
 }
示例#10
0
        public override void OnPaint(DrawEvent devent)
        {
            if ((null != picture))
            {
                // If we have an image, just draw it to the screen
                devent.GraphPort.PixBlt(picture, 0, 0);


                devent.GraphPort.PixBlt(tPic, picture.Width + 20, 0);
            }
        }
示例#11
0
    public override void OnPaint(DrawEvent devent)
    {
        if (fHaveImage && (null != fScreenImage))
        {
            Rectangle cRect = ClientRectangle;

            // If we have an image, just draw it to the screen
            devent.GraphPort.AlphaBlend(0, 0, cRect.Width, cRect.Height, 
                fScreenImage, 0, 0, fScreenImage.Width, fScreenImage.Height, 255);
        }
    }
示例#12
0
        public override void OnPaint(DrawEvent pea)
        {
            // After all the children have done their drawing into our backing buffer
            // Display the backing buffer on the screen.
            int x = pea.ClipRect.Left;
            int y = pea.ClipRect.Top;
            int width = pea.ClipRect.Width;
            int height = pea.ClipRect.Height;

            // Render our image to the actual screen
            base.GraphPort.AlphaBlend(x, y, width, height, fBackingBuffer, x, y, width, height, 255);
        }
示例#13
0
        public override void DrawSelf(DrawEvent devent)
        {
            IGraphPort graphPort = devent.GraphPort;

			graphPort.SetTextColor(fTextColor);
            if (Colorref.TRANSPARENT == fBackColor) 
                graphPort.SetBkMode(Colorref.TRANSPARENT);
            else
                graphPort.SetBkColor(fBackColor);

            graphPort.SetFont(fFont);

            graphPort.DrawString((int)fStartPoint.x, (int)fStartPoint.y, fString);
        }
示例#14
0
        public virtual void OnInvalidateSurface(Guid aGuid, RECT aRect)
        {
            // Redraw the surface that needs drawing
            if (UISurface.gSurfaces.ContainsKey(aGuid))
            {
                UISurface aSurface = UISurface.gSurfaces[aGuid];
                DrawEvent devent = new DrawEvent(GraphPort, aRect);

                aSurface.Draw(devent);

                // Since these calls are typically driven
                // by actions on the surface, it might be 
                // necessary to send them to the metaspace.
            }
        }
	public override void Draw(DrawEvent devent)
	{
		// Calculate the srcPixelBuffer frame
		int srcMidX = SourcePixelBuffer.Width / 2;


		Rectangle srcRect = new Rectangle(srcMidX-Revealed/2,0,
			Revealed,SourcePixelBuffer.Height);
		Point[] srcDstPoints = new Point[] {
			new Point(fMidX-Revealed/2,Frame.Top),
			new Point(fMidX+Revealed/2,Frame.Top),
			new Point(fMidX-Revealed/2,Frame.Bottom)
		};

		GraphPort.DrawImage(SourcePixelBuffer, srcDstPoints,srcRect,GraphicsUnit.Pixel);
	}
示例#16
0
		public override void DrawBackground(DrawEvent devent)
		{
            IGraphPort graphPort = devent.GraphPort;
			//graphPort.FillRectangle(fBrush,Frame.Left, Frame.Top, Width, Height);
            graphPort.FillRectangle(fBrush, Frame);

            //PointF[] destPara = new PointF[] {
            //    new PointF(Origin.X, Origin.Y+0.10F),
            //    new PointF(Origin.X+Dimension.Width, Origin.Y+0.10F),
            //    new PointF(Origin.X, Origin.Y+Dimension.Height-0.30F)};
   
			System.Drawing.Rectangle f = new System.Drawing.Rectangle(Frame.Left,Frame.Top+10,Dimension.Width,Dimension.Height-30);
			graphPort.ScaleBitmap(fImage,f);
			
			// Draw a transparent gradient over the top
			//graphPort.DrawRectangle(new Pen(RGBColor.RGB(204, 204, 204), 0.5F /72), f);
		}
示例#17
0
		void DoFlyIn(ITPhaseControl control, int steps)
		{
			// Create a pixmap to represent the control to be animated
            GDIDIBSection srcPixelBuffer = new GDIDIBSection((int)(control.Frame.Width), (int)(control.Frame.Height));
            IGraphPort srcGraphics = srcPixelBuffer.GraphPort;
            srcPixelBuffer.DeviceContext.ClearToWhite();

            // Draw the control into its bitmap
            DrawEvent sde = new DrawEvent(srcGraphics, Frame);
            control.OnDraw(sde);
            srcGraphics.Flush();
            
            // Get the current image of what's being displayed
            GDIDIBSection dstPixelBuffer = this.BackingImage;
            IGraphPort dstGraphics = dstPixelBuffer.GraphPort;
            dstPixelBuffer.DeviceContext.ClearToWhite();

            DrawEvent dde = new DrawEvent(dstGraphics, Frame);
            this.Draw(dde);

			// At this point we have two bitmaps that hold the images of the 
			// background, and the graphic that will fly in.


			// Get a hold of our window's graphics port
            IGraphPort grfx = Window.ClientAreaGraphPort;
            
            // Draw the current destination image into the graphport
            grfx.PixBlt(dstPixelBuffer, 0, 0);


            Rectangle startFrame = new Rectangle(0, (int)(control.Frame.Top), (int)(control.Frame.Width), (int)(control.Frame.Height));
			//Rectangle startFrame = new Rectangle(0, 0, (int)(control.Frame.Width), (int)(control.Frame.Height));
			Rectangle endFrame = new Rectangle((control.Frame.Left), (control.Frame.Top), (control.Frame.Width), (control.Frame.Height));

            FlyIn transition = new FlyIn(startFrame, endFrame, steps);
            transition.SourcePixelBuffer = srcPixelBuffer;
            transition.DestinationPixelBuffer = dstPixelBuffer;

            transition.Run(grfx);
            //FlyAGraphic(grfx, srcPixelBuffer, startFrame, dstPixelBuffer, endFrame, steps);

			// Cleanup
			srcPixelBuffer.Dispose();
		}
示例#18
0
    public virtual void OnDraw(DrawEvent devent)
    {
        IGraphPort gPort = devent.GraphPort;

        DrawBackground(gPort);

        gPort.SaveState();

        // Set the view and window for proper scaling
        gPort.SetMappingMode(MappingModes.ISOTROPIC);
        gPort.SetWindowExtent(276, 72);
        gPort.SetViewportExtent(fFrame.Width, fFrame.Height);
        gPort.SetWindowOrigin(138, 36);
        gPort.SetViewportOrigin(fFrame.Width / 2, fFrame.Height / 2);

        fClockDisplay.Draw(new DrawEvent(gPort, fBounds));

        gPort.ResetState();

        //base.OnDraw(devent);
    }
示例#19
0
        // Drawable things
		public virtual void DrawChildren(DrawEvent devent)
		{
			foreach (IGraphic g in GraphicChildren)
			{
				devent.GraphPort.SaveState();

                // Make sure they don't draw outside their frame
                RectangleI f = g.Frame;
                f.Inflate(1, 1);
                devent.GraphPort.SetClipRectangle(f);		

                // Translate before we draw so all drawing within a child has
                // 0,0 in it's upper left corner	
                devent.GraphPort.TranslateTransform(g.Frame.Left, g.Frame.Top);

				g.Draw(devent);

				// Restore the state
                devent.GraphPort.ResetState();
			}
		}
示例#20
0
    public override void OnPaint(DrawEvent pea)
    {
        IGraphPort gPort = pea.GraphPort;

        // Draw the background before we do any scaling
        DrawBackground(gPort);

        
        gPort.SaveState();

        //// Set the graphport scaling appropriately
        DeviceContextClientArea.SetMappingMode(MappingModes.Anisotropic);
        DeviceContextClientArea.SetWindowOrigin(WOrg.x, WOrg.y);
        DeviceContextClientArea.SetWindowExtent(WExt.x, WExt.y);
        DeviceContextClientArea.SetViewportOrigin(VOrg.x, VOrg.y);
        DeviceContextClientArea.SetViewportExtent(VExt.x, VExt.y);

        fClockDisplay.Draw(pea);

        gPort.ResetState();
    }
示例#21
0
        public override void OnPaint(DrawEventArgs pea)
        {

            foreach (UISurface surf in fSurfaces)
            {
                // Create a draw event for each surface.

                // First intersect the clipping rectangle with the frame
                // of the surface.  If the intersection is empty, then just
                // continue on to the next surface.
                RECT surfaceClip = surf.Frame;
                surfaceClip.Intersect(pea.ClipRect);

                // If there is an intersecting section, then
                // adjust it so the surface receives a clipping rectangle in
                // it's local space coordinates.
                surfaceClip.Offset(surfaceClip.Left - surf.Frame.Left, surfaceClip.Top - surf.Frame.Top);

                // We now have a localized clipping rect, so pass along a new
                // DrawEvent with the new clipping rect.
                DrawEvent devent = new DrawEvent(pea.GraphDevice, surfaceClip);                
                surf.Draw(devent);
            }
        }
示例#22
0
		// We override this one because we want to be able to draw the
		// pretty background
        public override void DrawBackground(DrawEvent devent)
        {
            fBackground.Draw(devent);
        }
示例#23
0
 public override void DrawBackground(DrawEvent devent)
 {
     devent.GraphPort.DrawRoundRect(CosmeticPen.Black, new Rectangle(0, 0, Dimension.Width, Dimension.Height), 2, 2);
 }
示例#24
0
 public override void DrawSelf(DrawEvent devent)
 {
     devent.GraphPort.SetFont(fFont);
     //devent.GraphPort.SetBkMode((int)BackgroundMixMode.Transparent);
     devent.GraphPort.SetTextColor(RGBColor.Black);
     fCurrentTextRun.Draw(devent);
 }
示例#25
0
		// We override this one because we want to be able to draw the
		// background, raised or sunken, depending on our state
		public override void DrawBackground(DrawEvent devent)
		{
			GUIStyle.Default.DrawSunkenRect(devent.GraphPort, (int)Origin.x, (int)Origin.y, Frame.Width, Frame.Height);
		}
示例#26
0
 public override void DrawSelf(DrawEvent e)
 {
     e.GraphPort.DrawRectangle(fPen, Extent);
 }
示例#27
0
        /// <summary>
        /// We override OnPaint so that when redrawing is not necessarily occuring, we will still refresh
        /// areas of the window that need refreshing, from the bitmap.
        /// </summary>
        /// <param name="devent"></param>
        public override void OnPaint(DrawEvent devent)
        {
            if (fBackingBuffer != null)
            {
                Rectangle srcRect = new Rectangle(0, 0, fBackingBuffer.Width, fBackingBuffer.Height);

                if (fAutoScale)
                    DeviceContextClientArea.AlphaBlend(fBackingBuffer.DeviceContext, srcRect, ClientRectangle, 255);
                else
                    DeviceContextClientArea.BitBlt(fBackingBuffer.DeviceContext, new Point(0, 0), ClientRectangle, TernaryRasterOps.SRCCOPY);
            }
        }
示例#28
0
		public override void DrawBackground(DrawEvent devent)
		{
            IGraphPort graphPort = devent.GraphPort;

            graphPort.SetPen(fPen);
            graphPort.SetBrush(fBrush);

            graphPort.Polygon(points);
		}
示例#29
0
	public override void Draw(DrawEvent devent)
	{
		// Draw a portion of the destination bitmap
		GraphPort.DrawImage(DestinationPixelBuffer, DestinationOfDstRect(), DestinationRectangle(), GraphicsUnit.Pixel);

		// Draw a portion of the source bitmap
		GraphPort.DrawImage(SourcePixelBuffer, DestinationOfSrcRect(), SourceRectangle(), GraphicsUnit.Pixel);
	}
示例#30
0
        public override void DrawSelf(DrawEvent de)
        {
			IGraphPort graphPort = de.GraphPort;


			//fFont = new Win32Font(graphPort.DeviceContext, fFontName, fPointSize,fStyle);
			//graphPort.Font = fFont;

			graphPort.SetTextColor(fTextColor);
			graphPort.SetBkColor(fBackColor);
            graphPort.SetBkMode(RGBColor.TRANSPARENT);

            graphPort.DrawString(fStartPoint.X, fStartPoint.Y, fString);
        }