Re: From C to VB.NET (Part III) (Background image in TextBox)
- From: "Gillard" <gillard_georges@@@@@@@@@hotmail.com>
- Date: Sat, 16 Aug 2008 12:22:41 +0200
1 this is not C but C#
2 you need framework 3 'cause it is WPF
3 you also have to copy the xaml code
4 it look like a custom WPF library project
"Kulber" <Kulber@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message news:42CDCCCD-E19C-4E09-912E-6D3FBEEE391F@xxxxxxxxxxxxxxxx
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:
- References:
- Prev by Date: Re: How to detect the character encoding of a file ?
- Next by Date: Re: working with bits
- Previous by thread: From C to VB.NET (Part III) (Background image in TextBox)
- Next by thread: Re: From C to VB.NET (Part III) (Background image in TextBox)
- Index(es):