i'm not exactly looking forward to moving over to VB.net to me VB6 is better but i'm just going to have to learn both
(VB6 for my own stuff/.Net for other...)
anyway my question is
VB.net removed the pset function and its a hassle to call Get/SetPixel API from .net
i had a look and found that VB.Net includes the SetPixel function within its library thats good but the problem is
it seems to only accept fixed data e.g. Color.Black, Color.White
Dim pixelColor As Color = myBitmap.GetPixel(50, 50)
I love doing per-pixel manipulation is .net going to stop me from doing this?
can i still do something like this
Dim Color1 As Long
Dim Color2 As Long
Dim Red1 As Long
Dim Green1 As Long
Dim Blue1 As Long
Dim Red2 As Long
Dim Green2 As Long
Dim Blue2 As Long
Dim X As Long
Dim Y As Long
For X = 0 To Picture1.ScaleWidth - 1
For Y = 0 To Picture1.ScaleHeight - 1
Color1 = GetPixel(Picture1.hDC, X, Y)
Color2 = GetPixel(Picture2.hDC, X, Y)
Red1 = Fix(Color1 Mod 256)
Green1 = Fix((Color1 Mod 65536) / 256)
Blue1 = Fix((Color1 Mod 16777216) / 65536)
Red2 = Fix(Color2 Mod 256)
Green2 = Fix((Color2 Mod 65536) / 256)
Blue2 = Fix((Color2 Mod 16777216) / 65536)
Red1 = (Red1 + Red2) / 2
Green1 = (Green1 + Green2) / 2
Blue1 = (Blue1 + Blue2) / 2
SetPixel Picture2.hDC, X, Y, RGB(Red1, Green1, Blue1)
Next Y
Picture2.Refresh
DoEvents
Next X
can someone show me an equivalent to that in .net? or should i just give up on .net all together
(I would like to use Dibits, However i'd like to take one step at a time :))
Question
DDStriker
i'm not exactly looking forward to moving over to VB.net to me VB6 is better but i'm just going to have to learn both
(VB6 for my own stuff/.Net for other...)
anyway my question is
VB.net removed the pset function and its a hassle to call Get/SetPixel API from .net
i had a look and found that VB.Net includes the SetPixel function within its library thats good but the problem is
it seems to only accept fixed data e.g. Color.Black, Color.White
I love doing per-pixel manipulation is .net going to stop me from doing this?
can i still do something like this
can someone show me an equivalent to that in .net? or should i just give up on .net all together
(I would like to use Dibits, However i'd like to take one step at a time :))
Link to comment
https://www.neowin.net/forum/topic/578353-vb6-to-vbnet-setpixel/Share on other sites
7 answers to this question
Recommended Posts