From C to VB.NET (Part III) (Background image in TextBox)
- From: Kulber <Kulber@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 16 Aug 2008 00:08:00 -0700
I feel my delay. I had work.
First of all, thank you for reply.
I explain: I do not know use the code of the original web page in VB.NET.
Gillard made the translation from C (and thank you) but some things VB.NET
does not recognize them (for example, some "imports"). I do not also know use
the part of the code that begins for " <Page ... ", though VB.NET admits this
code if in front of every line write three characters of commentary ( ''' ).
If someone knows the method to realize this example in VB.NET I'll be very
grateful and probably many people because it is a code interesting (that
those of Microsoft might have written it also for VB).
Thank you very much again.
This is the code:
Original site (in English):
http://msdn.microsoft.com/en-us/library/bb613590.aspx
Translation made by Gillard:
Imports System
Imports System.Windows
Imports System.Windows.Input
Imports System.Windows.Controls
Imports System.Windows.Media
Imports System.Windows.Media.Imaging
Namespace SDKSample
Partial Public Class TextBoxBackgroundExample
Inherits Page
Private Sub OnTextBoxTextChanged(ByVal sender As Object, ByVal e As
TextChangedEventArgs)
If myTextBox.Text = "" Then
' Create an ImageBrush.
Dim textImageBrush As New ImageBrush()
textImageBrush.ImageSource = New BitmapImage(New
Uri("TextBoxBackground.gif", UriKind.Relative))
textImageBrush.AlignmentX = AlignmentX.Left
textImageBrush.Stretch = Stretch.None
' Use the brush to paint the button's background.
myTextBox.Background = textImageBrush
Else
myTextBox.Background = Nothing
End If
End Sub
End Class
End Namespace
.
- Follow-Ups:
- Prev by Date: working with bits
- Next by Date: Re: How to detect the character encoding of a file ?
- Previous by thread: working with bits
- Next by thread: Re: From C to VB.NET (Part III) (Background image in TextBox)
- Index(es):