-
Notifications
You must be signed in to change notification settings - Fork 1
/
frmRequest.frm
331 lines (312 loc) · 9.99 KB
/
frmRequest.frm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
VERSION 5.00
Begin VB.Form frmRequest
AutoRedraw = -1 'True
BorderStyle = 1 'Fixed Single
Caption = "请求"
ClientHeight = 2475
ClientLeft = 2760
ClientTop = 3750
ClientWidth = 4395
Icon = "frmRequest.frx":0000
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
NegotiateMenus = 0 'False
ScaleHeight = 2475
ScaleWidth = 4395
StartUpPosition = 2 '屏幕中心
Begin Othello.FlatButton fltbtnAgree
Height = 375
Left = 90
TabIndex = 3
Top = 2115
Visible = 0 'False
Width = 1005
_ExtentX = 1773
_ExtentY = 661
Caption = "同意请求"
MousePointer = 99
Style = 2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
EnableHot = -1 'True
ForeColor = 0
End
Begin Othello.FlatButton fltbtnSend
Default = -1 'True
Height = 375
Left = 2055
TabIndex = 1
Top = 1965
Visible = 0 'False
Width = 1005
_ExtentX = 1773
_ExtentY = 661
Caption = "送出请求"
MousePointer = 99
Style = 2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
EnableHot = -1 'True
ForeColor = 0
End
Begin VB.TextBox txtMessage
Height = 300
Left = 105
MaxLength = 50
TabIndex = 0
Top = 1410
Width = 4215
End
Begin VB.Frame fraPartner
Caption = "对方"
Height = 915
Left = 75
TabIndex = 8
Top = 45
Width = 4260
Begin VB.PictureBox picFace
AutoRedraw = -1 'True
Height = 540
Left = 195
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 5
TabStop = 0 'False
Top = 225
Width = 540
End
Begin Othello.FlatButton fltbtnView
Height = 315
Left = 3180
TabIndex = 7
Top = 495
Width = 885
_ExtentX = 1561
_ExtentY = 556
Caption = "查看"
MousePointer = 99
Style = 2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
EnableHot = -1 'True
ForeColor = 0
End
Begin VB.TextBox txtUserName
BackColor = &H8000000F&
Height = 285
Left = 900
Locked = -1 'True
TabIndex = 6
TabStop = 0 'False
Top = 510
Width = 2070
End
Begin VB.Label Label1
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "名字:"
Height = 180
Left = 930
TabIndex = 10
Top = 240
Width = 450
End
End
Begin Othello.FlatButton fltbtnCancel
Cancel = -1 'True
Height = 375
Left = 3210
TabIndex = 2
Top = 1965
Visible = 0 'False
Width = 1005
_ExtentX = 1773
_ExtentY = 661
Caption = "取消"
MousePointer = 99
Style = 2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
EnableHot = -1 'True
ForeColor = 0
End
Begin Othello.FlatButton fltbtnDisagree
Height = 375
Left = 90
TabIndex = 4
Top = 1710
Visible = 0 'False
Width = 1005
_ExtentX = 1773
_ExtentY = 661
Caption = "拒绝请求"
MousePointer = 99
Style = 2
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
EnableHot = -1 'True
ForeColor = 0
End
Begin VB.Label Label2
AutoSize = -1 'True
BackStyle = 0 'Transparent
Caption = "简短附言:"
Height = 180
Left = 165
TabIndex = 9
Top = 1140
Width = 810
End
End
Attribute VB_Name = "frmRequest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Dim mstrCommand As String
Dim mblnAgree As Boolean
Dim mblnSendRequest As Boolean
Dim FormVisible As Boolean
Public Sub ShowEx(ByVal UserName As String, ByVal Name As String, ByVal Face As Long, Optional ByVal Command As String = "", Optional ByVal Message As String = "", Optional ByVal SendRequest As Boolean = True)
On Error Resume Next
Call MainForm.ilsFace.ListImages(Face).Draw(picFace.hDC, 0, 0, imlTransparent)
txtUserName.Tag = UserName
txtUserName.Text = GetDisplayName(UserName, Name)
If SendRequest Then
mstrCommand = CMD_Request & Command
Else
mstrCommand = CMD_ReRequest & Command
End If
mblnSendRequest = SendRequest
If Command = CMD_RequestCancelGame Then
Me.Caption = LoadString(219) & GetDisplayName(UserName, Name)
ElseIf Command = CMD_RequestDrawGame Then
Me.Caption = LoadString(220) & GetDisplayName(UserName, Name)
Else
Me.Caption = LoadString(221) & GetDisplayName(UserName, Name)
End If
If SendRequest Then
fltbtnSend.Default = True
fltbtnSend.Visible = True
fltbtnCancel.Cancel = True
fltbtnCancel.Visible = True
Else
txtMessage.Text = Message
txtMessage.Locked = True
txtMessage.BackColor = vbButtonFace
Call fltbtnAgree.Move(fltbtnSend.Left, fltbtnSend.Top)
Call fltbtnDisagree.Move(fltbtnCancel.Left, fltbtnCancel.Top)
fltbtnSend.Visible = False
fltbtnSend.Default = False
fltbtnCancel.Visible = False
fltbtnCancel.Cancel = False
fltbtnAgree.Default = True
fltbtnAgree.Visible = True
fltbtnDisagree.Cancel = True
fltbtnDisagree.Visible = True
End If
FormVisible = True
Call Me.Show(vbModeless, MainForm)
End Sub
Public Sub FormMinimize()
If Me.Visible Then
Call Me.Hide
End If
End Sub
Public Sub FormNormal()
If FormVisible Then
Call Me.Show(vbModeless)
Call KeepOnTop(Me.hWnd)
End If
End Sub
Private Sub fltbtnAgree_Click(Button As Integer)
On Error Resume Next
Call Me.Hide
If gblnGameStart Then
mblnAgree = True
Call MainForm.SendCommand(mstrCommand & CMD_Agree)
Call MainForm.AgreeRequest(Mid(mstrCommand, 2, 1))
End If
Call Unload(Me)
End Sub
Private Sub fltbtnCancel_Click(Button As Integer)
mblnAgree = False
Call Unload(Me)
End Sub
Private Sub fltbtnDisagree_Click(Button As Integer)
'If mstrCommand = CMD_RequestJoin And Not gblnGameStart Then
'If gblnGameStart Then
mblnAgree = False
'Call MainForm.SendCommand(CMD_DisagreeCancelGame)
'End If
Call Unload(Me)
End Sub
Private Sub fltbtnSend_Click(Button As Integer)
On Error Resume Next
If gblnGameStart Then
If mstrCommand <> "" Then
Call MainForm.SendCommand(mstrCommand & txtMessage.Text)
Else
Call MessageBox(Me.hWnd, LoadString(161), vbExclamation, LoadString(181))
End If
End If
Call Unload(Me)
End Sub
Private Sub fltbtnView_Click(Button As Integer)
On Error Resume Next
'fltbtnView.Enabled = False
Call frmUserInfo.ShowEx(txtUserName.Tag, txtUserName.Text)
'fltbtnView.Enabled = True
End Sub
Private Sub Form_Activate()
Call SetControlFocus(txtMessage)
End Sub
Private Sub Form_Load()
Call KeepOnTop(Me.hWnd)
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
On Error Resume Next
If (Not mblnSendRequest) And (Not mblnAgree) Then
Call MainForm.SendCommand(mstrCommand & CMD_Disagree)
Call MainForm.DisagreeRequest(Mid(mstrCommand, 2, 1))
End If
Call KillOnTop(Me.hWnd)
FormVisible = False
End Sub