Click here to Skip to main content
15,917,328 members
Home / Discussions / Article Writing
   

Article Writing

 
QuestionNetwork Pin
scorp_scorp14-Apr-07 22:51
scorp_scorp14-Apr-07 22:51 
AnswerRe: Network Pin
Paul Conrad28-Nov-07 17:09
professionalPaul Conrad28-Nov-07 17:09 
QuestionCallback function in asm_ block Pin
zon_cpp14-Apr-07 0:07
zon_cpp14-Apr-07 0:07 
AnswerRe: Callback function in asm_ block Pin
Paul Conrad14-Jul-07 19:56
professionalPaul Conrad14-Jul-07 19:56 
QuestionHelp plz Pin
batousaioiqw910-Apr-07 13:37
batousaioiqw910-Apr-07 13:37 
AnswerRe: Help plz Pin
Paul Conrad14-Jul-07 19:56
professionalPaul Conrad14-Jul-07 19:56 
GeneralRe: Help plz Pin
batousaioiqw919-Jul-07 20:31
batousaioiqw919-Jul-07 20:31 
Generalprint a form which contains a tab control Pin
vinidimple10-Apr-07 3:07
vinidimple10-Apr-07 3:07 
Hi

This is to print a form which contains a tab control.For this you have to instal Microsoft.Visual Basic.PowerPacks.Printing.dll.Then add one command button and a tab control to your form.Then add some other controls to your tabpages.Drag PrintDocument1 control from the tool box to your form.After that paste the code in the code behind.Press F5 to run it.Click on the button1 to print the pages.


Option Strict Off
Imports System.Drawing
Imports System.Drawing.Printing
Imports System.Runtime.InteropServices

Public Class Form1
Dim TabId As Integer
Dim i As Integer

Dim img As Bitmap
Dim WithEvents pd As PrintDocument
Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
End Sub

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.TabControl1.SelectTab(0)
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try

TabId = Me.TabControl1.TabCount
For i = 0 To TabId - 1
Me.TabControl1.TabIndex = i
Me.TabControl1.SelectTab(i)
'MsgBox(i)
Me.Refresh()

img = CaptureForm1()
pd = New PrintDocument
pd.Print()
Next
Catch ex As Exception
MsgBox(ex)
End Try
End Sub
Function CaptureForm1() As Bitmap
Dim g1 As Graphics = Me.CreateGraphics()
Dim MyImage = New Bitmap(Me.ClientRectangle.Width, (Me.ClientRectangle.Height), g1)
Dim g2 As Graphics = Graphics.FromImage(MyImage)
Dim dc1 As IntPtr = g1.GetHdc()
Dim dc2 As IntPtr = g2.GetHdc()
BitBlt(dc2, 0, 0, Me.ClientRectangle.Width, (Me.ClientRectangle.Height), dc1, 0, 0, 13369376)
g1.ReleaseHdc(dc1)
g2.ReleaseHdc(dc2)
'saves image to c drive just, u can comment it also
MyImage.Save("c:\abc.bmp")
Return MyImage
End Function
Sub pd_PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs) Handles pd.PrintPage
Dim x As Integer = e.MarginBounds.X
Dim y As Integer = e.MarginBounds.Y
e.Graphics.DrawImage(img, x, y)
e.HasMorePages = False
End Sub
SetLastError:=True, CharSet:=CharSet.Unicode, _
ExactSpelling:=True, _
CallingConvention:=CallingConvention.StdCall)> _
Private Shared Function BitBlt(ByVal hdcDest As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As System.Int32) As Boolean

' Leave function empty - DLLImport attribute forwards calls to MoveFile to
' MoveFileW in KERNEL32.DLL.
End Function


Hope this may b helpful for you sometimes.
Thanks
Vinidimple


dimp


dimp

QuestionWInzip and Winrar commands and switches Pin
GgAben2-Apr-07 22:50
GgAben2-Apr-07 22:50 
AnswerRe: WInzip and Winrar commands and switches Pin
Dmitry Khudorozhkov4-Apr-07 23:02
Dmitry Khudorozhkov4-Apr-07 23:02 
QuestionNeed help with NowSMS Pin
jayu_s_a28-Mar-07 22:56
jayu_s_a28-Mar-07 22:56 
AnswerRe: Need help with NowSMS Pin
Dmitry Khudorozhkov4-Apr-07 23:05
Dmitry Khudorozhkov4-Apr-07 23:05 
QuestionMultiMedia Transport? Pin
lichongbin28-Mar-07 14:16
lichongbin28-Mar-07 14:16 
QuestionHAI Pin
jeyasingh.p27-Mar-07 4:58
jeyasingh.p27-Mar-07 4:58 
AnswerRe: HAI Pin
Dmitry Khudorozhkov4-Apr-07 23:04
Dmitry Khudorozhkov4-Apr-07 23:04 
QuestionNew article idea Pin
A*****23-Mar-07 19:24
A*****23-Mar-07 19:24 
AnswerRe: New article idea Pin
S Douglas2-Apr-07 23:04
professionalS Douglas2-Apr-07 23:04 
GeneralRe: New article idea Pin
A*****4-Apr-07 19:48
A*****4-Apr-07 19:48 
Questionhi, please send me document about test software skill and experience Pin
abiisalwayshappy21-Mar-07 18:25
abiisalwayshappy21-Mar-07 18:25 
AnswerRe: hi, please send me document about test software skill and experience Pin
Tech_spidy25-Mar-07 20:37
Tech_spidy25-Mar-07 20:37 
QuestionImage segmentatino using Genetic Algorithm Pin
GChandrashekhar21-Mar-07 1:41
GChandrashekhar21-Mar-07 1:41 
QuestionAny webpage on the sidebar Pin
joon vh.20-Mar-07 5:34
joon vh.20-Mar-07 5:34 
Questionvoice signal Pin
Tejas Patel - chosen Lion13-Mar-07 7:38
Tejas Patel - chosen Lion13-Mar-07 7:38 
AnswerRe: voice signal Pin
Dmitry Khudorozhkov16-Mar-07 4:07
Dmitry Khudorozhkov16-Mar-07 4:07 
QuestionGoogle Groups Filter / Killfile Browser Pin
Virtual Coder11-Mar-07 1:56
Virtual Coder11-Mar-07 1:56 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.