---
title: "To scroll a text inside picture box"  
description: "To scroll a text inside picture box"  
author: "Madhu Mitha"  
published: 2015-03-22  
updated: 2015-03-22  
canonical: https://www.mindstick.com/forum/23039/to-scroll-a-text-inside-picture-box  
category: ".net"  
tags: ["vb.net"]  
reading_time: 1 minute  

---

# To scroll a text inside picture box

hi thr,\
I want to scroll [text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions) inside a picturebox, from [right](https://www.mindstick.com/articles/12766/check-whether-you-are-doing-digital-transformation-right-or-not) to [left](https://www.mindstick.com/articles/12768/don-t-be-left-behind-with-the-new-it-revolution) can [anyone help me](https://www.mindstick.com/forum/331/can-anyone-help-me-out-how-to-use-session-concept) in solving this problem..\
**My [code](https://yourviews.mindstick.com/view/85458/alan-turing-the-mastermind-behind-cracking-the-enigma-code-during-world-war-ii) is** \

```
Public Class Form1    Dim brush As New Drawing.SolidBrush(Color.Black)    Dim g2 As System.Drawing.Graphics    Dim img As New Bitmap(400, 100)    Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged        g2 = Graphics.FromImage(img)        PictureBox1.Image = img        g2.Clear(Color.White)        g2.SmoothingMode = Drawing2D.SmoothingMode.HighQuality        g2.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit        g2.CompositingQuality = Drawing2D.CompositingQuality.HighQuality        '        g2.DrawString(TextBox1.Text, TextBox1.Font, Brushes.Red, 0, 0)    End SubEnd Class
```

\

## Replies

### Reply by John Smith

try below lines of code:

```
Imports System.IO  Imports System.Drawing  Public Class Form1      Private WithEvents Label1 As New System.Windows.Forms.Label      Private WithEvents Label2 As New System.Windows.Forms.Label      Private WithEvents label3 As New System.Windows.Forms.Label      Private WithEvents newPictureBox1 As New System.Windows.Forms.PictureBox      Private WithEvents newPictureBox2 As New System.Windows.Forms.PictureBox      Private WithEvents newPictureBox3 As New System.Windows.Forms.PictureBox                 Private Labels() As Label      Private newPictureBoxs() As PictureBox        Dim x As Integer          Dim newPictureBox As New PictureBox           Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles MyBase.Load              newPictureBox1.Image = Image.FromFile("C:\1.gif")          newPictureBox2.Image = Image.FromFile("C:\2.gif")          newPictureBox3.Image = Image.FromFile("C:\3.gif")          Label1.Text = "11111 the first news"          Label2.Text = "222222 the 2nd news"          label3.Text = "33333 the 3rd news"          newPictureBox1.Visible = True          newPictureBox2.Visible = True          newPictureBox3.Visible = True          newPictureBox1.Top = 20          newPictureBox1.Width = 43          newPictureBox1.Height = 48          newPictureBox2.Top = 20          newPictureBox2.Width = 43          newPictureBox2.Height = 48          newPictureBox3.Top = 20          newPictureBox3.Width = 43          newPictureBox3.Height = 48          newPictureBox1.Left = 40          Label1.Left = newPictureBox1.Left + Label1.Width          newPictureBox2.Left = Label1.Left + 60          Label2.Left = newPictureBox2.Left + Label2.Width          newPictureBox3.Left = Label2.Left + 60          label3.Left = newPictureBox3.Left + label3.Width          Label1.Top = 40          Label2.Top = 40          label3.Top = 40            'add control to form          Controls.Add(newPictureBox1)          Controls.Add(newPictureBox2)          Controls.Add(newPictureBox3)          Controls.Add(Label1)          Controls.Add(Label2)          Controls.Add(label3)                 End Sub        Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick          If Me.newPictureBox1.Location.X + newPictureBox1.Width < 0 Then              newPictureBox1.Location = New Point(Me.Width, newPictureBox1.Location.Y)          Else              newPictureBox1.Location = New Point(newPictureBox1.Location.X - 3, newPictureBox1.Location.Y)          End If          If Me.newPictureBox2.Location.X + newPictureBox2.Width < 0 Then              newPictureBox2.Location = New Point(Me.Width, newPictureBox2.Location.Y)          Else              newPictureBox2.Location = New Point(newPictureBox2.Location.X - 3, newPictureBox2.Location.Y)          End If          If Me.newPictureBox3.Location.X + newPictureBox3.Width < 0 Then              newPictureBox3.Location = New Point(Me.Width, newPictureBox3.Location.Y)          Else              newPictureBox3.Location = New Point(newPictureBox3.Location.X - 3, newPictureBox3.Location.Y)          End If          If Me.Label1.Location.X + Label1.Width < 0 Then              Label1.Location = New Point(Me.Width, Label1.Location.Y)          Else              Label1.Location = New Point(Label1.Location.X - 3, Label1.Location.Y)          End If          If Me.Label2.Location.X + Label2.Width < 0 Then              Label2.Location = New Point(Me.Width, Label2.Location.Y)          Else              Label2.Location = New Point(Label2.Location.X - 3, Label2.Location.Y)          End If          If Me.label3.Location.X + label3.Width < 0 Then              label3.Location = New Point(Me.Width, label3.Location.Y)          Else              label3.Location = New Point(label3.Location.X - 3, label3.Location.Y)          End If      End Sub  End Class 
```


---

Original Source: https://www.mindstick.com/forum/23039/to-scroll-a-text-inside-picture-box

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
