1-) C# RMOS - resim üzerine yazı yazma -> resmin üzerine yazı yazma
public void Yazdir()
{
Bitmap bmp = new Bitmap(pictureBoxOn.Image);
int opacity = 190; // 50% opaque (0 = invisible, 255 = fully opaque)
Graphics graphics = Graphics.FromImage(bmp);
graphics.DrawString("KOPYADIR",
new Font("Tahoma", 100,FontStyle.Bold),
new SolidBrush(Color.FromArgb(opacity, Color.Red)),
30,
500);
resimYazdir nesne = new resimYazdir();
nesne.xrPictureBox1.Image = bmp;
nesne.ShowPreview();
}
2-) resim üzerine image koyma png transparent sonra onun üzerine yazı yazma
using System;
using System.Drawing;
using System.Windows.Forms;
namespace WindowsFormsApplication2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
int x = 0;
int y = 0;
for (int i = 0; i < 5; i++)
{
Button button1 = new Button();
button1.Width = 70;
button1.Height = 44;
button1.Location = new Point(x, y);
button1.FlatStyle = FlatStyle.Flat;
button1.BackColor = Color.Transparent;
button1.FlatAppearance.MouseDownBackColor = Color.Transparent;
button1.FlatAppearance.MouseOverBackColor = Color.Transparent;
button1.FlatAppearance.BorderSize = 0;
button1.FlatAppearance.BorderColor = Color.FromArgb(0, 255, 255, 255); //transparent
button1.BackgroundImageLayout = ImageLayout.None;
if (i%2==0)
{
button1.Tag = i + 1 + "0000#B";
}else
{
button1.Tag = i + 1 + "0000";
}
button1.Paint += new System.Windows.Forms.PaintEventHandler(this.button1_Paint);
x += 72;
button1.Click += new EventHandler(button1_Click);
flowLayoutPanel1.Controls.Add(button1);
}
}
private void button1_Paint(object sender, PaintEventArgs e)
{
Point ulCorner = new Point(0, 0);
Image image = null;
if (((Button)sender).Tag.ToString().Contains("#"))
{
image = ımageList1.Images[0];
}
else
{
image = ımageList1.Images[1];
}
Graphics g = Graphics.FromImage(image);
g.DrawString((((Button)sender).Tag.ToString()).Split('#')[0].ToString(), new Font("calibri", 10, FontStyle.Bold ), Brushes.Black, new PointF(10, 20));
g.Dispose();
e.Graphics.DrawImage(image, ulCorner);
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show((((Button)sender).Tag.ToString()).Split('#')[0].ToString());
}
}
}