Results 1 to 10 of 10

Thread: Draw picture

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    26

    Draw picture

    Hi,

    I have this 3rd party tool to do a print preview on some selected text, how can I show text in the preview? they gave this code which tells me to add my drawing code but I dont know how to do this part so some help would be most grateful

    VB Code:
    1. Private Sub IPrintExt_DrawPage(ByVal Options As Variant, ByVal hdc As Long, ByVal Page As EXPRINTLib.IPage, pbContinue As Boolean)
    2.     Dim r As RECT
    3.     GetClipBox hdc, r
    4.     FillRect hdc, r, 1
    5.    
    6.     ' Add your own drawing code
    7.    
    8. End Sub
    9.  
    10. if you need to see the whole project I will post it.
    11.  
    12. Thanks
    13.  
    14. Hugh

  2. #2

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    26

    Re: Draw picture

    Hi

    I mean to preview some text, sorry,

    If you have a look at the project below you will see wat I mean.


    Thanks Hugh
    Attached Files Attached Files

  4. #4
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Draw picture

    All it does is this:
    VB Code:
    1. Private Sub Command1_Click()
    2.     With Print1
    3.         Set .PrintExt = Me
    4.         .Preview
    5.     End With
    6. End Sub
    ... and it tels me that you're trying to Print and/or preview your form.
    If that's the case then you might be able to use PrintForm method of your form:
    VB Code:
    1. Private Sub Command1_Click()
    2.     Me.PrintForm
    3. End Sub

  5. #5

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    26

    Re: Draw picture

    How do I put text onto the preview page?

    Thanks

    Hugh

  6. #6

  7. #7

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    26

    Re: Draw picture

    Hi,

    The text is from TextBox1 from Form1, does not need to be any certain format.

    Thanks

    Hugh

  8. #8
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Draw picture

    In that case the simplest way is use Printer object:

    Printer.Print Text1.Text
    Printer.EndDoc

    But KIM that entire text will not be wrapped - only what can fit into page width - minus margins.
    All wrapping will need to be done manually. So my guess is that dll you're advised to use is doing all this hard work for you.

  9. #9

    Thread Starter
    Junior Member
    Join Date
    Mar 2005
    Posts
    26

    Re: Draw picture

    But that only sends the text to be printed it does not send the text to the preview page.

    Thanks

    Hugh

  10. #10
    PowerPoster RhinoBull's Avatar
    Join Date
    Mar 2004
    Location
    New Amsterdam
    Posts
    24,132

    Re: Draw picture

    The "PREVIEW PAGE" is nothing more but another form with some label or something on it and/or picturebox/image controls for graphics. So, having said that add new form to your project and activate it when you need to preview something:

    Load frmPreview
    frmPreview.lblText.Caption = Text1.Text
    frmPreview.Show vbModal, Me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width