为了提高操作者的操作效率,不想麻烦操作者每次都在对话框中选一次显示方式
4 个解决方案
#1
想法真不错,就是不知道该怎么实现。期待大神出现。
#2
我记得有过类似的问题,当时应该是 dkfdtf 版主给了答案。
我也收藏了代码,不过在我的笔记本中,等有时间我找出来帖给你。
我也收藏了代码,不过在我的笔记本中,等有时间我找出来帖给你。
#3
坐等十豆三老师高见。
#4
详细参考 dkfdtf 版主的 Blog:
http://blog.csdn.net/dkfdtf/article/details/3058598
#Define WM_COMMAND 0x0111
#Define WM_TIMER 0x0113
#Define TIMER_ID 100
#Define SHVIEW_THUMBNAIL 0x702D
#Define SHVIEW_TILE 0x702E
#Define SHVIEW_ICON 0x7029
#Define SHVIEW_LIST 0x702B
#Define SHVIEW_REPORT 0x702C
Public oForm
oForm = Newobject( 'MyForm' )
oForm.Show()
Read Events
Define Class MyForm As Form
Height = 78
Width = 293
DoCreate = .T.
AutoCenter = .T.
Caption = "Form1"
AllowOutput = .F.
Name = "Form1"
InitViewStyle = SHVIEW_THUMBNAIL && 你只要修改这里就可以指定缺省的打开时样式
Add Object command1 As CommandButton With ;
Top = 24, ;
Left = 180, ;
Height = 27, ;
Width = 84, ;
Caption = "打开图片", ;
Name = "command1"
Procedure ToggleViewStyle
Lparameters p1, p2, p3, p4
Local hWndLvw
m.hWndLvw = This.FindListViewWindow()
If ( 0 != m.hWndLvw )
KillTimer( This.HWnd, TIMER_ID )
SendMessage( m.hWndLvw, WM_COMMAND, This.InitViewStyle, 0 )
Endif
Endproc
Procedure FindListViewWindow
Local hWndDlg, hWndLvw
m.hWndLvw = 0
m.hWndDlg = FindWindow( '#32770', This.dlg.DialogTitle )
If ( 0 != m.hWndDlg )
m.hWndLvw = FindWindowEx( m.hWndDlg, 0, 'SHELLDLL_DefView', Null )
Endif
Return m.hWndLvw
Endproc
Procedure api_decl
Declare Long SetTimer In WIN32API ;
Long HWnd, Long nIDEvent, Long uElapse, Long lpTimerFunc
Declare Long KillTimer In WIN32API ;
Long HWnd, Long uIDEvent
Declare Long FindWindow In WIN32API ;
String lpClassName, String lpWindowName
Declare Long FindWindowEx In WIN32API ;
Long hwndParent, Long hwndChildAfter, String lpszClass, String lpszWindow
Declare Long SendMessage In WIN32API ;
Long HWnd, Long nMsg, Long wParams, Long lParams
Endproc
Procedure GetPictureFile
This.api_decl()
Bindevent( This.HWnd, WM_TIMER, This, 'ToggleViewStyle' )
SetTimer( This.HWnd, TIMER_ID, 50, 0 )
This.dlg.FileName = ''
This.dlg.ShowOpen()
Unbindevent( This.HWnd, WM_TIMER )
Return This.dlg.FileName
Endproc
Procedure Init
This.Newobject( 'dlg', 'olecontrol',,, 'MSComDlg.CommonDialog' )
This.dlg.DialogTitle = '请选择要打开的图片文件'
Endproc
Procedure Unload
Clear Events
Endproc
Procedure command1.Click
Messagebox( Thisform.GetPictureFile() )
Endproc
Enddefine
#1
想法真不错,就是不知道该怎么实现。期待大神出现。
#2
我记得有过类似的问题,当时应该是 dkfdtf 版主给了答案。
我也收藏了代码,不过在我的笔记本中,等有时间我找出来帖给你。
我也收藏了代码,不过在我的笔记本中,等有时间我找出来帖给你。
#3
坐等十豆三老师高见。
#4
详细参考 dkfdtf 版主的 Blog:
http://blog.csdn.net/dkfdtf/article/details/3058598
#Define WM_COMMAND 0x0111
#Define WM_TIMER 0x0113
#Define TIMER_ID 100
#Define SHVIEW_THUMBNAIL 0x702D
#Define SHVIEW_TILE 0x702E
#Define SHVIEW_ICON 0x7029
#Define SHVIEW_LIST 0x702B
#Define SHVIEW_REPORT 0x702C
Public oForm
oForm = Newobject( 'MyForm' )
oForm.Show()
Read Events
Define Class MyForm As Form
Height = 78
Width = 293
DoCreate = .T.
AutoCenter = .T.
Caption = "Form1"
AllowOutput = .F.
Name = "Form1"
InitViewStyle = SHVIEW_THUMBNAIL && 你只要修改这里就可以指定缺省的打开时样式
Add Object command1 As CommandButton With ;
Top = 24, ;
Left = 180, ;
Height = 27, ;
Width = 84, ;
Caption = "打开图片", ;
Name = "command1"
Procedure ToggleViewStyle
Lparameters p1, p2, p3, p4
Local hWndLvw
m.hWndLvw = This.FindListViewWindow()
If ( 0 != m.hWndLvw )
KillTimer( This.HWnd, TIMER_ID )
SendMessage( m.hWndLvw, WM_COMMAND, This.InitViewStyle, 0 )
Endif
Endproc
Procedure FindListViewWindow
Local hWndDlg, hWndLvw
m.hWndLvw = 0
m.hWndDlg = FindWindow( '#32770', This.dlg.DialogTitle )
If ( 0 != m.hWndDlg )
m.hWndLvw = FindWindowEx( m.hWndDlg, 0, 'SHELLDLL_DefView', Null )
Endif
Return m.hWndLvw
Endproc
Procedure api_decl
Declare Long SetTimer In WIN32API ;
Long HWnd, Long nIDEvent, Long uElapse, Long lpTimerFunc
Declare Long KillTimer In WIN32API ;
Long HWnd, Long uIDEvent
Declare Long FindWindow In WIN32API ;
String lpClassName, String lpWindowName
Declare Long FindWindowEx In WIN32API ;
Long hwndParent, Long hwndChildAfter, String lpszClass, String lpszWindow
Declare Long SendMessage In WIN32API ;
Long HWnd, Long nMsg, Long wParams, Long lParams
Endproc
Procedure GetPictureFile
This.api_decl()
Bindevent( This.HWnd, WM_TIMER, This, 'ToggleViewStyle' )
SetTimer( This.HWnd, TIMER_ID, 50, 0 )
This.dlg.FileName = ''
This.dlg.ShowOpen()
Unbindevent( This.HWnd, WM_TIMER )
Return This.dlg.FileName
Endproc
Procedure Init
This.Newobject( 'dlg', 'olecontrol',,, 'MSComDlg.CommonDialog' )
This.dlg.DialogTitle = '请选择要打开的图片文件'
Endproc
Procedure Unload
Clear Events
Endproc
Procedure command1.Click
Messagebox( Thisform.GetPictureFile() )
Endproc
Enddefine