Visual Basic 6. Руководство разработчика

Дешево заказать проститутку. |

Динамическое изменение элементов меню - часть 2


ByVal hSrcDC As Long, ByVal x Src As Long, _

ByVal уSrc As Long, ByVal dwRop As Long) As Long

Private Declare Function DeleteDC Lib "gdi32" (ByVal hdc As Long) As Long

 

Const MF_STRING = &HO&

Const SRCCOPY = &HCC0020

Const MF_BYPOSITION - &H400&

Const MFJ3ITMAP - &H4&

 

Private Sub Exit_Click()

Unload Me

End Sub

 

Private Sub Form Load()

Call DisplayBitmapMenu

End Sub

 

Private Sub Graphics_Click()

‘ Отображение текста

If Graphics Checked Then

Graphics Checked  = False

Call DisplayTextMenu

Else

Graphics.Checked = True

Call DisplayBitmapMenu

End If

End Sub

 

Private Sub MyMenu_Click(Index As Integer)

Me CIs

Me Font Name - MyMenu(Index) Caption

Me CurrentX - (Me ScaleWidth - __

Me.TextWidth(MyMenu(Index).Caption))/2

Me CurrentY = (Me.ScaleHeight   _

Me TextHeight(MyMenu(Index) Caption))/2

Me.Print MyMenu(Index).Caption

End Sub

Private Sub DisplayTextMenu()

Dim hMenuID As Long, menuID As Long

Dim menuPos As Integer

Dim retValue As Long

‘ Получение дескриптора меню

hMenuID = GetSubMenu(GetMenu(Me.hwnd),0)

menuPos = 0

menuID - GetMenuItemID(hMenuID, menuPos)

retValue = ModifyMenu(hMenuID, menuPos, _

MF_BYPOSITION Or MF_STRING, menuID, "Verdana")

menuPos = 1

menuID = GetMenuItemID(hMenuID, menuPos)

retValue - ModifyMenu(hMenuID, menuPos,

  MF_BYPOSITION Or MF_STRING, menuID, "Serif")

menuPos - 2

menuID - GetMenuIteitiID (hMenuID, menuPos)

retValue = ModifyMenu(hMenuID, menuPos, _

MF_BYPOSITION Or MF_STRING, menuID, "Comic Sans")

End Sub

 

Private Sub DisplayBitmapMenu()

Dim Width As Integer, Height As Integer

Dim hTmpDC As Long, hMenuID As Long

Dim hBitmap As Long

Dim retValue As Long

Dim tmpID As Long

Dim fileName As String

Dim menuPos As Integer, menuID As Long

 

‘ Установка позиции меню и имени файла

menuPos - О

fileName - Арр Path & "\verdana.bmp"

Picturel Picture - LoadPicture(fileName)




Начало  Назад  Вперед



Книжный магазин