按鈕應用(剪切,複製,粘貼)

要實現圖片完全顯示設置:BackgroundImageLayout=Stretch
效果圖:

這裏寫圖片描述

滾動條的製作:

1 把工具欄中拖panel到窗體裏面,然後設置其屬性AutoScroll=true;

2 把工具欄中的TextBox拖到panel中,要實現多行設置其屬性Multiline=true

3 右邊的功能看下面代碼:

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 jianqie
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private String stext = "";//用於保存輸入的文本

        private void button1_Click(object sender, EventArgs e)
        {
            stext = textBox1.SelectedText;//剪切
            textBox1.SelectedText = "";
        }

        private void button3_Click(object sender, EventArgs e)
        {
            textBox1.SelectedText = stext;//粘貼
        }
        private void button2_Click(object sender, EventArgs e)
        {
            stext = textBox1.SelectedText;//複製
        }
        private void vScrollBar1_Scroll(object sender, ScrollEventArgs e)
        {

        }

        private void button5_Click(object sender, EventArgs e)
        {
            Application.Exit();//退出
        }



        private void button4_Click(object sender, EventArgs e)
        {
            textBox1.Font = new Font("隸書", 16);//文本格式
        }
    }
}
發佈了94 篇原創文章 · 獲贊 24 · 訪問量 12萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章