چطوری می شه دکمه های توی msg box رو تغییر داد مثلا فارسی کرد؟
Printable View
چطوری می شه دکمه های توی msg box رو تغییر داد مثلا فارسی کرد؟
سلام
بايد براشس كنترل بنويسي يه OCX
کنترل هایی تو این سایت هست اگه بگردی میتونی پیدا کنی...
سلام
بفرمایید
این هم چیز جالبیه ، تقریبا شبیه مسیج باکس خود دات نت هستش ، با آیکن های قشنگ .
من خودم تو همه پروژه هام از این استفاده میکنم.
اینم یک نمونه دیگه که خودم نوشتم و تو برنامم استفاده کردم شما هم میتونی برای خودت بنویسید
Imports System
Imports System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Text
PublicDelegateFunction CallBack_WinProc(ByVal uMsg AsInteger, ByVal wParam AsInteger, ByVal lParam AsInteger) AsInteger
PublicDelegateFunction CallBack_EnumWinProc(ByVal hWnd AsInteger, ByVal lParam AsInteger) AsInteger
PublicClass CMessageBox
<DllImport("user32.dll")> _
PublicSharedFunction GetWindowLong(ByVal hwnd AsInteger, ByVal nIndex AsInteger) AsInteger
EndFunction
<DllImport("kernel32.dll")> _
PublicSharedFunction GetCurrentThreadId() AsInteger
EndFunction
<DllImport("user32.dll")> _
PublicSharedFunction SetWindowsHookEx(ByVal idHook AsInteger, ByVal lpfn As CallBack_WinProc, ByVal hmod AsInteger, ByVal dwThreadId AsInteger) AsInteger
EndFunction
<DllImport("user32.dll")> _
PublicSharedFunction UnhookWindowsHookEx(ByVal hHook AsInteger) AsInteger
EndFunction
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
PublicSharedFunction SetWindowText(ByVal hwnd AsInteger, ByVal lpString AsString) AsInteger
EndFunction
<DllImport("user32.dll")> _
PublicSharedFunction EnumChildWindows(ByVal hWndParent AsInteger, ByVal lpEnumFunc As CallBack_EnumWinProc, ByVal lParam AsInteger) AsInteger
EndFunction
<DllImport("user32.dll")> _
PublicSharedFunction GetClassName(ByVal hwnd AsInteger, ByVal lpClassName As StringBuilder, ByVal nMaxCount AsInteger) AsInteger
EndFunction
Dim TopCount AsInteger
Dim ButtonCount AsInteger
PrivateConst GWL_HINSTANCE AsInteger = (-6)
PrivateConst HCBT_ACTIVATE AsInteger = 5
PrivateConst WH_CBT AsInteger = 5
Private hHook AsInteger
Dim strCaption1 AsString
Dim strCaption2 AsString
Dim strCaption3 AsString
PublicFunction ShowMessage(ByVal hParent AsInteger, ByVal Prompt AsString, ByVal Title AsString, ByVal Caption1 AsString, ByVal Caption2 AsString, ByVal Caption3 AsString, ByVal buttons As MessageBoxButtons, ByVal icon As MessageBoxIcon, ByVal DefaultButton As MessageBoxDefaultButton, ByVal options As MessageBoxOptions) As DialogResult
Dim hInst AsInteger
Dim Thread AsInteger
TopCount = 0
ButtonCount = 0
strCaption1 = Caption1
strCaption2 = Caption2
strCaption3 = Caption3
If Title = ""Then Title = Application.ProductName
Dim myWndProc As CallBack_WinProc = New CallBack_WinProc(AddressOf WinProc)
hInst = GetWindowLong(hParent, GWL_HINSTANCE)
Thread = GetCurrentThreadId()
hHook = SetWindowsHookEx(WH_CBT, myWndProc, hInst, Thread)
Return MessageBox.Show(Prompt, Title, buttons, icon, DefaultButton, options)
EndFunction
PrivateFunction WinProc(ByVal uMsg AsInteger, ByVal wParam AsInteger, ByVal lParam AsInteger) AsInteger
Dim myEnumProc As CallBack_EnumWinProc = New CallBack_EnumWinProc(AddressOf EnumWinProc)
If uMsg = HCBT_ACTIVATE Then
EnumChildWindows(wParam, myEnumProc, 0)
UnhookWindowsHookEx(hHook)
EndIf
Return 0
EndFunction
PrivateFunction EnumWinProc(ByVal hWnd AsInteger, ByVal lParam AsInteger) AsInteger
Dim strBuffer As StringBuilder = New StringBuilder(256)
TopCount += 1
GetClassName(hWnd, strBuffer, strBuffer.Capacity)
Dim ss AsString = strBuffer.ToString()
If (ss.ToUpper().StartsWith("BUTTON")) Then
ButtonCount += 1
SelectCase ButtonCount
Case 1
SetWindowText(hWnd, strCaption1)
ExitSelect
Case 2
SetWindowText(hWnd, strCaption2)
ExitSelect
Case 3
SetWindowText(hWnd, strCaption3)
ExitSelect
EndSelect
EndIf
Return 1
EndFunction
EndClass
تاپيك رو ببند!
این تاپیک رو ببینید
فکر کنم یک مثال هم توش باشه
این هم نحوه استفاده اش
Imports hekmat.Dialogs
Module myMsg
Dim mss As New MsgDialogs
#Region "MESSAGE"
Public Function MsgBox(ByVal Prompt As String) As MsgBoxResult
Return mss.Msgbox(Prompt)
End Function
Public Function MsgBox(ByVal Prompt As String, ByVal style As MsgBoxStyle) As MsgBoxResult
Return mss.Msgbox(Prompt, style + MsgBoxStyle.MsgBoxRtlReading + MsgBoxStyle.MsgBoxRight)
End Function
Public Function MsgBox(ByVal Prompt As String, ByVal style As MsgBoxStyle, ByVal Title As String) As MsgBoxResult
Return mss.Msgbox(Prompt, style + 1048576 + 524288, Title)
End Function
#End Region
#Region "Input"
Public Function InputBox(ByVal Prompt As String) As String
Return mss.Inputbox(Prompt)
End Function
Public Function InputBox(ByVal Prompt As String, ByVal Title As String) As String
Return mss.Inputbox(Prompt, Title)
End Function
Public Function InputBox(ByVal Prompt As String, ByVal Title As String, ByVal DefualtStr As String) As String
Return mss.Inputbox(Prompt, Title, DefualtStr)
End Function