要實現圖片完全顯示設置: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);//文本格式
}
}
}