O'Reilly logo

Programming Visual Basic 2008 by Tim Patrick

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Localizing Forms Within Visual Studio

There's no sense in postponing the introduction to the localization features of Visual Studio, since they are so easy to use. You already know about the application-wide project properties resource editor. Instead, let's look at the amazing part: localizing forms and controls right in the Visual Studio form editor. You might as well start up Visual Studio and try it out with me, because it's just so fun.

Here's a cute but relatively harmless Windows Forms application that writes your name upside down. I added some Label controls, a TextBox control, and a PictureBox control to a form, as shown in Figure 19-3.

A typical Windows Forms application

Figure 19-3. A typical Windows Forms application

Then I added the following source code to the form:

Private Sub TextBox1_TextChanged( _ ByVal sender As System.Object, _ ByVal e As System.EventArgs) _ Handles TextBox1.TextChanged ' ----- Force a redraw. PictureBox1.Invalidate( ) End Sub Private Sub PictureBox1_Paint(ByVal sender As Object, _ ByVal e As System.Windows.Forms.PaintEventArgs) _ Handles PictureBox1.Paint ' ----- Draw the blank background. e.Graphics.Clear(SystemColors.Window) e.Graphics.DrawRectangle(SystemPens.InactiveCaption, _ 0, 0, PictureBox1.Width - 1, PictureBox1.Height - 1) ' ----- Change the orientation of the display. Dim saveState As Drawing2D.GraphicsState = _ e.Graphics.Save( ) Dim mirrorMatrix As New Drawing2D.Matrix( ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required