using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace OracleTest.CustomControl
{
    public partial class UserDataGridView : DataGridView
    {
        private Image m_Image;

        public UserDataGridView()
        {
            InitializeComponent();
            //this.m_Image = Image.FromFile("C:\\BG.jpg");   
            //this.m_Image = Resources.网格背景;
        }

        ///<summary>重写PaintBackground</summary> 
        protected override void PaintBackground(Graphics graphics, Rectangle clipBounds, Rectangle gridBounds)
        {
            base.PaintBackground(graphics, clipBounds, gridBounds);
            graphics.DrawImage(this.m_Image, gridBounds);
        }

        /// <summary>设置背景图片</summary> 
        public Image BackImage
        {
            get
            {
                return this.m_Image;
            }
            set
            {
                this.m_Image = value;
                base.Refresh();  // 重新加载   
            }
        }
    }
} 

 

相关文章:

  • 2021-05-21
  • 2021-10-21
  • 2021-10-17
  • 2021-07-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-12-03
  • 2021-05-28
  • 2022-12-23
  • 2022-12-23
  • 2022-01-30
  • 2021-08-26
  • 2021-10-30
相关资源
相似解决方案