110,535
社区成员
发帖
与我相关
我的任务
分享
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
// WindowState = FormWindowState.Maximized;
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.ResizeRedraw, true);
Paint += new PaintEventHandler(FrmMain_Paint);
try{
img = new Bitmap("../../girl.jpg");
smallImg = new Bitmap(img,
new Size(img.Width / 10, img.Height / 10));
}catch(Exception ex){
MessageBox.Show(ex.Message);
}
private void FrmMain_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Brush tb = new TextureBrush(smallImg,
new Rectangle(0, 0, smallImg.Width, smallImg.Height));
g.FillRectangle(Brushes.White, ClientRectangle);
g.FillEllipse(tb, ClientRectangle);
tb.Dispose();
}