Control Contents as Graphics

Guardian

Active member
Joined
Jan 19, 2005
Messages
44
Location
England
Programming Experience
5-10
Hi, i am trying to extract the contents from controls as graphics objects, but i am running into problems.

I have come across this method, but i don't wish to inherit from the target control; e.g. i am trying to extend other controls.

I have tried using the _control_name.CreateGraphics method, but this (as expected) just generates me a blank canvas of the control, not one with the contents on it.

The controls i am after doing this to are textbox and richtextbox.

Any suggestions would be great.
 
graphics error..

dear

u
just try the following code..

Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint



Dim bit As Bitmap = New Bitmap(Me.Width, Me.Height)

Dim g As Graphics = Graphics.FromImage(bit)

Dim myPen As Pen = New Pen(Color.Blue, 9)
Dim cc As Integer

For cc = 0 To 50

e.Graphics.DrawString(Strings.Left(" hello sam is a good boy. His telephone number is 98231xxxxxx. He is very handsome and smart.", (cc * 1.8)), Me.Font, Brushes.Red, 0, 0) '(cc * 15))


End Sub:)
 
Control.DrawToBitmap Method works for TextBox, but not RichTextBox. Graphics.CopyFromScreen Method let you copy any visible part of screen and might help.
 
Back
Top