-
Notifications
You must be signed in to change notification settings - Fork 0
/
AbaDois.cs
100 lines (89 loc) · 3.2 KB
/
AbaDois.cs
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
using System;
using System.IO;
using System.Linq;
using System.Drawing;
using System.Threading;
using System.Diagnostics;
using System.Windows.Forms;
using System.ComponentModel;
using System.Collections.Generic;
using System.Text.RegularExpressions;
namespace FormsComponentes
{
public partial class AbaDois : TabPage
{
public AbaDois()
{
InitializeComponent();
}
/// <summary>
/// Método CheckedListBox - Laço
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Clb_CheckedLB_ItemCheck(object sender, ItemCheckEventArgs e)
{
for (int i = 0; i < clb_CheckedLB.Items.Count; i++)
if (i != e.Index) clb_CheckedLB.SetItemChecked(i, false);
}
/// <summary>
/// Evento Scroll do TrackBar
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Tb_ExTrackBar_Scroll(object sender, EventArgs e)
{ // Display the trackbar value in the text box.
tb_TrackBar.Text = "" + tb_ExTrackBar.Value;
}
/// <summary>
/// Evento OpenFile - Abrir conteúdo (txt)
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void Btn_OpenFileClick(object sender, EventArgs e)
{
OpenFileDialog dialog = new OpenFileDialog();
// dialog.InitialDirectory = @"C:\";
// dialog.Multiselect = true;
// dialog.Title = "Selecionar arquivos...";
// dialog.Filter = "Arquivo de Texto (*.TXT; *.RTF) |abrirarquivo.txt";
if (dialog.ShowDialog() != DialogResult.Cancel)
{
StreamReader arquivo = new StreamReader(dialog.FileName);
string conteudo = arquivo.ReadLine();
arquivo.Dispose();
MessageBox.Show(conteudo);
}
}
private void Btn_TesteErro_Click(object sender, EventArgs e)
{
Regex r = new Regex(@"^[a-zA-Z]+$");
if (!r.IsMatch(this.txt_ErrorBox.Text))
{
this.TextError.SetError(this.txt_ErrorBox, "SOMENTE LETRAS!");
}
else
{
this.TextError.SetError(this.txt_ErrorBox, String.Empty);
}
}
public string GetInfo()
{
string filmes = "";
string promocoes = "";
string pagtos = "";
foreach (string filme in lb_ListBox.SelectedItems)
filmes += " " + filme;
foreach (ListViewItem promocao in lv_ListView.SelectedItems)
promocoes += " " + promocao.Text;
foreach (string pagto in clb_CheckedLB.CheckedItems)
pagtos += " " + pagto;
return $"ListBox:> {filmes}\n" +
$"ListView:> {promocoes}\n" +
$"CheckedListBox:> {pagtos}\n" +
$"DateTimePicker:> {this.dp_DataTP.Value}\n" +
$"TrackBar:> {this.tb_ExTrackBar.Value}\n" +
$"ErrorProvider:> {this.txt_ErrorBox.Text}\n";
}
}
}