Click here to Skip to main content
14,209,923 members

Visual Basic

 
PinnedHOW TO ANSWER A QUESTION PinPopular
Chris Maunder12-Jul-09 22:40
adminChris Maunder12-Jul-09 22:40 
PinnedHow to get an answer to your question PinPopular
Chris Maunder10-Nov-05 16:30
adminChris Maunder10-Nov-05 16:30 
QuestionProblem cropping an image. SOLVED Pin
speedbump998-Jun-19 6:07
memberspeedbump998-Jun-19 6:07 
AnswerRe: Problem cropping an image. more info Pin
speedbump998-Jun-19 9:46
memberspeedbump998-Jun-19 9:46 
After further testing I have found this.
It looks like the data return by LockBits() for the source image is not correct.
Below is a portion of data I dumped for Scan0 returned from LockBits().
The test image is 38 x 38 pixels with a single pixel vertical line in column 0.
It was generated in Paint and saved as .jpg.
The Scan0 data shown below shows that the output is being shifted right which is
what the resulting image shows.
Is this some quirk with LockBits() and 24bbp?
Also, I'm still on Windows 7.
Thanks.

Dim bmSrc As Bitmap = Me.Image.Clone() ' The PictureBox image
Dim rect As New Rectangle(0, 0, bmSrc.Width, bmSrc.Height)
Dim _BMPData As Imaging.BitmapData = bmSrc.LockBits(rect, System.Drawing.Imaging.ImageLockMode.ReadWrite, bmSrc.PixelFormat)
' bmSrc.PixelFormat = Format24bppRgb {137224}

Dim _BMPPtr As IntPtr = _BMPData.Scan0

Dump:
This is the first 2 pixels of col 0 , scanline 0
index(0) - 0 - Col 0 Black
index(1) - 0
index(2) - 0
index(3) - 255 - Col 1 White
index(4) - 255
index(5) - 255

index(x) = 255 from here to next scanline.

This is the first 2 pixels at col 0, scanline 1;
pixel 38 * 3 = 114
index(114) - 0 - Col 0
index(115) - 0
index(116) - 0
index(117) - 0 - Col 1 should be 255
index(118) - 0 - ditto
index(119) - 255

index(x) = 255 from here to next scanline.

This is the first 3 pixels of col 0, scanline 2;
pixel 76 * 3 = 228
index(228) - 255 - Col 0 should be 0
index(229) - 255 - ditto
index(230) - 0
index(231) - 0 - Col 1 should be 255
index(232) - 0 - ditto
index(233) - 0 - ditto
index(234) - 0 - ditto
index(235) - 255
index(236) - 255
GeneralRe: Problem cropping an image. more info Pin
Dave Kreskowiak8-Jun-19 16:29
mveDave Kreskowiak8-Jun-19 16:29 
GeneralRe: Problem cropping an image. more info Pin
speedbump998-Jun-19 23:34
memberspeedbump998-Jun-19 23:34 
AnswerRe: Problem cropping an image. Pin
Gerry Schmitz8-Jun-19 12:05
mveGerry Schmitz8-Jun-19 12:05 
QuestionHow using reflection invoke when method wants a specific object type Pin
Member 85736427-Jun-19 4:45
memberMember 85736427-Jun-19 4:45 
AnswerRe: How using reflection invoke when method wants a specific object type Pin
Richard Deeming7-Jun-19 4:53
mveRichard Deeming7-Jun-19 4:53 
GeneralRe: How using reflection invoke when method wants a specific object type Pin
Member 85736427-Jun-19 7:07
memberMember 85736427-Jun-19 7:07 
QuestionHow to change txt color in MessageBox with API Pin
MasterGamerFX30-May-19 23:44
memberMasterGamerFX30-May-19 23:44 
AnswerRe: How to change txt color in MessageBox with API Pin
Richard Deeming31-May-19 0:46
mveRichard Deeming31-May-19 0:46 
QuestionHow to clear a bindingsource without deleting from database Pin
desanti30-May-19 3:47
memberdesanti30-May-19 3:47 
AnswerRe: How to clear a bindingsource without deleting from database Pin
Richard MacCutchan30-May-19 4:01
protectorRichard MacCutchan30-May-19 4:01 
GeneralRe: How to clear a bindingsource without deleting from database Pin
desanti30-May-19 6:58
memberdesanti30-May-19 6:58 
GeneralRe: How to clear a bindingsource without deleting from database Pin
Richard MacCutchan30-May-19 7:01
protectorRichard MacCutchan30-May-19 7:01 
GeneralRe: How to clear a bindingsource without deleting from database Pin
desanti30-May-19 8:56
memberdesanti30-May-19 8:56 
GeneralRe: How to clear a bindingsource without deleting from database Pin
Richard MacCutchan30-May-19 21:44
protectorRichard MacCutchan30-May-19 21:44 
AnswerRe: How to clear a bindingsource without deleting from database Pin
Gerry Schmitz31-May-19 5:53
mveGerry Schmitz31-May-19 5:53 
QuestionVisual Basic : Entity Framework update only one table in model from database Pin
desanti30-May-19 2:20
memberdesanti30-May-19 2:20 
QuestionListView DrawItem() e.Bounds gives different Height when item is selected. SOLVED. Pin
speedbump9928-May-19 2:54
memberspeedbump9928-May-19 2:54 
AnswerRe: ListView DrawItem() e.Bounds gives different Height when item is selected. Pin
Richard MacCutchan28-May-19 6:20
protectorRichard MacCutchan28-May-19 6:20 
GeneralRe: ListView DrawItem() e.Bounds gives different Height when item is selected. Pin
speedbump9928-May-19 6:24
memberspeedbump9928-May-19 6:24 
Questionvb.net and Excel ribbon Pin
JR21218-May-19 21:07
memberJR21218-May-19 21:07 
AnswerRe: vb.net and Excel ribbon Pin
JR21210-Jun-19 10:51
memberJR21210-Jun-19 10:51 

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.


Advertise | Privacy | Cookies | Terms of Service
Web06 | 2.8.190617.3 | Last Updated 10 Jun 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid