Visual Studio の使い方は、プログラミングを勉強できる人が勉強してわからないほど難しくはありません。
メモ帳でプログラミングを勉強しようとするのはかなりかなりものすごく効率が悪いので、今すぐに Visual Studio の使い方を学んでください。
C#
1using System;
2using System.Drawing;
3using System.Windows.Forms;
4
5namespace WindowsFormsApp1
6{
7 static class Program
8 {
9 /// <summary>
10 /// アプリケーションのメイン エントリ ポイントです。
11 /// </summary>
12 [STAThread]
13 static void Main()
14 {
15 Application.EnableVisualStyles();
16 Application.SetCompatibleTextRenderingDefault(false);
17 Application.Run(new MainForm());
18 }
19 }
20
21 class MainForm : Form
22 {
23 public MainForm()
24 {
25 var telop = new Telop
26 {
27 Dock = DockStyle.Fill,
28 Font = new Font("MS ゴシック", 12),
29 Lines = new[]
30 {
31 "文字1", "文字2", "文字3"
32 }
33 };
34 Controls.Add(telop);
35 telop.Run();
36 }
37 }
38
39 class Telop : Control
40 {
41 public string[] Lines { get; set; }
42 public int Position { get; set; }
43 public int LineHeight { get; set; } = 20;
44
45 public void Run()
46 {
47 Position = 0;
48 Animator.Animate(1000, (frame, frequency) =>
49 {
50 if (!Visible || IsDisposed) return false;
51 Position = frame * (Height + Lines.Length * LineHeight) / frequency;
52 Invalidate();
53 return true;
54 });
55 }
56
57 protected override void OnPaint(PaintEventArgs e)
58 {
59 base.OnPaint(e);
60 var brush = new SolidBrush(ForeColor);
61 for (int i = 0; i < Lines.Length; i++)
62 {
63 e.Graphics.DrawString(Lines[i], Font, brush, 0, Height - Position + i * LineHeight);
64 }
65 }
66 }
67
68 public static class Animator
69 {
70 /// <summary>
71 /// 1 フレームの時間とフレーム数を指定してアニメーション機能を提供します。
72 /// </summary>
73 /// <param name="interval">1 フレームの時間をミリ秒単位で指定します。</param>
74 /// <param name="frequency">
75 /// frequency はコールバックが呼ばれる回数から 1 を引いたものです。例えば frequency が 10 の時には 11 回呼ばれます。
76 /// </param>
77 /// <param name="callback">
78 /// bool callback(int frame, int frequency) の形でコールバックを指定します。
79 /// frame は 0 から frequency の値まで 1 ずつ増加します。
80 /// frequency は引数と同じものです。
81 /// </param>
82 public static void Animate(int interval, int frequency, Func<int, int, bool> callback)
83 {
84 var timer = new System.Windows.Forms.Timer();
85 timer.Interval = interval;
86 int frame = 0;
87 timer.Tick += (sender, e) =>
88 {
89 if (callback(frame, frequency) == false || frame >= frequency)
90 {
91 timer.Stop();
92 }
93 frame++;
94 };
95 timer.Start();
96 }
97
98 /// <summary>
99 /// 持続時間を指定してアニメーション機能を提供します。
100 /// </summary>
101 /// <param name="duration">持続時間をミリ秒単位で指定します。</param>
102 /// <param name="callback">
103 /// bool callback(int frame, int frequency) の形でコールバックを指定します。
104 /// frame は 0 から frequency の値まで 1 ずつ増加します。
105 /// frequency はコールバックが呼ばれる回数から 1 を引いたものです。例えば frequency が 10 の時には 11 回呼ばれます。
106 /// </param>
107 public static void Animate(int duration, Func<int, int, bool> callback)
108 {
109 const int interval = 25;
110 if (duration < interval) duration = interval;
111 Animate(25, duration / interval, callback);
112 }
113 }
114}
115
上記ソース中の Animator の使い方は Windows Forms でコントロールをアニメーションさせる を参照してください。