I am new to .Net an need help in my application.
I want to scroll my text in a picturebox.. i used drawstring function to draw the text an now i want to make it scrollable..
My Code is
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Dim scale_factor As Single = Single.Parse(cmbdest.Text)
' Get the source bitmap.
Dim bm_source As New Bitmap(Size.Width, Size.Height, Drawing.Imaging.PixelFormat.Format24bppRgb)
' Make a bitmap for the result.
Dim bm_dest As New Bitmap( _
CInt(bm_source.Width * scale_factor), _
CInt(bm_source.Height * scale_factor))
'Make a Graphics object for the result Bitmap.
Dim gr_dest As Graphics = Graphics.FromImage(bm_source)
End Sub
Private Function DrawText(ByVal Text As String) As Bitmap
Dim TextBitmap As New Bitmap(Text)
Dim Brush As New SolidBrush(Color.Black)
Dim SelectedFont = New Font(FontFamily.GenericSansSerif, 50)
Using Graphic = Graphics.FromImage(TextBitmap)
Graphic.DrawString(Text, SelectedFont, Brushes.Black, 0, 0)
End Using
Return TextBitmap
End Function
Private Sub img(ByVal route As String, ByVal font As String, ByVal fnsize As Integer, ByVal x As Integer, ByVal y As Integer)
PictureBox1.Image = Nothing
Dim g2 As System.Drawing.Graphics
Dim img As New Bitmap(Size.Width, Size.Height, Drawing.Imaging.PixelFormat.Format24bppRgb)
g2 = Graphics.FromImage(img)
g2.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
g2.TextRenderingHint = Drawing.Text.TextRenderingHint.ClearTypeGridFit
g2.CompositingQuality = Drawing2D.CompositingQuality.HighQuality
Try
g2.DrawString(route, New Font(font, fnsize), Brushes.White, x, y)
Catch ex As Exception
MessageBox.Show("this font not supported try another font")
End Try
PictureBox1.SizeMode = PictureBoxSizeMode.Normal
PictureBox1.Image = img
End Sub
in the same function i have to save the file in .txt format and .bmp format..
Kindly help me..
thanks in advance
Madhu Mitha
20-Mar-2015Sumit Kesarwani
20-Mar-2015Madhu Mitha
20-Mar-2015Sumit Kesarwani
20-Mar-2015