-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChatControl.cs
More file actions
198 lines (193 loc) · 7.2 KB
/
ChatControl.cs
File metadata and controls
198 lines (193 loc) · 7.2 KB
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
using System;
using System.Drawing;
using System.Windows.Forms;
public partial class ChatControl : UserControl
{
private TextBox responseTextBox;
private TextBox promptTextBox;
private Button submitButton;
private PictureBox characterPictureBox;
private TextBox characterDescriptionTextBox;
private Button saveButton;
private Button loadButton;
private Button slideOutButton;
private Panel slideOutPanel;
private TextBox authorsNotesTextBox;
private TextBox greetingMessageTextBox;
private TextBox instructionsTextBox;
public ChatControl()
{
InitializeComponent();
}
private void InitializeComponent()
{
responseTextBox = new TextBox();
promptTextBox = new TextBox();
submitButton = new Button();
characterPictureBox = new PictureBox();
characterDescriptionTextBox = new TextBox();
saveButton = new Button();
loadButton = new Button();
slideOutButton = new Button();
slideOutPanel = new Panel();
authorsNotesTextBox = new TextBox();
greetingMessageTextBox = new TextBox();
instructionsTextBox = new TextBox();
((System.ComponentModel.ISupportInitialize)characterPictureBox).BeginInit();
slideOutPanel.SuspendLayout();
SuspendLayout();
//
// responseTextBox
//
responseTextBox.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
responseTextBox.Location = new Point(10, 10);
responseTextBox.Multiline = true;
responseTextBox.Name = "responseTextBox";
responseTextBox.Size = new Size(420, 331);
responseTextBox.TabIndex = 0;
//
// promptTextBox
//
promptTextBox.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
promptTextBox.Location = new Point(10, 347);
promptTextBox.Multiline = true;
promptTextBox.Name = "promptTextBox";
promptTextBox.Size = new Size(354, 50);
promptTextBox.TabIndex = 1;
//
// submitButton
//
submitButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
submitButton.Location = new Point(370, 347);
submitButton.Name = "submitButton";
submitButton.Size = new Size(60, 50);
submitButton.TabIndex = 2;
submitButton.Text = "Submit";
//
// characterPictureBox
//
characterPictureBox.Anchor = AnchorStyles.Top | AnchorStyles.Right;
characterPictureBox.BorderStyle = BorderStyle.FixedSingle;
characterPictureBox.Location = new Point(440, 10);
characterPictureBox.Name = "characterPictureBox";
characterPictureBox.Size = new Size(150, 209);
characterPictureBox.SizeMode = PictureBoxSizeMode.Zoom;
characterPictureBox.TabIndex = 3;
characterPictureBox.TabStop = false;
characterPictureBox.Click += CharacterPictureBox_Click;
//
// characterDescriptionTextBox
//
characterDescriptionTextBox.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
characterDescriptionTextBox.Location = new Point(440, 221);
characterDescriptionTextBox.Multiline = true;
characterDescriptionTextBox.Name = "characterDescriptionTextBox";
characterDescriptionTextBox.Size = new Size(150, 105);
characterDescriptionTextBox.TabIndex = 4;
//
// saveButton
//
saveButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
saveButton.Location = new Point(440, 332);
saveButton.Name = "saveButton";
saveButton.Size = new Size(75, 30);
saveButton.TabIndex = 5;
//
// loadButton
//
loadButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
loadButton.Location = new Point(515, 332);
loadButton.Name = "loadButton";
loadButton.Size = new Size(75, 30);
loadButton.TabIndex = 6;
//
// slideOutButton
//
slideOutButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Right;
slideOutButton.Location = new Point(440, 368);
slideOutButton.Name = "slideOutButton";
slideOutButton.Size = new Size(150, 30);
slideOutButton.TabIndex = 7;
slideOutButton.Text = "-->";
slideOutButton.Click += SlideOutButton_Click;
//
// slideOutPanel
//
slideOutPanel.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right;
slideOutPanel.Controls.Add(authorsNotesTextBox);
slideOutPanel.Controls.Add(greetingMessageTextBox);
slideOutPanel.Controls.Add(instructionsTextBox);
slideOutPanel.Location = new Point(596, 10);
slideOutPanel.Name = "slideOutPanel";
slideOutPanel.Size = new Size(200, 388);
slideOutPanel.TabIndex = 8;
slideOutPanel.Visible = false;
//
// authorsNotesTextBox
//
authorsNotesTextBox.Location = new Point(10, 10);
authorsNotesTextBox.Multiline = true;
authorsNotesTextBox.Name = "authorsNotesTextBox";
authorsNotesTextBox.Size = new Size(180, 80);
authorsNotesTextBox.TabIndex = 0;
//
// greetingMessageTextBox
//
greetingMessageTextBox.Location = new Point(10, 100);
greetingMessageTextBox.Multiline = true;
greetingMessageTextBox.Name = "greetingMessageTextBox";
greetingMessageTextBox.Size = new Size(180, 80);
greetingMessageTextBox.TabIndex = 1;
//
// instructionsTextBox
//
instructionsTextBox.Location = new Point(10, 190);
instructionsTextBox.Multiline = true;
instructionsTextBox.Name = "instructionsTextBox";
instructionsTextBox.Size = new Size(180, 80);
instructionsTextBox.TabIndex = 2;
//
// ChatControl
//
Controls.Add(responseTextBox);
Controls.Add(promptTextBox);
Controls.Add(submitButton);
Controls.Add(characterPictureBox);
Controls.Add(characterDescriptionTextBox);
Controls.Add(saveButton);
Controls.Add(loadButton);
Controls.Add(slideOutButton);
Controls.Add(slideOutPanel);
Name = "ChatControl";
Size = new Size(820, 401);
((System.ComponentModel.ISupportInitialize)characterPictureBox).EndInit();
slideOutPanel.ResumeLayout(false);
slideOutPanel.PerformLayout();
ResumeLayout(false);
PerformLayout();
}
private void CharacterPictureBox_Click(object sender, EventArgs e)
{
using (OpenFileDialog openFileDialog = new OpenFileDialog())
{
openFileDialog.Filter = "Image Files|*.jpg;*.jpeg;*.png;*.bmp";
if (openFileDialog.ShowDialog() == DialogResult.OK)
{
characterPictureBox.Image = Image.FromFile(openFileDialog.FileName);
}
}
}
private void SlideOutButton_Click(object sender, EventArgs e)
{
if (slideOutPanel.Visible)
{
slideOutPanel.Visible = false;
slideOutButton.Text = "-->";
}
else
{
slideOutPanel.Visible = true;
slideOutButton.Text = "<--";
}
}
}