-
Notifications
You must be signed in to change notification settings - Fork 1
/
ContextMenuForForm.vb
284 lines (266 loc) · 11.1 KB
/
ContextMenuForForm.vb
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
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Data
Imports System.Text
Imports System.Windows.Forms
'For Image Web Load:
Imports System.IO
Imports System.Net
Partial Public Class ContextMenuForForm
Inherits UserControl
Public Shared isfirstpaint As Boolean = True
Public Sub New()
InitializeComponent()
End Sub
Friend WithEvents PreviousB As System.Windows.Forms.Button
Friend WithEvents NextB As System.Windows.Forms.Button
''' <summary>
''' Required designer variable.
''' </summary>
Private components As System.ComponentModel.IContainer = Nothing
''' <summary>
''' Clean up any resources being used.
''' </summary>
''' <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
Protected Overrides Sub Dispose(disposing As Boolean)
If disposing AndAlso (components IsNot Nothing) Then
components.Dispose()
End If
MyBase.Dispose(disposing)
End Sub
#Region "Component Designer generated code"
' <summary>
' Required method for Designer support - do not modify
' the contents of this method with the code editor.
' </summary>
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Me.label3 = New System.Windows.Forms.Label()
Me.label1 = New System.Windows.Forms.Label()
Me.pictureBox1 = New System.Windows.Forms.PictureBox()
Me.toolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.PreviousB = New System.Windows.Forms.Button()
Me.NextB = New System.Windows.Forms.Button()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label5 = New System.Windows.Forms.Label()
Me.label2 = New System.Windows.Forms.Label()
Me.Label6 = New System.Windows.Forms.Label()
Me.Label7 = New System.Windows.Forms.Label()
Me.Label8 = New System.Windows.Forms.Label()
Me.Label9 = New System.Windows.Forms.Label()
Me.Label10 = New System.Windows.Forms.Label()
Me.Label11 = New System.Windows.Forms.Label()
CType(Me.pictureBox1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'label3
'
Me.label3.AutoSize = True
Me.label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.label3.Location = New System.Drawing.Point(127, 54)
Me.label3.Name = "label3"
Me.label3.Size = New System.Drawing.Size(95, 16)
Me.label3.TabIndex = 3
Me.label3.Text = "Views/Likes:"
'
'label1
'
Me.label1.BackColor = System.Drawing.SystemColors.ActiveCaption
Me.label1.Dock = System.Windows.Forms.DockStyle.Top
Me.label1.Location = New System.Drawing.Point(0, 0)
Me.label1.Name = "label1"
Me.label1.Size = New System.Drawing.Size(272, 23)
Me.label1.TabIndex = 0
Me.label1.Text = "Photoview (sorted by popularity)"
Me.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'pictureBox1
'
Me.pictureBox1.Location = New System.Drawing.Point(17, 76)
Me.pictureBox1.Name = "pictureBox1"
Me.pictureBox1.Size = New System.Drawing.Size(240, 240)
Me.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom
Me.pictureBox1.TabIndex = 31
Me.pictureBox1.TabStop = False
'
'PreviousB
'
Me.PreviousB.Location = New System.Drawing.Point(17, 340)
Me.PreviousB.Name = "PreviousB"
Me.PreviousB.Size = New System.Drawing.Size(60, 23)
Me.PreviousB.TabIndex = 32
Me.PreviousB.Text = "Previous"
Me.PreviousB.UseVisualStyleBackColor = True
'
'NextB
'
Me.NextB.Location = New System.Drawing.Point(197, 340)
Me.NextB.Name = "NextB"
Me.NextB.Size = New System.Drawing.Size(60, 23)
Me.NextB.TabIndex = 32
Me.NextB.Text = "Next"
Me.NextB.UseVisualStyleBackColor = True
'
'Label4
'
Me.Label4.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label4.Location = New System.Drawing.Point(182, 36)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(75, 13)
Me.Label4.TabIndex = 1
Me.Label4.Text = "ID0"
Me.Label4.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'Label5
'
Me.Label5.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label5.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.Location = New System.Drawing.Point(137, 54)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(120, 13)
Me.Label5.TabIndex = 1
Me.Label5.Text = "0"
Me.Label5.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'label2
'
Me.label2.AutoSize = True
Me.label2.Location = New System.Drawing.Point(127, 36)
Me.label2.Name = "label2"
Me.label2.Size = New System.Drawing.Size(54, 15)
Me.label2.TabIndex = 1
Me.label2.Text = "PhotoID:"
'
'Label6
'
Me.Label6.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label6.ForeColor = System.Drawing.SystemColors.ControlDarkDark
Me.Label6.Location = New System.Drawing.Point(17, 319)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(240, 15)
Me.Label6.TabIndex = 1
Me.Label6.Text = "Click image to open web address."
Me.Label6.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'Label7
'
Me.Label7.AutoSize = True
Me.Label7.Location = New System.Drawing.Point(14, 36)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(27, 15)
Me.Label7.TabIndex = 1
Me.Label7.Text = "Lat:"
'
'Label8
'
Me.Label8.AutoSize = True
Me.Label8.Location = New System.Drawing.Point(14, 54)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(31, 15)
Me.Label8.TabIndex = 3
Me.Label8.Text = "Lng:"
'
'Label9
'
Me.Label9.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label9.Location = New System.Drawing.Point(46, 36)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(75, 13)
Me.Label9.TabIndex = 1
Me.Label9.Text = "0"
Me.Label9.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'Label10
'
Me.Label10.Anchor = CType((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Label10.Location = New System.Drawing.Point(49, 54)
Me.Label10.Name = "Label10"
Me.Label10.Size = New System.Drawing.Size(72, 13)
Me.Label10.TabIndex = 1
Me.Label10.Text = "0"
Me.Label10.TextAlign = System.Drawing.ContentAlignment.TopRight
'
'Label11
'
Me.Label11.Anchor = System.Windows.Forms.AnchorStyles.Top
Me.Label11.Location = New System.Drawing.Point(83, 345)
Me.Label11.Name = "Label11"
Me.Label11.Size = New System.Drawing.Size(108, 18)
Me.Label11.TabIndex = 1
Me.Label11.Text = "x of x"
Me.Label11.TextAlign = System.Drawing.ContentAlignment.TopCenter
'
'ContextMenuForForm
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.Controls.Add(Me.NextB)
Me.Controls.Add(Me.PreviousB)
Me.Controls.Add(Me.Label8)
Me.Controls.Add(Me.label3)
Me.Controls.Add(Me.Label10)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.Label9)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label11)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.label2)
Me.Controls.Add(Me.label1)
Me.Controls.Add(Me.pictureBox1)
Me.Name = "ContextMenuForForm"
Me.Size = New System.Drawing.Size(272, 372)
CType(Me.pictureBox1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
Private label3 As System.Windows.Forms.Label
Private label1 As System.Windows.Forms.Label
'Private pictureBox1 As System.Windows.Forms.PictureBox
Private toolTip1 As System.Windows.Forms.ToolTip
Private Sub ContextMenuForForm_Paint(sender As Object, e As PaintEventArgs) Handles MyBase.Paint
If isfirstpaint Then
Dim url As String
pictureBox1.Image = Nothing
url = visualForm.pList(visualForm.pListCursor).pUrl
Label4.Text = visualForm.pList(visualForm.pListCursor).photoid
Label5.Text = visualForm.pList(visualForm.pListCursor).views
Label9.Text = visualForm.pList(visualForm.pListCursor).lat
Label10.Text = visualForm.pList(visualForm.pListCursor).lng
Label11.Text = visualForm.pList.Count - visualForm.pListCursor & " of " & visualForm.pList.Count
pictureBox1.SizeMode = PictureBoxSizeMode.Zoom
pictureBox1.WaitOnLoad = False
pictureBox1.LoadAsync(url)
isfirstpaint = False
End If
End Sub
Private Sub NextB_Click(sender As Object, e As EventArgs) Handles NextB.Click
If Not visualForm.pListCursor = 0 Then
visualForm.pListCursor = visualForm.pListCursor - 1
isfirstpaint = True
visualForm.UpdatePhotoView()
End If
End Sub
Private Sub PreviousB_Click(sender As Object, e As EventArgs) Handles PreviousB.Click
If Not visualForm.pListCursor = visualForm.pList.Count - 1 Then
visualForm.pListCursor = visualForm.pListCursor + 1
isfirstpaint = True
visualForm.UpdatePhotoView()
End If
End Sub
Public Shared Sub openAdress()
Dim basURL As String = ""
If visualForm.pList(visualForm.pListCursor).photoOrigin = 1 Then
basURL = "https://www.instagram.com/p/"
ElseIf visualForm.pList(visualForm.pListCursor).photoOrigin = 2 Then
basURL = "http://flickr.com/photo.gne?id="
End If
Dim webAddress As String = basURL & visualForm.pList(visualForm.pListCursor).photoid
Process.Start(webAddress)
End Sub
Private Sub pictureBox1_Click(sender As Object, e As EventArgs) Handles pictureBox1.Click
openAdress()
End Sub
End Class