Telep: a rich text box
On a button click, I was taking the rich text box creating a bitmap, and then making it in the same location as telep, but above it. And then I finally made it mirrored horizontally.
public void pictureBox6_Click(object sender, EventArgs e)
{
PictureBox pic = new PictureBox();
pic.Location = this.telep.Location;
pic.Size = this.telep.Size;
Bitmap bitmap = new Bitmap(this.telep.Width, this.telep.Height);
DrawToBitmap(this.telep, bitmap, new Rectangle(Point.Empty, this.telep.Size));
bitmap.RotateFlip(RotateFlipType.RotateNoneFlipX);
pic.Image = bitmap;
this.Controls.Add(pic);
pic.BringToFront();
pic.Dock = DockStyle.Fill;
}
private void DrawToBitmap(RichTextBox richTextBox, Bitmap image, Rectangle targetRectangle)
{
Graphics g = telep.CreateGraphics();
Graphics g2 = Graphics.FromImage(image);
IntPtr gi = g.GetHdc();
IntPtr gi2 = g2.GetHdc();
BitBlt(gi2, 0, 0, richTextBox.Width, richTextBox.Height, gi, 0, 0, 0x00CC0020);
g.ReleaseHdc();
g2.ReleaseHdc();
g.Dispose();
g2.Dispose();
}