for x=1 to 200
for y=1 to 200
pset (x,y), m(x,y)
next y,x
Эта процедура длится около секунды, что очень долго, посоветуйте плз как это сделать максимально быстро (не дольше ,02 секунды)
GSerg писал(а):Тогда при второй попытке стоит задействовать мозг и обратить внимание на текст, представляющий ссылку...
Private Const DIB_RGB_COLORS = 0
Private Type BITMAPINFOHEADER
biSize As Long
biWidth As Long
biHeight As Long
biPlanes As Integer
biBitCount As Integer
biCompression As Long
biSizeImage As Long
biXPelsPerMeter As Long
biYPelsPerMeter As Long
biClrUsed As Long
biClrImportant As Long
End Type
Private Type RGBQUAD
rgbBlue As Byte
rgbGreen As Byte
rgbRed As Byte
rgbReserved As Byte
End Type
Private Type BITMAPINFO
bmiHeader As BITMAPINFOHEADER
bmiColors As RGBQUAD
End Type
Private Type RGB_Col
B As Byte
G As Byte
R As Byte
End Type
Private Declare Function SetDIBitsToDevice Lib "gdi32" _
(ByVal hdc As Long, _
ByVal x As Long, _
ByVal y As Long, _
ByVal dx As Long, _
ByVal dy As Long, _
ByVal SrcX As Long, _
ByVal SrcY As Long, _
ByVal Scan As Long, _
ByVal NumScans As Long, _
Bits As Any, _
BitsInfo As BITMAPINFO, _
ByVal wUsage As Long) As Long
Dim R As Integer
Private Sub Form_Load()
Dim bi24BitInfo As BITMAPINFO, bBytes() As RGB_Col
With bi24BitInfo.bmiHeader
.biBitCount = 24
.biCompression = BI_RGB
.biPlanes = 1
.biSize = Len(bi24BitInfo.bmiHeader)
.biWidth = 200
.biHeight = 200
End With
ReDim bBytes(1 To bi24BitInfo.bmiHeader.biWidth, _
1 To bi24BitInfo.bmiHeader.biHeight) As RGB_Col
For x = 1 To bi24BitInfo.bmiHeader.biWidth
For y = 1 To bi24BitInfo.bmiHeader.biHeight
bBytes(x, y).R = x
bBytes(x, y).G = (x + y) \ 2
bBytes(x, y).B = y
Next
Next
Me.Show
Do Until R <> 0
SetDIBitsToDevice Me.hdc, 0, 0, bi24BitInfo.bmiHeader.biWidth, _
bi24BitInfo.bmiHeader.biHeight, 0, _
0, 0, bi24BitInfo.bmiHeader.biHeight, _
bBytes(1, 1), bi24BitInfo, DIB_RGB_COLORS
DoEvents
Loop
End Sub
Сейчас этот форум просматривают: Google-бот, Yandex-бот и гости: 104