Click here to Skip to main content
15,887,135 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: How to Hide Members of Base Class Pin
nlarson1114-May-07 8:30
nlarson1114-May-07 8:30 
GeneralRe: How to Hide Members of Base Class Pin
Probeer Das15-May-07 3:21
Probeer Das15-May-07 3:21 
QuestionSetting value for resources Pin
ctlqt1214-May-07 5:45
ctlqt1214-May-07 5:45 
AnswerRe: Setting value for resources Pin
Dave Kreskowiak14-May-07 8:36
mveDave Kreskowiak14-May-07 8:36 
QuestionStretchBlt to a PictureBox ? Pin
Beginner_HC14-May-07 4:24
Beginner_HC14-May-07 4:24 
AnswerRe: StretchBlt to a PictureBox ? Pin
Dave Kreskowiak14-May-07 4:43
mveDave Kreskowiak14-May-07 4:43 
GeneralRe: StretchBlt to a PictureBox ? Pin
Beginner_HC14-May-07 5:34
Beginner_HC14-May-07 5:34 
GeneralRe: StretchBlt to a PictureBox ? Pin
Dave Kreskowiak14-May-07 8:34
mveDave Kreskowiak14-May-07 8:34 
For a beginner, you're tackling a pretty complex subject with Win32/GDI...

OK... It's a real pain, but here goes. Of course, you have to have the Declares for StretchBlt, SelectObject, DeleteObject, and DeleteDC created to use this...
Private Sub CreateMagnifiedImage(ByVal MagFactor As Integer, ByVal srcBitmap As Bitmap) As Bitmap
    If srcBitmap IsNot Nothing Then
    Dim magSize As New Size(srcBitmap.Width * MagFactor, srcBitmap.Height * MagFactor)
    Dim magBitmap As New Bitmap(magSize.Width, magSize.Height)
 
    Dim g As Graphics = Graphics.FromImage(magBitmap)
    DrawMagnifiedImage(g, srcBitmap, magSize)
    g.Dispose()
    End If
End Sub
 
' This is the code Ive used before to magnifiy an image...
Private Sub DrawMagnifiedImage(ByVal gTarget As Graphics, ByVal srcBitmap As Bitmap, ByVal newSize As Size)
    Dim hBmp as IntPtr = srcBitmap.GetHbitmap()
    Dim hdcTarget As IntPtr = gTarget.GetHdc()
    Dim hdcSource As IntPtr = CreateCompatibleDC(hdcTarget)
    Dim hOrig As IntPtr = SelectObject(hdcSrc, hBmp)
    StretchBlt(hdcTarget, 0, 0, newSize.Width, newSize.Height, hdcSource, 0, 0, srcBitmap.Wdith, srcBitmap.Height, TernaryRasterOperations.SRCCOPY)
    SelectObject(hdcSource, hOrig)
    DeleteObject(hBmp)
    DeleteDC(hdcSource)
    gTarget.Release(hdcTarget)
End Sub





A guide to posting questions on CodeProject[^]

Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


GeneralRe: StretchBlt to a PictureBox ? Pin
Beginner_HC15-May-07 8:51
Beginner_HC15-May-07 8:51 
QuestionOOPS Pin
Rafeeque Ahmed14-May-07 4:03
Rafeeque Ahmed14-May-07 4:03 
AnswerRe: OOPS Pin
Dave Kreskowiak14-May-07 4:37
mveDave Kreskowiak14-May-07 4:37 
GeneralRe: OOPS Pin
leckey14-May-07 9:26
leckey14-May-07 9:26 
GeneralRe: OOPS Pin
Dave Kreskowiak14-May-07 9:48
mveDave Kreskowiak14-May-07 9:48 
GeneralRe: OOPS Pin
Paul Conrad14-May-07 9:54
professionalPaul Conrad14-May-07 9:54 
GeneralRe: OOPS Pin
leckey14-May-07 10:32
leckey14-May-07 10:32 
GeneralRe: OOPS Pin
Rafeeque Ahmed14-May-07 19:32
Rafeeque Ahmed14-May-07 19:32 
GeneralRe: OOPS Pin
Dave Kreskowiak15-May-07 12:48
mveDave Kreskowiak15-May-07 12:48 
GeneralRe: OOPS Pin
Rafeeque Ahmed15-May-07 19:59
Rafeeque Ahmed15-May-07 19:59 
GeneralRe: OOPS Pin
Dave Kreskowiak16-May-07 13:24
mveDave Kreskowiak16-May-07 13:24 
Questionapplication slow Pin
Rafeeque Ahmed14-May-07 4:02
Rafeeque Ahmed14-May-07 4:02 
AnswerRe: application slow Pin
Dave Kreskowiak14-May-07 4:35
mveDave Kreskowiak14-May-07 4:35 
AnswerRe: application slow Pin
Paul Conrad14-May-07 6:28
professionalPaul Conrad14-May-07 6:28 
QuestionWebbrowser Reporting from VB Pin
Kumaran21cen14-May-07 3:32
Kumaran21cen14-May-07 3:32 
QuestionLoad a text file with enters, spaces etc. Pin
Zaegra14-May-07 3:25
Zaegra14-May-07 3:25 
AnswerRe: Load a text file with enters, spaces etc. [modified] Pin
Kumaran21cen14-May-07 4:14
Kumaran21cen14-May-07 4:14 

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.