Открытие ComboBox при помощи API Windows
Чтение рисунка из файла ресурсов типа Custom Resource
Воспроизведение звука из ресурсов
Градиентная заливка PictureBox
Открытие ComboBox при помощи API Windows
Private Declare Function SendMessage
Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As
Long, ByVal wParam As Long, lParam As Long) As Long
Const CB_SHOWDROPDOWN = &H14F
Private Sub Combo1_GotFocus()
Dim Tmp
Tmp = SendMessage(Combo1.hwnd, CB_SHOWDROPDOWN, 1,
ByVal 0&)
End Sub
Чтение рисунка из файла ресурсов типа Custom Resource
Const tmpSplash = "C:\Temp\tmpB0.tmp" '
Путь к временным файлам
Private Sub Form_Load()
Dim tmpStr As String
' Картинка
tmpStr = StrConv(LoadResData(16, "BMP"), vbUnicode)
Open tmpSplash For Output As #1
Print #1, tmpStr
Close #1
Me.Picture = LoadPicture(tmpSplash)
tmpStr=vbNullString
' Звук
Open tmpPaddleHit For Output As #1
SoundBuffer = StrConv(LoadResData(wavPaddleHit,
"ZRICKS_SOUND"), vbUnicode)
Print #1, SoundBuffer
Close #1
SoundBuffer = ""
' Удаление временных файлов при выходе
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Error Resume Next
For i = 0 To 5
Kill App.Path & "\" &
"tmpB" & i & ".tmp"
Next i
For i = 1 To 7
Kill "~TMP000" & i
Next i
End Sub
Воспроизведение звука из ресурсов
'== значения флагов для
параметра wFlagsr ============
Public Const SND_SYNC = &H0 ' синхронно (по умолчанию)
Public Const SND_ASYNC = &H1 ' асинхронно
Public Const SND_NODEFAULT = &H2 ' не использовать звук по
умолчанию
Public Const SND_MEMORY = &H4 ' lpszSoundName
Public Const SND_LOOP = &H8 ' играть до следующего вызова
sndPlaySound
Public Const SND_NOSTOP = &H10 ' не останавливать при вызове
другого sndPlaySound
Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA"
(ByVal SoundData As Any, ByVal uFlags As Long) As Long
Public Sub BeginPlaySound(ResourceId As Long)
Dim sndBuff As String
sndBuff = StrConv(LoadResData(ResourceId, "WAVE"), vbUnicode)
Call sndPlaySound(sndBuff, SND_SYNC Or SND_MEMORY)
End Sub
Sub EndPlaySound()
Dim Ret As Variant
Ret = sndPlaySound(0&, 0&)
End Sub
Private Sub Form_Load()
Dim intX As Integer
Dim intY As Integer
Dim sngWidth As Single
Dim sngHeight As Single
sngWidth = Image1.Width
sngHeight = Image1.Height
For intX = 0 To Int(ScaleWidth / sngWidth)
For intY = 0 To Int(ScaleHeight / sngHeight)
PaintPicture
Image1.Picture, intX * sngWidth, intY * sngHeight, sngWidth, sngHeight, 0, 0
Next
Next
End Sub
Градиентная заливка PictureBox
' КОД НУЖНО ПОМЕСТИТЬ В РАЗДЕЛ
ФОРМЫ
' И ДОБАВИТЬ НА ФОРМУ PictureBox и CommandButton
Option Explicit
' горизонтальная заливка
Const GRADIENT_FILL_RECT_H As Long = &H0
' вертикальная заливка
Const GRADIENT_FILL_RECT_V As Long = &H1
Private Declare Function GradientFill Lib "msimg32" (ByVal hdc As Long, pVertex
As TRIVERTEX, ByVal dwNumVertex As Long, pMesh As GRADIENT_RECT, ByVal dwNumMesh As Long,
ByVal dwMode As Long) As Long
Private Type TRIVERTEX
x As Long
y As Long
Red As Integer
Green As Integer
Blue As Integer
Alpha As Integer
End Type
Private Type GRADIENT_RECT
UpperLeft As Long
LowerRight As Long
End Type
Private Sub Command1_Click()
Picture1.ScaleMode = vbPixels
Dim pVert(1) As TRIVERTEX
Dim rec As GRADIENT_RECT
' первая точка
' координаты (0,0)
' цвет - чисто-красный (каждый цвет задаётся в
пределах
' от &H0000 до &HFF00)
pVert(0).x = 0&
pVert(0).y = 0&
pVert(0).Alpha = 0&
pVert(0).Red = &HFF00
pVert(0).Green = 0&
pVert(0).Blue = 0&
' вторая точка
pVert(1).x = Picture1.ScaleWidth
pVert(1).y = Picture1.ScaleHeight
pVert(1).Alpha = 0&
pVert(1).Red = &HFF00
pVert(1).Green = &HFF00
pVert(1).Blue = &HFF00
' массив с начальной и конечной точкой
rec.UpperLeft = 0
rec.UpperLeft = 1
' делаем вертикальный градиет в PictureBox'е
GradientFill Picture1.hdc, pVert(0), 2, rec, 1, GRADIENT_FILL_RECT_V
End Sub
invest in crypto https://oxly.io/
Заказ листов монолитного поликарбоната. Монолитный и сотовый поликарбонат .