www.pudn.com > sudoku.rar > ImagePanel.cs
//--------------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// File: ImagePanel.cs
//
// Description: A panel used to render a double-buffered image.
//
//--------------------------------------------------------------------------
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace Microsoft.Sudoku.Controls
{
/// Double-buffered panel that displays a stretched image.
internal class ImagePanel : NoFlickerPanel
{
/// Initializes the panel.
public ImagePanel(){}
/// The image to be rendered.
private Image _img;
/// Gets or sets the image to be rendered.
[DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
[Browsable(false)]
public Image Image { get { return _img; } set { _img = value; } }
/// Paints the image.
/// Paint event args.
protected override void OnPaint(PaintEventArgs e)
{
if (_img != null)
{
e.Graphics.DrawImage(_img, 0, 0, Width, Height);
}
base.OnPaint(e);
}
}
}