6 Aralık 2020 Pazar

C# Form Üzerinde Şekil ve Yazının Birlikte Kullanımı

 using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;


namespace WindowsFormsApp40

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }


        private void button1_Click(object sender, EventArgs e)

        {

            Graphics formGraphics = CreateGraphics();

            Font drawFont = new Font("Arial", 20);

            SolidBrush drawBrush = new SolidBrush(System.Drawing.Color.Black);

            StringFormat drawFormat = new StringFormat(StringFormatFlags.LineLimit);

            Rectangle r = new Rectangle(new Point(10, 10), new Size(250, 70));

            formGraphics.DrawRectangle(Pens.Black, r);

            formGraphics.DrawString("Birinci Satır" + "\n" + "ikinci Satır", drawFont, drawBrush, (Rectangle)r, drawFormat);

            drawFont.Dispose();

            drawBrush.Dispose();

            formGraphics.Dispose();             

        }

    }

}


Hiç yorum yok:

Yorum Gönder