🙂 İNSANLARIN EN HAYIRLISI INSANLARA FAYDALI OLANDIR 🙂

Ramazan HABER / C# / AutoScroll false iken aşağı yukarı yapmak

 

1-) C# -  AutoScroll false iken aşağı yukarı yapmak

1-) AutoScroll false iken aşağı yukarı yapmak

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 FormicindeFor {

    public partial class Form1 : Form {

        private int location = 0;

        Form2 myForm;

        public static int maximum=0;

        public Form1() {

            InitializeComponent();

            myForm = new Form2();

            flowLayoutPanel1.AutoScrollPosition = new Point(0, 0);

        }

        private void button7_Click(object sender, EventArgs e) {

            if (location + 40 < flowLayoutPanel1.VerticalScroll.Maximum) { // aşağı

                location += 40;

                flowLayoutPanel1.VerticalScroll.Value = location;

            } else {

                location = flowLayoutPanel1.VerticalScroll.Maximum;

                flowLayoutPanel1.AutoScrollPosition = new Point(0, location);

            }

        }

        private void button8_Click(object sender, EventArgs e) { // yukarı

            if (location - 40 > 0) {

                location -= 40;

                flowLayoutPanel1.VerticalScroll.Value = location;

            } else {

                location = 0;

                flowLayoutPanel1.AutoScrollPosition = new Point(0, location);

            }

        }

        private void button9_Click(object sender, EventArgs e) { // 75; 23

            for (int i = 0; i < 15; i++) {

                Button button = new Button();

                button.Text = i + "";

                button.Tag = i;

                flowLayoutPanel1.Controls.Add(button);

                maximum+= 23; // buttonun yüksekliğini buraya yaz

            }

            flowLayoutPanel1.VerticalScroll.Maximum = maximum; // initializingdekini iptal et buraya al

        }

    }

}

 2021 Ocak 18 Pazartesi
 456