[an error occurred while processing this directive] [an error occurred while processing this directive]

C#

かっこいいVBです。文法はJavaによく似てます。情報も増えてきたし、.NETオンリーなら本命はC#でしょ。

線・長方形・字を書く


// pb : PictureBox

private void btn_Click(object sender, System.EventArgs e){
  // Graphics オブジェクトの取得
  pb.Image = new Bitmap(pb.Width, pb.Height) ;
  Graphics g = Graphics.FromImage(pb.Image) ;

  // Pen        pen   = new Pen(Color.Magenta) ;

  // 塗りつぶし四角形
  SolidBrush brush = new SolidBrush(Color.DarkBlue) ;
  g.FillRectangle(brush, 0, 0, 20, 20) ;

  // 文字列
  Font font  = new Font("Arial", 20.0) ;
  g.DrawString("Hello", font, brush, 20, 0);

}

配列の初期化

int[][] A = new int[10][];
A[0] = new int[10];
for(int i = 0; i < A[0].Length; i++){
  Console.Write(A[0][i] + ",");
}
int[,] A = new int[2,2];
Console.WriteLine(A[0,0]);
for(int i = 0; i < A.GetLength(0); i++){
  for(int j = 0; j < A.GetLength(1); j++){
    Console.Write(A[i,j] + ",");
  }
}
int[][] A = new int[][]{new int[]{1,2,3},new int[]{1,3}};


int[][] A = {{1,2,3},{1,3}};

変数展開、printf 的なもの

0 スタートです。
string text = "{0},{1}", A[0], A[1];
[an error occurred while processing this directive]