Label ve TextBox Nesnelerinde TrackBar Kullanımı

 

Merhaba arkadaşlar bu makalemizde label ve textbox gibi nesnelerin trackbar kullanarak nasıl font boyutunu değiştireceğimizi göreceğiz.


Formumuza 1 adet Label, TextBox ve TrackBar ekleyelim. TrackBar ın value değeri ile oynayarak label ve textbox ın font boyutunu değiştirmiş olacağız.

 

 





Şekil 1


 



Şekil 2

 

Form1.cs

 

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 trackbar

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }

 

        private void Form1_Load(object sender, EventArgs e)

        {

            trackBar1.Minimum = 0;

            trackBar1.Maximum = 100;

          

            trackBar1.Value = (int)label1.Font.Size;

            trackBar1.Value = (int)textBox1.Font.Size;

 

            this.Text = "% " + trackBar1.Value.ToString();

        }

        private void trackBar1_Scroll(object sender, EventArgs e)

        {

            this.Text = "% " + trackBar1.Value.ToString();

            label1.Font = new Font(label1.Font.FontFamily, trackBar1.Value);

            textBox1.Font = new Font(textBox1.Font.FontFamily, trackBar1.Value);

        }

 

      

    }

}

     

Bir makalenin daha sonuna geldik. Bir sonraki makalede görüşmek üzere. Bahadır ŞAHİN

About Bahadır Şahin

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.

0 comments:

Öne Çıkan Yayın

GridView da Seçili Satırı DetailsView da Göstermek

Merhaba arkadaşlar bu makalemizde GridView nesnesi ile birlikte DetailsView nesanesini birlikte kullanacağız. GridView da seçili satırın de...