PictureBox Scroll Text : PictureBox : GUI Windows Form C# Source Code


Custom Search

C# Source Code » GUI Windows Form » PictureBox »

 

PictureBox Scroll Text








    
 

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

public class Form1 : Form {
    Font textFont = new Font("Times New Roman", 24);

    public Form1() {
        this.panel1 = new System.Windows.Forms.Panel();
        this.pictureBox1 = new System.Windows.Forms.PictureBox();
        this.panel1.SuspendLayout();
        ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).BeginInit();
        this.SuspendLayout();
        this.panel1.AutoScroll = true;
        this.panel1.AutoScrollMinSize = new System.Drawing.Size(600, 400);
        this.panel1.Controls.Add(this.pictureBox1);
        this.panel1.Location = new System.Drawing.Point(13, 13);
        this.panel1.Size = new System.Drawing.Size(267, 243);
        this.pictureBox1.BackColor = System.Drawing.SystemColors.Window;
        this.pictureBox1.Dock = System.Windows.Forms.DockStyle.Fill;
        this.pictureBox1.Location = new System.Drawing.Point(0, 0);
        this.pictureBox1.Size = new System.Drawing.Size(600, 400);
        this.pictureBox1.TabStop = false;
        this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
        this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
        this.ClientSize = new System.Drawing.Size(292, 268);
        this.Controls.Add(this.panel1);
        this.Load += new System.EventHandler(this.Form1_Load);
        this.panel1.ResumeLayout(false);
        ((System.ComponentModel.ISupportInitialize)(this.pictureBox1)).EndInit();
        this.ResumeLayout(false);
    }
    private void Form1_Load(object sender, EventArgs e) {
        Bitmap b = new Bitmap(600, 600);
        Graphics g = Graphics.FromImage(b);
        g.FillRectangle(Brushes.White, new Rectangle(0, 0, b.Width, b.Height));
        g.DrawString("Hello, World", textFont, Brushes.Black, 40, 40);
        g.DrawString("Hello, World", textFont, Brushes.Red, 40, 240);
        g.DrawString("Hello, World", textFont, Brushes.Blue, 350, 40);
        g.DrawString("Hello, World", textFont, Brushes.Green, 350, 240);
        pictureBox1.BackgroundImage = b;
        pictureBox1.Size = b.Size;
    }
    private System.Windows.Forms.Panel panel1;
    private System.Windows.Forms.PictureBox pictureBox1;
    [STAThread]
    static void Main() {
        Application.EnableVisualStyles();
        Application.Run(new Form1());
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo GUI Windows Form
» PictureBox