Форум программистов, компьютерный форум, киберфорум
Visual Basic .NET
Войти
Регистрация
Восстановить пароль
Блоги Сообщество Поиск Заказать работу  
 
Рейтинг 4.72/25: Рейтинг темы: голосов - 25, средняя оценка - 4.72
0 / 0 / 0
Регистрация: 17.11.2013
Сообщений: 10

Вывести на печать содержимое Picturebox

22.11.2013, 02:14. Показов 5093. Ответов 11
Метки нет (Все метки)

Студворк — интернет-сервис помощи студентам
Всем привет! я новичек, прошу помочь!
Не могу никак вывести на печать содержимое Picturebox
Пожалуйста подскажите!
Заранее благодарен!
вот это и надо напечатать
0
Лучшие ответы (1)
Programming
Эксперт
39485 / 9562 / 3019
Регистрация: 12.04.2006
Сообщений: 41,671
Блог
22.11.2013, 02:14
Ответы с готовыми решениями:

Вывести на печать содержимое DataGridView
Ни разу не работал с этой функцией, да и в нете не много информации. Буду рад любым подсказкам.

Вывести на печать содержимое формы
как вывести на печать содержимое формы?

вывести на печать PictureBox
как вывести на печать содержимое PictureBox без формы? пробовал печатать форму целиком - нарисованные объекты (Line,Rectangle и прочее)...

11
 Аватар для ViterAlex
8951 / 4863 / 1886
Регистрация: 11.02.2013
Сообщений: 10,246
22.11.2013, 04:02
Лучший ответ Сообщение было отмечено как решение

Решение

В качестве "рыбы". При нажатии на кнопку появится диалог печати для выбора принтера. Нажать ок. Будет напечатано изображение из picturebox
VB.NET
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
    Private WithEvents PD As PrintDocument
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim pdialog As New PrintDialog
        If pdialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
            PD = New PrintDocument()
            PD.PrinterSettings = pdialog.PrinterSettings
            PD.Print()
        End If
    End Sub
 
    ''' <summary>Событие печати</summary>
    Private Sub PD_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PD.PrintPage
        If PictureBox1.Image IsNot Nothing Then
            e.Graphics.DrawImage(PictureBox1.Image, 0, 0)
        End If
    End Sub
Нужно подключить System.Drawing.Printing
4
0 / 0 / 0
Регистрация: 17.11.2013
Сообщений: 10
22.11.2013, 10:32  [ТС]
Спасибо Alex,но лист попрежнему чисто белый и что значит "Нужно подключить System.Drawing.Printing"
0
 Аватар для Юпатов Дмитрий
1721 / 1208 / 228
Регистрация: 23.12.2010
Сообщений: 1,544
22.11.2013, 10:49
Цитата Сообщение от Barsiy Посмотреть сообщение
и что значит "Нужно подключить System.Drawing.Printing"
Ну если студия не заругалась на код, то все уже подключено по-умолчанию. А подключение идет на вкладке "Ссылки" свойств проекта, в нижнем списке надо чекнуть. Но обычно в приложениях winforms пространство System.Drawing уже подключено. соответственно и его "дочки" тоже.
А по поводу белого листа... Покажите код, которым отрисовано изображение на пикчере. Использовалось ли при этом свойство Image у пикчера?
1
0 / 0 / 0
Регистрация: 17.11.2013
Сообщений: 10
22.11.2013, 11:03  [ТС]
VB.NET
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
'Блок данных 1
    Public Sub fff()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 9, 3)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 25)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 37)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 49)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 61)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 24)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 36)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 48)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
Добавлено через 2 минуты
Спасибо,Дмитрий ,но все так же безнадежно))
0
 Аватар для Юпатов Дмитрий
1721 / 1208 / 228
Регистрация: 23.12.2010
Сообщений: 1,544
22.11.2013, 11:45

Не по теме:

Я почти телепат - так я и думал :)


естественно, так и должно быть. Ты же рисуешь на поверхности пикчера, а не на картинке.
Строку
VB.NET
1
graf = PictureBox1.CreateGraphics
замени на
VB.NET
1
graf=graphics.fromimage(new Bitmap (picturebox1.width, picturebox1.height, System.Drawing.Imaging.PixelFormat.Format32bppArgb))
это мы создаем новую картинку по размеру пикчера, с поддержкой прозрачности. Если прозрачность не надо, выбери другое значение из списка System.Drawing.Imaging.PixelFormat
а в конце процедуры (перед end sub) допиши:
VB.NET
1
picturebox1.image=MyBMP
Все заработает.
Фишка в чем: сейчас ты создаешь поверхность рисования на основе поверхности пикчарбокса, и никак не используешь его свойство Image (оно как было пустым, так им и остается после рисования). А код от ViterAlex берет данные для печати именно из этого свойства. Ну а раз оно пустое, то и рисовать нечего - идет на печать пустой лист. Для проверки меня можешь ПЕРЕД изменением кода засунуть в пикчер какую-то картинку из файла (прямо через конструктор студии), а потом запустить программу и выполнить печать - будет отпечатано именно твое засунутое изображение.
Ну а потом, измени код, как я написал и попробуй еще раз. Не забудь удалить картинку (которую ты совал для проверки) из пикчера.
2
0 / 0 / 0
Регистрация: 17.11.2013
Сообщений: 10
22.11.2013, 19:56  [ТС]
Огромное спасибо Дмитрий и Алекс,да все получилось !!! теперь другая проблема) попробую разобраться если не получится,то побеспокою вас вновь)

Добавлено через 4 часа 16 минут
Дмитрий,это опять я) пришлось увеличить Picturebox до размера A4,но это не беде,а беда в том ,что теперь я не могу вывести два или больше items как на картинке ,которую я выслал в начале.Программа просто заменяет их а не дополняет не пойму почему?
0
 Аватар для Юпатов Дмитрий
1721 / 1208 / 228
Регистрация: 23.12.2010
Сообщений: 1,544
23.11.2013, 00:26
Заменяет? А в пикчере все нормально отображается? Или само рисование происходит с заменой?
1
 Аватар для ViterAlex
8951 / 4863 / 1886
Регистрация: 11.02.2013
Сообщений: 10,246
23.11.2013, 00:37
Дай весь проект. Очень не хочется на кофейной гуще гадать что и куда ты записал. Вообще, если ты рисуешь, то это нужно делать в событии Paint. Так логичнее. И рисовать в битмапе, а затем этот битмап назначать тому объекту, на котором рисуешь. В случае с picturebox можно или свойство Image использовать или рисовать через Graphics. Тогда не будет таких проблем. И до А4 тоже не нужно увеличивать picturebox, ведь можно печатать с масштабом, правда качество будет падать. Но это вопрос решаемый
1
0 / 0 / 0
Регистрация: 17.11.2013
Сообщений: 10
23.11.2013, 17:01  [ТС]
само рисование щелкаю второй цвет и первый исчезает

Добавлено через 1 час 0 минут
VB.NET
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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
ublic Class Form1
    Dim graf As Graphics
 
 
   
 
 
 
 
 
 
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        F1 = Me
 
    End Sub
 
    ' Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
    'End Sub
 
 
 
 
    'Кнопка 1 ввода данных на  PictureBox
    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        fff()
    End Sub
    'Кнопка 2 ввода данных на  PictureBox
    Private Sub Button7_Click(sender As System.Object, e As System.EventArgs) Handles Button7.Click
        fff1()
    End Sub
    'Кнопка 3 ввода данных на  PictureBox
    Private Sub Button8_Click(sender As System.Object, e As System.EventArgs) Handles Button8.Click
        fff2()
    End Sub
    'Кнопка 4 ввода данных на  PictureBox
    Private Sub Button9_Click(sender As System.Object, e As System.EventArgs) Handles Button9.Click
        fff3()
    End Sub
    'Кнопка 5 ввода данных на  PictureBox
    Private Sub Button10_Click(sender As System.Object, e As System.EventArgs) Handles Button10.Click
        fff4()
    End Sub
    'Кнопка 6 ввода данных на  PictureBox
    Private Sub Button12_Click(sender As System.Object, e As System.EventArgs) Handles Button12.Click
        fff5()
    End Sub
    'Кнопка 7 ввода данных на  PictureBox
    Private Sub Button11_Click(sender As System.Object, e As System.EventArgs) Handles Button11.Click
        fff6()
    End Sub
    'Кнопка 8 ввода данных на  PictureBox
    Private Sub Button13_Click(sender As System.Object, e As System.EventArgs) Handles Button13.Click
        fff7()
    End Sub
 
 
    'Блок данных 1
    Public Sub fff()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
 
      
        Dim MyBMP As New Bitmap(PictureBox1.Width, PictureBox1.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
        graf = Graphics.FromImage(MyBMP)
        PictureBox1.Image = MyBMP
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 56, FontStyle.Bold), Brushes.Black, 36, 12)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 32, FontStyle.Bold), Brushes.Black, 5, 120)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 32, FontStyle.Bold), Brushes.Black, 5, 148)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 32, FontStyle.Bold), Brushes.Black, 5, 196)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 32, FontStyle.Bold), Brushes.Black, 5, 244)
 
         
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 24)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 36)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 48)
 
        End If
        ListBox2.SelectedItem = Nothing
 
 
 
    End Sub
    'Блок данных 2
    Public Sub fff1()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 114, 3)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 25)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 37)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 49)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 61)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 24)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 36)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 48)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 3
    Public Sub fff2()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 9, 75)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 100)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 112)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 124)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 136)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 99)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 111)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 123)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 4
    Public Sub fff3()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 114, 75)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 100)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 112)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 124)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 136)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 99)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 111)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 123)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 5
    Public Sub fff4()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 9, 150)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 175)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 187)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 199)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 211)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 174)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 186)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 198)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 6
    Public Sub fff5()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 114, 150)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 175)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 187)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 199)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 211)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 174)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 186)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 198)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 7
    Public Sub fff6()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 9, 225)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 250)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 262)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 274)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 286)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 249)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 261)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 273)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 8
    Public Sub fff7()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 114, 225)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 250)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 262)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 274)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 223)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 249)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 261)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 273)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
 
    'Очистить PictureBox
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
 
        graf.Clear(Color.White)
 
    End Sub
 
 
 
    
 
    'Отображает введенный текст на ComboBox1 в  ListBox1
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        ListBox1.Items.Add(ComboBox1.Text)
    End Sub
 
    'Очистка данных в  ListBox1
    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
        ListBox1.Items.Clear()
    End Sub
 
 
    'Отображает введенный текст на ComboBox2 в  ListBox2
    Private Sub ComboBox2_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        ListBox2.Items.Add(ComboBox2.Text)
    End Sub
 
    'Очистка данных в  ListBox2
    Private Sub Button4_Click_1(sender As System.Object, e As System.EventArgs) Handles Button4.Click
        ListBox2.Items.Clear()
 
 
    End Sub
 
    'Ограничение введения кол.знаков до7 в TextBox1
    Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged
        TextBox1.MaxLength = 7
    End Sub
 
    ' Открытие второй формы
    Private Sub AddNewColorToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles AddNewColorToolStripMenuItem.Click
        F2 = New Form2
        F2.Show()
 
    End Sub
 
 
 
 
    Private WithEvents PD As PrintDocument
 
    Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
       
        Dim pdialog As New PrintDialog
        If pdialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
            PD = New PrintDocument()
            PD.PrinterSettings = pdialog.PrinterSettings
            PD.Print()
        End If
    End Sub
 
    ''' <summary>Событие печати</summary>
    Private Sub PD_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PD.PrintPage
        If PictureBox1.Image IsNot Nothing Then
            e.Graphics.DrawImage(PictureBox1.Image, 0, 0)
        End If
 
    End Sub
End Class
Добавлено через 6 минут
VB.NET
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
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
Imports System.Drawing.Printing
 
Public Class Form1
    Dim graf As Graphics
 
 
   
 
 
 
 
 
 
    Public Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        F1 = Me
 
    End Sub
 
    ' Private Sub Button1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Button1.MouseDown
    'End Sub
 
 
 
 
    'Кнопка 1 ввода данных на  PictureBox
    Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
 
        fff()
    End Sub
    'Кнопка 2 ввода данных на  PictureBox
    Private Sub Button7_Click(sender As System.Object, e As System.EventArgs) Handles Button7.Click
        fff1()
    End Sub
    'Кнопка 3 ввода данных на  PictureBox
    Private Sub Button8_Click(sender As System.Object, e As System.EventArgs) Handles Button8.Click
        fff2()
    End Sub
    'Кнопка 4 ввода данных на  PictureBox
    Private Sub Button9_Click(sender As System.Object, e As System.EventArgs) Handles Button9.Click
        fff3()
    End Sub
    'Кнопка 5 ввода данных на  PictureBox
    Private Sub Button10_Click(sender As System.Object, e As System.EventArgs) Handles Button10.Click
        fff4()
    End Sub
    'Кнопка 6 ввода данных на  PictureBox
    Private Sub Button12_Click(sender As System.Object, e As System.EventArgs) Handles Button12.Click
        fff5()
    End Sub
    'Кнопка 7 ввода данных на  PictureBox
    Private Sub Button11_Click(sender As System.Object, e As System.EventArgs) Handles Button11.Click
        fff6()
    End Sub
    'Кнопка 8 ввода данных на  PictureBox
    Private Sub Button13_Click(sender As System.Object, e As System.EventArgs) Handles Button13.Click
        fff7()
    End Sub
 
 
    'Блок данных 1
    Public Sub fff()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
 
      
        Dim MyBMP As New Bitmap(PictureBox1.Width, PictureBox1.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb)
        graf = Graphics.FromImage(MyBMP)
        PictureBox1.Image = MyBMP
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 56, FontStyle.Bold), Brushes.Black, 36, 12)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 32, FontStyle.Bold), Brushes.Black, 5, 120)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 32, FontStyle.Bold), Brushes.Black, 5, 148)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 32, FontStyle.Bold), Brushes.Black, 5, 196)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 32, FontStyle.Bold), Brushes.Black, 5, 244)
 
         
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 24)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 36)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 48)
 
        End If
        ListBox2.SelectedItem = Nothing
 
 
 
    End Sub
    'Блок данных 2
    Public Sub fff1()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 114, 3)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 25)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 37)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 49)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 61)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 24)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 36)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 48)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 3
    Public Sub fff2()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 9, 75)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 100)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 112)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 124)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 136)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 99)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 111)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 123)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 4
    Public Sub fff3()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 114, 75)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 100)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 112)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 124)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 136)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 99)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 111)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 123)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 5
    Public Sub fff4()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 9, 150)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 175)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 187)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 199)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 211)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 174)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 186)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 198)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 6
    Public Sub fff5()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 114, 150)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 175)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 187)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 199)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 211)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 174)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 186)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 198)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 7
    Public Sub fff6()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 9, 225)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 250)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 262)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 274)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 286)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 249)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 261)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 273)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
    'Блок данных 8
    Public Sub fff7()
        'Переменные
 
        Dim Com1 As String = ComboBox1.Text
        Dim degem As String = TextBox1.Text
        Dim zvet As String = ListBox1.SelectedItem
        Dim razmer As String = ListBox2.SelectedItem
        graf = PictureBox1.CreateGraphics
 
        'Очистка TextBox1
        TextBox1.Clear()
 
        'Отображение данных в PictureBox1
        graf.DrawString(degem, New Font("Arial", 14, FontStyle.Bold), Brushes.Black, 114, 225)
 
        ' Блок для введения значений цвета на  PictureBox1
        If ListBox1.SelectedItem = Nothing Then
            MsgBox("Select color !")
 
        ElseIf zvet = (ListBox1.Items(0)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 250)
 
        ElseIf zvet = (ListBox1.Items(1)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 262)
 
        ElseIf zvet = (ListBox1.Items(2)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 274)
 
        ElseIf zvet = (ListBox1.Items(3)) Then
            graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 114, 223)
 
            ' ElseIf zvet = (ListBox1.Items(4)) Then
            ' graf.DrawString(zvet, New Font("Arial", 8, FontStyle.Bold), Brushes.Black, 4, 11)
 
        End If
 
        ListBox1.SelectedItem = Nothing
 
 
 
        ' Блок для введения значений размера на  PictureBox1
 
        If ListBox2.SelectedItem = Nothing Then
            MsgBox("Select size !")
 
            'ElseIf razmer = (ListBox2.Items(0)) Then
            'graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 79, 8)
 
        ElseIf razmer = (ListBox2.Items(0)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 249)
 
        ElseIf razmer = (ListBox2.Items(1)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 261)
 
        ElseIf razmer = (ListBox2.Items(2)) Then
            graf.DrawString(razmer, New Font("Arial", 10, FontStyle.Bold), Brushes.Black, 184, 273)
 
 
        End If
        ListBox2.SelectedItem = Nothing
    End Sub
 
    'Очистить PictureBox
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
 
        graf.Clear(Color.White)
 
    End Sub
 
 
 
    
 
    'Отображает введенный текст на ComboBox1 в  ListBox1
    Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged
        ListBox1.Items.Add(ComboBox1.Text)
    End Sub
 
    'Очистка данных в  ListBox1
    Private Sub Button3_Click(sender As System.Object, e As System.EventArgs) Handles Button3.Click
        ListBox1.Items.Clear()
    End Sub
 
 
    'Отображает введенный текст на ComboBox2 в  ListBox2
    Private Sub ComboBox2_SelectedIndexChanged(sender As System.Object, e As System.EventArgs) Handles ComboBox2.SelectedIndexChanged
        ListBox2.Items.Add(ComboBox2.Text)
    End Sub
 
    'Очистка данных в  ListBox2
    Private Sub Button4_Click_1(sender As System.Object, e As System.EventArgs) Handles Button4.Click
        ListBox2.Items.Clear()
 
 
    End Sub
 
    'Ограничение введения кол.знаков до7 в TextBox1
    Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged
        TextBox1.MaxLength = 7
    End Sub
 
    ' Открытие второй формы
    Private Sub AddNewColorToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles AddNewColorToolStripMenuItem.Click
        F2 = New Form2
        F2.Show()
 
    End Sub
 
 
 
 
    Private WithEvents PD As PrintDocument
 
    Private Sub Button5_Click(sender As System.Object, e As System.EventArgs) Handles Button5.Click
       
        Dim pdialog As New PrintDialog
        If pdialog.ShowDialog() = Windows.Forms.DialogResult.OK Then
            PD = New PrintDocument()
            PD.PrinterSettings = pdialog.PrinterSettings
            PD.Print()
        End If
    End Sub
 
    ''' <summary>Событие печати</summary>
    Private Sub PD_PrintPage(sender As Object, e As PrintPageEventArgs) Handles PD.PrintPage
        If PictureBox1.Image IsNot Nothing Then
            e.Graphics.DrawImage(PictureBox1.Image, 0, 0)
        End If
 
    End Sub
End Class
Добавлено через 14 часов 35 минут
Алекс,это получается ,что в режиме Bitmap новое значение накладываеся на Picturebox как новый, чистый лист бумаги ,перекрывая прежний рисунок да? а что делать прежде я на Picturebox как хотел выводил значения.
0
 Аватар для ViterAlex
8951 / 4863 / 1886
Регистрация: 11.02.2013
Сообщений: 10,246
23.11.2013, 17:38
Ещё раз прошу, выложи весь проект, а не только код. Запакуй папку проекта в архив и прикрепи к сообщению
0
0 / 0 / 0
Регистрация: 17.11.2013
Сообщений: 10
23.11.2013, 17:51  [ТС]
Stik - Алекс.rar
0
Надоела реклама? Зарегистрируйтесь и она исчезнет полностью.
inter-admin
Эксперт
29715 / 6470 / 2152
Регистрация: 06.03.2009
Сообщений: 28,500
Блог
23.11.2013, 17:51
Помогаю со студенческими работами здесь

Вывести содержимое формы на печать
Как распечатать окно ?

Как вывести содержимое DataGrid на печать?
Подскажите пожалуйста как можно по нажатию кнопки вывести на печать то что в данный момент выводиться в DataGrid?

Как вывести на печать содержимое DBGrid?
Добрый день! Подскажите пожалуйста как вывести на печать содержимое DBGrid. Printer.Print DBGrid1.Text - печатает только первую ячейку...

Как вывести на печать содержимое текстового поля?
Как вывести на печать содержимое текстового поля? Подскажите пож.

DataGrid: заполнить определенную ячейку и вывести содержимое на печать
Здравствуйте, подскажите пожалуйста, как в таблице data grid заполнить например ячейку ? Так не получается: DataGrid1.Item(1, 1) =...


Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:
12
Ответ Создать тему
Новые блоги и статьи
SDL3 для Web (WebAssembly): Основы отладки веб-приложений на SDL3 по USB и Wi-Fi, запущенных в браузере мобильных устройств
8Observer8 07.02.2026
Содержание блога Браузер Chrome имеет средства для отладки мобильных веб-приложений по USB. В этой пошаговой инструкции ограничимся работой с консолью. Вывод в консоль - это часть процесса. . .
SDL3 для Web (WebAssembly): Обработчик клика мыши в браузере ПК и касания экрана в браузере на мобильном устройстве
8Observer8 02.02.2026
Содержание блога Для начала пошагово создадим рабочий пример для подготовки к экспериментам в браузере ПК и в браузере мобильного устройства. Потом напишем обработчик клика мыши и обработчик. . .
Философия технологии
iceja 01.02.2026
На мой взгляд у человека в технических проектах остается роль генерального директора. Все остальное нейронки делают уже лучше человека. Они не могут нести предпринимательские риски, не могут. . .
SDL3 для Web (WebAssembly): Вывод текста со шрифтом TTF с помощью SDL3_ttf
8Observer8 01.02.2026
Содержание блога В этой пошаговой инструкции создадим с нуля веб-приложение, которое выводит текст в окне браузера. Запустим на Android на локальном сервере. Загрузим Release на бесплатный. . .
SDL3 для Web (WebAssembly): Сборка C/C++ проекта из консоли
8Observer8 30.01.2026
Содержание блога Если вы откроете примеры для начинающих на официальном репозитории SDL3 в папке: examples, то вы увидите, что все примеры используют следующие четыре обязательные функции, а. . .
SDL3 для Web (WebAssembly): Установка Emscripten SDK (emsdk) и CMake для сборки C и C++ приложений в Wasm
8Observer8 30.01.2026
Содержание блога Для того чтобы скачать Emscripten SDK (emsdk) необходимо сначало скачать и уставить Git: Install for Windows. Следуйте стандартной процедуре установки Git через установщик. . . .
SDL3 для Android: Подключение Box2D v3, физика и отрисовка коллайдеров
8Observer8 29.01.2026
Содержание блога Box2D - это библиотека для 2D физики для анимаций и игр. С её помощью можно определять были ли коллизии между конкретными объектами. Версия v3 была полностью переписана на Си, в. . .
Инструменты COM: Сохранение данный из VARIANT в файл и загрузка из файла в VARIANT
bedvit 28.01.2026
Сохранение базовых типов COM и массивов (одномерных или двухмерных) любой вложенности (деревья) в файл, с возможностью выбора алгоритмов сжатия и шифрования. Часть библиотеки BedvitCOM Использованы. . .
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2026, CyberForum.ru