{"id":1324,"date":"2024-08-06T08:00:00","date_gmt":"2024-08-06T00:00:00","guid":{"rendered":"http:\/\/www.wyrcad.com\/?p=1324"},"modified":"2024-07-18T08:40:17","modified_gmt":"2024-07-18T00:40:17","slug":"%e4%b8%ba%e8%8f%9c%e5%8d%95%e6%b7%bb%e5%8a%a0%e5%9b%be%e7%89%87","status":"publish","type":"post","link":"https:\/\/www.wyrcad.com\/?p=1324","title":{"rendered":"\u4e3a\u83dc\u5355\u8bbe\u7f6e\u56fe\u7247"},"content":{"rendered":"\n<p>Option Explicit<br>Private Declare Function GetMenu Lib &#8220;user32&#8221; (ByVal hwnd As Long) As Long<br>Private Declare Function GetSubMenu Lib &#8220;user32&#8221; (ByVal hMenu As Long, ByVal nPos As Long) As Long<br>Private Declare Function GetMenuItemID Lib &#8220;user32&#8221; (ByVal hMenu As Long, ByVal nPos As Long) As Long<br>Private Declare Function ModifyMenu Lib &#8220;user32&#8221; Alias &#8220;ModifyMenuA&#8221; (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal wIDNewItem As Long, ByVal lpString As String) As Long<br>Private Declare Function SetMenuItemBitmaps Lib &#8220;user32&#8221; (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long, ByVal hBitmapUnchecked As Long, ByVal hBitmapChecked As Long) As Long<br>Private Declare Function GetMenuCheckMarkDimensions Lib &#8220;user32&#8221; () As Long<\/p>\n\n\n\n<p>&#8216;Example:<br>&#8216;\u4e3a\u5f53\u524d\u7a97\u4f53\u7684\u7b2c 2 \u7ec4\u83dc\u5355\u7684\u7b2c 2 \u9879\u83dc\u5355\u8bbe\u7f6e imgMenu(0) \u4e2d\u7684\u56fe\u7247<br>&#8216;Call SetMenuPicture(Me, 2, 3, imgMenu(0))<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"666\" height=\"488\" src=\"https:\/\/www.wyrcad.com\/wp-content\/uploads\/2024\/07\/Menu.jpg\" alt=\"\" class=\"wp-image-1327\" srcset=\"https:\/\/www.wyrcad.com\/wp-content\/uploads\/2024\/07\/Menu.jpg 666w, https:\/\/www.wyrcad.com\/wp-content\/uploads\/2024\/07\/Menu-300x220.jpg 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/figure>\n\n\n\n<p>Public Sub SetMenuPicture(ByVal oForm As Form, ByVal iMenu As Integer, ByVal iSubMenu As Integer, ByVal oImage As Image)<br>On Error Resume Next<br>Dim lMenu As Long, lSubMenu As Long, lMenuID As Long<br>lMenu = GetMenu(oForm.hwnd)<br>lSubMenu = GetSubMenu(lMenu, iMenu)<br>lMenuID = GetMenuItemID(lSubMenu, iSubMenu)<br>lRet = SetMenuItemBitmaps(lMenu, lMenuID, 0, oImage.Picture, 0&amp;)<br>On Error GoTo 0<br>End Sub<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Option ExplicitPrivate Declare Function GetMenu Lib &#038;#8 &hellip; <a href=\"https:\/\/www.wyrcad.com\/?p=1324\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">\u201c\u4e3a\u83dc\u5355\u8bbe\u7f6e\u56fe\u7247\u201d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[12],"tags":[24,17],"class_list":["post-1324","post","type-post","status-publish","format-standard","hentry","category-bianchengyuandi","tag-vb","tag-biancheng"],"_links":{"self":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts\/1324","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1324"}],"version-history":[{"count":3,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts\/1324\/revisions"}],"predecessor-version":[{"id":1328,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=\/wp\/v2\/posts\/1324\/revisions\/1328"}],"wp:attachment":[{"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1324"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1324"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wyrcad.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1324"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}