[Gtk-sharp-list] Single line text with Pango

farolfo farolfo at hotmail.com
Mon Dec 14 08:58:11 EST 2009




Adam Tauno Williams wrote:
> 
> How are you putting the text on the screen?  In a text box, label,
> entry...
> 

I'm drawing text on a GTK window. I use this VB.Net code:

    Sub DrawText(ByRef buffer As Pixmap, ByRef FontLayout As Pango.Layout,
ByRef GraphicContest As Gdk.GC, ByVal rect As Gdk.Rectangle, ByVal Alpha As
Integer, ByVal TextStr As String, ByVal TxtColor As Gdk.Color, ByVal Align
As Integer)

        Dim RetValColor As String

        RetValColor = GDKColor2HTML(TxtColor)

        Select Case Align

            Case 0

                FontLayout.Alignment = Pango.Alignment.Center
            Case 1

                FontLayout.Alignment = Pango.Alignment.Left

            Case Else

                FontLayout.Alignment = Pango.Alignment.Right

        End Select

        FontLayout.Width = Pango.Units.FromPixels(rect.Width)

        Dim Markup As String

        Markup = ""

        FontLayout.SetMarkup(Markup + TextStr + "")

        Dim x As Integer = FontLayout.Width

        buffer.DrawLayout(GraphicContest, rect.X, rect.Y, FontLayout)

    End Sub

-- 
View this message in context: http://old.nabble.com/Single-line-text-with-Pango-tp26775740p26778176.html
Sent from the Mono - Gtk# mailing list archive at Nabble.com.



More information about the Gtk-sharp-list mailing list