public override void OnRender(Microsoft.SPOT.Presentation.Media.DrawingContext dc) { if (_bitmap != null) { dc.DrawImage(_bitmap, 0, 0); } }
public override void OnRender(DrawingContext dc) { Bitmap bmp = _bitmap; if (bmp != null) { dc.DrawImage(_bitmap, 0, 0); } }
/// <summary> /// Handles the render event. /// </summary> /// <param name="dc"></param> public override void OnRender(DrawingContext dc) { // Loop through all the blocks except the animated block // and draw the associated bitmap. int i = 0; for (i = 0; i < 9; i++) { int x = (i % 3) * blockDimension; int y = (i / 3) * blockDimension; if (_animationTargetBlock != i) { DrawBlock(_blocks[i], x, y, dc); } } // Draw the animated block if there is one. if (_animationTargetBlock >= 0) { lock (_blockBitmap) { int x = (_animationTargetBlock % 3) * blockDimension; int y = (_animationTargetBlock / 3) * blockDimension; dc.DrawImage(_blockBitmap[8], x, y); if (_animationStep < 9 && activeAnimX != null && activeAnimY != null) { x += activeAnimX[_animationStep]; y += activeAnimY[_animationStep]; } DrawBlock(_blocks[_animationTargetBlock], x, y, dc); } } // Draw a rectangle box around the puzzle. dc.DrawLine(pen, 0, 0, 0, 239); dc.DrawLine(pen, 0, 0, 240, 0); dc.DrawLine(pen, 0, 239, 240, 239); dc.DrawLine(pen, 240, 0, 240, 239); }
/// <summary> /// /// </summary> /// <param name="i"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="width"></param> /// <param name="height"></param> /// <param name="dc"></param> private void DrawBlock(int i, int x, int y, DrawingContext dc) { dc.DrawImage(_blockBitmap[i], x, y); }
private static void PostRenderFix(DrawingContext dc) { if (_passThroughDC != null) dc.DrawImage(_passThroughDC.Bitmap, 0, 0, 0, 0, _passThroughDC.Width, _passThroughDC.Height); }
public override void OnRender(DrawingContext dc) { if (IsSelected) dc.DrawRectangle(selectedBrush, null, 0, 0, Width, Height); else dc.DrawRectangle(null, null, 0, 0, Width, Height); if (icon != null) dc.DrawImage(icon, iconOffset, iconOffset); }
/// <summary> /// Override OnRender to handle drawing. /// </summary> /// <param name="dc"></param> public override void OnRender(DrawingContext dc) { // Call the base class. base.OnRender(dc); // Set the status string to a default of Off. string status = "Off"; // Get a bitmap depending on the current status. Bitmap bmp = null; if (_status == StatusType.Cool) { // Set the status text to Cool. status = "Cool"; // Get the bitmap that represents a status of Cool. bmp = Resources.GetBitmap(Resources.BitmapResources.snowflake); } else if (_status == StatusType.Heat) { // Set the status text to Heat. status = "Heat"; // Get the bitmap that represents a status of Heat. bmp = Resources.GetBitmap(Resources.BitmapResources.fire); } // Draw the status text. dc.DrawText("Status: " + status, Resources.GetFont(Resources.FontResources.small), Color.Black, 10, 10); // If a bitmap was loaded, display it. if (bmp != null) dc.DrawImage(bmp, 100, 0); }
/// <summary> /// We are not overriding the OnRender method of the class, but are simply /// creating a render method that can be called by the menu container. /// </summary> /// <param name="dc"></param> /// <param name="x"></param> /// <param name="y"></param> /// <param name="scale"></param> public void Render(DrawingContext dc, int x, int y, int scale) { // Make sure we have all of the proper images. if (_image != null && _imageSmall != null) { // If the scale is at maxStep, use the larger image. Otherwise, use // the scale value to scale from the smaller image to something // bigger. if (scale == MenuItemPanel.maxStep) { Width = _image.Width; Height = _image.Height; dc.DrawImage(_image, x, y); } else { // If the scale is 0, draw the small bitmap. Otherwise, // calculate the difference between the small and large bitmaps // and stretch the small bitmap. if (scale == 0) { Width = _imageSmall.Width; Height = _imageSmall.Height; x += ((_largeWidth - Width) / 2); y += ((_largeHeight - Height) / 2); dc.DrawImage(_imageSmall, x, y); } else { int wDiff = _image.Width - _imageSmall.Width; int hDiff = _image.Height - _imageSmall.Height; Width = _imageSmall.Width + _widthSteps[scale]; Height = _imageSmall.Height + _heightSteps[scale]; x += ((_largeWidth - Width) / 2); y += ((_largeHeight - Height) / 2); dc.Bitmap.StretchImage(x, y, _imageSmall, Width, Height, 255); } } } }
public override void OnRender(DrawingContext dc) { if (_pushClippingRectangle) { try { dc.PushClippingRectangle(x0, y0, xDimension, yDimension); } catch (ArgumentException ex) { Log.Comment("Caught " + ex.Message + " when Pushing a clipping rectangle at (" + x0 + ", " + y0 + ")" + " and Width = " + xDimension + " Height = " + yDimension); _argumentException = true; } } if (_popClippingRectangle) { dc.PopClippingRectangle(); } if (_getClippingRectangle) { dc.GetClippingRectangle(out x1, out y1, out wd, out ht); } if (_drawLine) { dc.DrawLine(_pen, x0, y0, x1, y1); } if (_drawRectangle) { try { dc.DrawRectangle(_brush, _pen, r, s, xDimension, yDimension); } catch (ArgumentException ex) { Log.Comment("Caught " + ex.Message + " when drawing a Rectangle at (" + r + ", " + s + ")" + " Width = " + xDimension + " Height = " + yDimension); _argumentException = true; } } if (_drawEllipse) { dc.DrawEllipse(_brush, _pen, r, s, xDimension, yDimension); } if (_drawPolygon) { dc.DrawPolygon(_brush, _pen, pts); } if (_clear) { dc.Clear(); } if (_setPixel) { dc.SetPixel(_color, r, s); } if (_drawImage) { try { dc.DrawImage(bmp1, r, s); } catch (NullReferenceException ex) { Log.Comment("Caught " + ex.Message + " when drawing a null Image"); _nullReferenceException = true; } } if (_drawCroppedImage) { try { dc.DrawImage(bmp1, r, s, x0, y0, xDimension, yDimension); } catch (ArgumentException ex) { Log.Comment("Caught " + ex.Message + " when drawing an Image at (" + r + ", " + s + ")" + "from a source Image at(" + x0 + ", " + y0 + ") Width = " + xDimension + " Height = " + yDimension); _argumentException = true; } catch (NullReferenceException ex) { Log.Comment("Caught " + ex.Message + " when drawing a null Image"); _nullReferenceException = true; } } if (_translate) { dc.Translate(r, s); } if (_blendImage) { dc.BlendImage(bmp2, x0, y0, x1, y1, xDimension, yDimension, _opacity); } if (_drawText) { _textFits = dc.DrawText(ref _str, _font, _color, r, s, xDimension, yDimension, _alignment, _trimming); } base.OnRender(dc); _pBitmap = dc.Bitmap; Master_Media.autoEvent.Set(); }