Click here to Skip to main content
15,898,222 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: Best Practices to work with databases using VB .NET Pin
Christian Graus21-Aug-07 21:48
protectorChristian Graus21-Aug-07 21:48 
GeneralRe: Best Practices to work with databases using VB .NET Pin
MartyK200721-Aug-07 22:23
MartyK200721-Aug-07 22:23 
GeneralRe: Best Practices to work with databases using VB .NET Pin
Mark Churchill22-Aug-07 0:20
Mark Churchill22-Aug-07 0:20 
GeneralRe: Best Practices to work with databases using VB .NET Pin
MartyK200722-Aug-07 0:49
MartyK200722-Aug-07 0:49 
QuestionADODB.RecordSet.RecordCount always return 0 or -1 Pin
vbDigger'z21-Aug-07 16:36
vbDigger'z21-Aug-07 16:36 
AnswerRe: ADODB.RecordSet.RecordCount always return 0 or -1 Pin
jchigg200022-Aug-07 9:04
jchigg200022-Aug-07 9:04 
GeneralRe: ADODB.RecordSet.RecordCount always return 0 or -1 Pin
vbDigger'z24-Aug-07 22:08
vbDigger'z24-Aug-07 22:08 
QuestionWebbrowser Control DrawToBitmap Pin
Ahmad Zaidi21-Aug-07 13:19
Ahmad Zaidi21-Aug-07 13:19 
Hi,

I am trying to draw a webpage to a bitmap without showing it to the user. I know the webbrowser control doesnt support the DrawToBitmap function but I found this really helpful post on codeproject that showed how to go about it. Firstly, it required the calling of the interface from MSHTML:
<interfacetype(cominterfacetype.interfaceisiunknown)> _
<guid("3050f669-98b5-11cf-bb82-00aa00bdce0b")> _
Public Interface IHTMLElementRender2
Sub DrawToDC(ByVal hdc As System.IntPtr)
Sub SetDocumentPrinter(ByVal bstrPrinterName As String, ByRef hdc As _RemotableHandle)
End Interface

and then i did the following in the document_complete event:

Dim rawDoc As IHTMLDocument2 = DirectCast(wBrowser.Document.DomDocument, IHTMLDocument2)
Dim rawBody As IHTMLElement = rawDoc.body
Dim render As IHTMLElementRender2 = DirectCast(rawBody, IHTMLElementRender2)

Dim screenCapture As New Bitmap(Me.Width, Me.Height)
Dim drawRectangle As New Rectangle(0, 0, Me.Width, Me.Height)
wBrowser.DrawToBitmap(screenCapture, drawRectangle)
Dim grap As Graphics = Graphics.FromImage(screenCapture)
Dim graphicsHdc As System.IntPtr = grap.GetHdc()
render.DrawToDC(graphicsHdc)

Now the problem. It is working fine accept for sites such as ask.com (where it shows a blank bitmap) and wikipedia.org ( where it just shows Wikipedia on the top). I have an idea as to why this is happening. I believe its cause these sites somehow donot house their content on the document body which I am painting. Any idea as to how this can be rectified?

Thanks!
Ahmad
AnswerRe: Webbrowser Control DrawToBitmap Pin
Ahmad Zaidi21-Aug-07 13:31
Ahmad Zaidi21-Aug-07 13:31 
QuestionDrawedge API call VB2005 Pin
koosvanderhurk21-Aug-07 12:31
koosvanderhurk21-Aug-07 12:31 
AnswerRe: Drawedge API call VB2005 Pin
Christian Graus21-Aug-07 12:45
protectorChristian Graus21-Aug-07 12:45 
Questiondate variable to string variable Pin
Arif Liminto21-Aug-07 12:22
professionalArif Liminto21-Aug-07 12:22 
AnswerRe: date variable to string variable Pin
Christian Graus21-Aug-07 12:45
protectorChristian Graus21-Aug-07 12:45 
AnswerRe: date variable to string variable Pin
Mark Churchill21-Aug-07 21:07
Mark Churchill21-Aug-07 21:07 
QuestionHelp how do you loop thru each record in DataGrid Pin
Smokeywade21-Aug-07 11:06
Smokeywade21-Aug-07 11:06 
AnswerRe: Help how do you loop thru each record in DataGrid Pin
Christian Graus21-Aug-07 11:18
protectorChristian Graus21-Aug-07 11:18 
GeneralRe: Help how do you loop thru each record in DataGrid Pin
Smokeywade21-Aug-07 12:12
Smokeywade21-Aug-07 12:12 
GeneralRe: Help how do you loop thru each record in DataGrid Pin
Christian Graus21-Aug-07 12:50
protectorChristian Graus21-Aug-07 12:50 
GeneralRe: Help how do you loop thru each record in DataGrid Pin
Smokeywade21-Aug-07 13:26
Smokeywade21-Aug-07 13:26 
GeneralRe: Help how do you loop thru each record in DataGrid Pin
Christian Graus21-Aug-07 13:43
protectorChristian Graus21-Aug-07 13:43 
GeneralRe: Help how do you loop thru each record in DataGrid Pin
Smokeywade22-Aug-07 3:51
Smokeywade22-Aug-07 3:51 
QuestionHo to generate *.chm file from html files Pin
Jahnson K21-Aug-07 10:38
Jahnson K21-Aug-07 10:38 
AnswerRe: Ho to generate *.chm file from html files Pin
Paul Conrad26-Aug-07 9:31
professionalPaul Conrad26-Aug-07 9:31 
AnswerRe: Ho to generate *.chm file from html files Pin
reto.knaak14-Jan-11 4:11
reto.knaak14-Jan-11 4:11 
QuestionVB.Net/ADO.NET question on populating a gridview Pin
Jordan Martz21-Aug-07 10:16
Jordan Martz21-Aug-07 10:16 

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.