Formun Arka Planına Bitmap Resim Ekleme
Bu örnekte formun arka planına bitmap resim ekleyeceğiz. Formunuzun FormBorderStyle özelliğini None seçin.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
Bitmap resim = new Bitmap("resim.jpg");
public Form1()
{
InitializeComponent();
this.Paint += new System.Windows.Forms.PaintEventHandler(Form1_Paint);
}
private void Form1_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
Rectangle mainRect = new Rectangle(0, 0, 695, 278);
Region mainRegion = new Region(mainRect);
e.Graphics.SetClip(mainRegion, CombineMode.Replace);
GraphicsPath myPath = new GraphicsPath();
Region ExcludeRegion3 = new Region(myPath);
e.Graphics.ExcludeClip(ExcludeRegion3);
e.Graphics.DrawImage(resim, 0, 0, 495,278);
e.Graphics.ResetClip();
}
private void Form1_Load(object sender, EventArgs e)
{
this.Size = new System.Drawing.Size(500,280);
}
}
}
//Bir sonraki makalede görüşmek üzere. Bahadır