Форум программистов, компьютерный форум, киберфорум
C++/CLI Windows Forms
Войти
Регистрация
Восстановить пароль
Карта форума Темы раздела Блоги Сообщество Поиск Заказать работу  
Другие темы раздела
C++/CLI WinForms Счетчик вопросов в программе тестирования работает некорректно Здравствуйте! Получил задание написать программу-тест. Возникла следующая проблема... Для вывода последующего вопроса использую переменную counter = 0. По нажатию на кнопку значение counter должно повышаться на единицу (counter++) и в структуре switch проделываться намеченные на это операции. Но столкнулся с проблемой, что switch начинает работать только когда значение counter = 49 и далее уже... https://www.cyberforum.ru/ cpp-cli-winforms/ thread712160.html Записать в ListBox только что запущенный процесс C++/CLI WinForms
#pragma once #include <windows.h> #include <iostream> #include<stdio.h> #include<ctime> #include<list> #include<stdlib.h> #include <vcclr.h>
C++/CLI WinForms Загрузить в TextBox строку из текстового файла Добрый день! Подскажите, пожалуйста, данный момент. Мне необходимо в textbox вывести строку из .txt файла. При нажатии на кнопку, в textbox должна заносится следующая строка с заменой из данного .txt файла. Таких операций около 20 будет. Как это реализовать? Без opendialog, т.е. программа при открытии сразу же ссылается на данный текстовый файл. Заранее спасибо! https://www.cyberforum.ru/ cpp-cli-winforms/ thread711764.html C++/CLI WinForms Как присвоить переменной значение TextBox https://www.cyberforum.ru/ cpp-cli-winforms/ thread708961.html
Добрый день. Застрял на таком моменте. Кажется, что перепробовал все, что мог. Пробовал много способов, вот пара из них. b = (textBox1->Text).ToString(); Ошибка: error C2228: выражение слева от ".ToString" должно представлять класс, структуру или объединение b = Convert::ToString(textBox1->Text); Ошибка: error C2679: бинарный "=": не найден оператор, принимающий правый операнд типа...
C++/CLI WinForms Изменить свойства компонента другой формы
Есть Form1,textBox1,button1. button1 она открывает Form2 #include "Ras1.h" ....... private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { Ras1^ Rf = gcnew Ras1(); Rf->ShowDialog(); }
C++/CLI WinForms Необработанное исключение типа "System.Resources.MissingManifestResourceException" в mscorlib.dll https://www.cyberforum.ru/ cpp-cli-winforms/ thread707125.html
Поднимаю тему, т.к. сегодня сам установил 2012 студию и столкнулся с таким вопросом. Действительно, из 12й студии убрали таковой вид проекта, как WinForms на C++, но можно успешно самому добавить такого вида шаблон. (найденое мною решение с англоязычных форумов): 1. Создаём проект C++ Windows Forms в VS2010. (Файл-Создать проект-CLR-Приложение Windows Forms). Сохраняемся. 2. Открываем...
C++/CLI WinForms процессы #pragma once #include <iostream> #include <stdio.h> #include <stdlib.h> #include <vcclr.h> #include <windows.h> #include <queue.h> https://www.cyberforum.ru/ cpp-cli-winforms/ thread705168.html C++/CLI WinForms Закрытие приложения windows forms из трея
Здравствуйте! Мне вновь требуется Ваша помощь. Как обычно - сначала задача, затем - проблема. Задача состоит в закрытии приложения посредством меню из иконки системного трея. Ничего сложного в этом нет, если бы не одно но! При закрытии приложения (если нажать на крестик в правом верхнем углу окна) оно не закрывается, а сворачивается в трей. Для этого я переопределил метод FormClosing...
C++/CLI WinForms Можно ли создать пользовательский дизайн и есть ли в VS для этого готовые решения Привет, делаю софт Windows Forms на C++ в vs 2010 ultimate и мне не нравиться стандартный интерфейс. Для многофункциональной программы, слишком тупо использовать обычные кнопки. Как ни странно никаких шаблонов gui я не нашел в нете. Хотелось бы делать интерфейс наподобие продуктов касперского Ниужели нет сводобнораспростаняемых шаблонов как для веб? Или наборов... https://www.cyberforum.ru/ cpp-cli-winforms/ thread703222.html C++/CLI WinForms Вывод количества символов и слов в строке: подробно разобрать код Поясните пожалуйста подробно каждую строчку программы: #pragma endregion static array<String^>^ nsim= { L",", L".", L"+", L":", L";", L"!", L"\?", L"\\", L"/",L"|",L"#",L"№", L"&",L"%", L"@", L"$", L"(", L")",L"",L"]", L"{",L"}",L"*",L"~", L"<", L">", L"\n",L"\t",L"\v", L"\'",L"\"", L"0", L"1", L"2", L"3", L"4", L"5", L"6", L"7", L"8", L"9" }; String^ F(String^... https://www.cyberforum.ru/ cpp-cli-winforms/ thread702830.html
Получить значение параметра реестра через класс RegistryKey C++/CLI WinForms
Как сделать так, что-бы при загрузке формы значение одного из параметров ключа реестра заносилось в поле textBox? Работа с реестром через класс RegistryKey private: System::Void Form1_Load(Syst
0 / 0 / 0
Регистрация: 26.11.2012
Сообщений: 6
0

Визуальное програмирование, программа для построения графиков функции - C++/CLI WinForms - Ответ 3769923

28.11.2012, 20:46. Показов 14555. Ответов 8
Метки (Все метки)

Author24 — интернет-сервис помощи студентам
Есть программа, для заданной функции она строит график, выглядит примерно вот так как на первой картинке. Как сделать так, что бы в пустой текстБокс можно было ввести функцию, и по ней строился график(вторая картинка) Работа в Визуал студио 2010, С++, приложение виндовс формс. Вот код программы для построения с уже заданной функцией
C++
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
#pragma once
 
#include<cmath>
 
 
 
namespace Lab4 {
 
    using namespace System;
    using namespace System::ComponentModel;
    using namespace System::Collections;
    using namespace System::Windows::Forms;
    using namespace System::Data;
    using namespace System::Drawing;
    using namespace System::Windows::Forms::DataVisualization::Charting;
    /// <summary>
    /// Сводка для Form1
    /// </summary>
    public ref class Form1 : public System::Windows::Forms::Form
    {
    public:
        Form1(void)
        {
            InitializeComponent();
            //
            //TODO: добавьте код конструктора
            //
        }
 
    protected:
        /// <summary>
        /// Освободить все используемые ресурсы.
        /// </summary>
        ~Form1()
        {
            if (components)
            {
                delete components;
            }
        }
    private: System::Windows::Forms::Label^  label1;
    protected: 
 
    private: System::Windows::Forms::Label^  label2;
    private: System::Windows::Forms::Label^  label3;
    private: System::Windows::Forms::Label^  label4;
    private: System::Windows::Forms::Label^  label5;
    private: System::Windows::Forms::TextBox^  textBox1;
    private: System::Windows::Forms::TextBox^  textBox2;
    private: System::Windows::Forms::TextBox^  textBox3;
    private: System::Windows::Forms::Button^  button1;
    private: System::Windows::Forms::Button^  button2;
 
    private: System::Windows::Forms::DataVisualization::Charting::Chart^  chart1;
    private: System::Windows::Forms::TextBox^  textBox4;
 
    private:
        /// <summary>
        /// Требуется переменная конструктора.
        /// </summary>
        System::ComponentModel::Container ^components;
 
#pragma region Windows Form Designer generated code
        /// <summary>
        /// Обязательный метод для поддержки конструктора - не изменяйте
        /// содержимое данного метода при помощи редактора кода.
        /// </summary>
        void InitializeComponent(void)
        {
            System::Windows::Forms::DataVisualization::Charting::ChartArea^  chartArea1 = (gcnew System::Windows::Forms::DataVisualization::Charting::ChartArea());
            System::Windows::Forms::DataVisualization::Charting::Legend^  legend1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Legend());
            System::Windows::Forms::DataVisualization::Charting::Series^  series1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Series());
            System::Windows::Forms::DataVisualization::Charting::Series^  series2 = (gcnew System::Windows::Forms::DataVisualization::Charting::Series());
            System::Windows::Forms::DataVisualization::Charting::Series^  series3 = (gcnew System::Windows::Forms::DataVisualization::Charting::Series());
            this->label1 = (gcnew System::Windows::Forms::Label());
            this->label2 = (gcnew System::Windows::Forms::Label());
            this->label3 = (gcnew System::Windows::Forms::Label());
            this->label4 = (gcnew System::Windows::Forms::Label());
            this->label5 = (gcnew System::Windows::Forms::Label());
            this->textBox1 = (gcnew System::Windows::Forms::TextBox());
            this->textBox2 = (gcnew System::Windows::Forms::TextBox());
            this->textBox3 = (gcnew System::Windows::Forms::TextBox());
            this->button1 = (gcnew System::Windows::Forms::Button());
            this->button2 = (gcnew System::Windows::Forms::Button());
            this->chart1 = (gcnew System::Windows::Forms::DataVisualization::Charting::Chart());
            this->textBox4 = (gcnew System::Windows::Forms::TextBox());
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->chart1))->BeginInit();
            this->SuspendLayout();
            // 
            // label1
            // 
            this->label1->AutoSize = true;
            this->label1->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 12, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->label1->Location = System::Drawing::Point(124, 9);
            this->label1->Name = L"label1";
            this->label1->Size = System::Drawing::Size(443, 20);
            this->label1->TabIndex = 0;
            this->label1->Text = L"Построение графика функции на интервале [xn;xk]";
            // 
            // label2
            // 
            this->label2->AutoSize = true;
            this->label2->Font = (gcnew System::Drawing::Font(L"Microsoft Sans Serif", 9.75F, System::Drawing::FontStyle::Bold, System::Drawing::GraphicsUnit::Point, 
                static_cast<System::Byte>(204)));
            this->label2->Location = System::Drawing::Point(481, 42);
            this->label2->Name = L"label2";
            this->label2->Size = System::Drawing::Size(130, 16);
            this->label2->TabIndex = 2;
            this->label2->Text = L"Введите данные";
            // 
            // label3
            // 
            this->label3->AutoSize = true;
            this->label3->Location = System::Drawing::Point(469, 64);
            this->label3->Name = L"label3";
            this->label3->Size = System::Drawing::Size(73, 13);
            this->label3->TabIndex = 3;
            this->label3->Text = L"Введите ХN=";
            // 
            // label4
            // 
            this->label4->AutoSize = true;
            this->label4->Location = System::Drawing::Point(469, 88);
            this->label4->Name = L"label4";
            this->label4->Size = System::Drawing::Size(72, 13);
            this->label4->TabIndex = 4;
            this->label4->Text = L"Введите ХK=";
            // 
            // label5
            // 
            this->label5->AutoSize = true;
            this->label5->Location = System::Drawing::Point(469, 111);
            this->label5->Name = L"label5";
            this->label5->Size = System::Drawing::Size(73, 13);
            this->label5->TabIndex = 5;
            this->label5->Text = L"Введите XH=";
            // 
            // textBox1
            // 
            this->textBox1->Location = System::Drawing::Point(547, 61);
            this->textBox1->Name = L"textBox1";
            this->textBox1->Size = System::Drawing::Size(64, 20);
            this->textBox1->TabIndex = 6;
            this->textBox1->Text = L"-10";
            // 
            // textBox2
            // 
            this->textBox2->Location = System::Drawing::Point(547, 85);
            this->textBox2->Name = L"textBox2";
            this->textBox2->Size = System::Drawing::Size(64, 20);
            this->textBox2->TabIndex = 7;
            this->textBox2->Text = L"10";
            // 
            // textBox3
            // 
            this->textBox3->Location = System::Drawing::Point(547, 108);
            this->textBox3->Name = L"textBox3";
            this->textBox3->Size = System::Drawing::Size(64, 20);
            this->textBox3->TabIndex = 8;
            this->textBox3->Text = L"0,01";
            // 
            // button1
            // 
            this->button1->Location = System::Drawing::Point(12, 286);
            this->button1->Name = L"button1";
            this->button1->Size = System::Drawing::Size(191, 27);
            this->button1->TabIndex = 9;
            this->button1->Text = L"Нарисовать график";
            this->button1->UseVisualStyleBackColor = true;
            this->button1->Click += gcnew System::EventHandler(this, &Form1::button1_Click);
            // 
            // button2
            // 
            this->button2->Location = System::Drawing::Point(484, 286);
            this->button2->Name = L"button2";
            this->button2->Size = System::Drawing::Size(121, 27);
            this->button2->TabIndex = 10;
            this->button2->Text = L"Выход";
            this->button2->UseVisualStyleBackColor = true;
            this->button2->Click += gcnew System::EventHandler(this, &Form1::button2_Click);
            // 
            // chart1
            // 
            chartArea1->Name = L"ChartArea1";
            this->chart1->ChartAreas->Add(chartArea1);
            legend1->Name = L"Legend1";
            this->chart1->Legends->Add(legend1);
            this->chart1->Location = System::Drawing::Point(0, 151);
            this->chart1->Name = L"chart1";
            series1->BorderColor = System::Drawing::Color::Red;
            series1->BorderWidth = 5;
            series1->ChartArea = L"ChartArea1";
            series1->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::Spline;
            series1->Color = System::Drawing::Color::Red;
            series1->IsVisibleInLegend = false;
            series1->Legend = L"Legend1";
            series1->Name = L"Series1";
            series1->XValueType = System::Windows::Forms::DataVisualization::Charting::ChartValueType::Double;
            series1->YValueType = System::Windows::Forms::DataVisualization::Charting::ChartValueType::Double;
            series2->BorderColor = System::Drawing::Color::Red;
            series2->BorderWidth = 5;
            series2->ChartArea = L"ChartArea1";
            series2->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::Spline;
            series2->Color = System::Drawing::Color::FromArgb(static_cast<System::Int32>(static_cast<System::Byte>(0)), static_cast<System::Int32>(static_cast<System::Byte>(0)), 
                static_cast<System::Int32>(static_cast<System::Byte>(192)));
            series2->IsVisibleInLegend = false;
            series2->Legend = L"Legend1";
            series2->Name = L"Series2";
            series3->BorderWidth = 5;
            series3->ChartArea = L"ChartArea1";
            series3->ChartType = System::Windows::Forms::DataVisualization::Charting::SeriesChartType::Spline;
            series3->Color = System::Drawing::Color::Green;
            series3->IsVisibleInLegend = false;
            series3->Legend = L"Legend1";
            series3->Name = L"Series3";
            this->chart1->Series->Add(series1);
            this->chart1->Series->Add(series2);
            this->chart1->Series->Add(series3);
            this->chart1->Size = System::Drawing::Size(605, 129);
            this->chart1->TabIndex = 12;
            this->chart1->Text = L"chart1";
            // 
            // textBox4
            // 
            this->textBox4->Location = System::Drawing::Point(61, 49);
            this->textBox4->Name = L"textBox4";
            this->textBox4->Size = System::Drawing::Size(330, 20);
            this->textBox4->TabIndex = 13;
            // 
            // Form1
            // 
            this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
            this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
            this->ClientSize = System::Drawing::Size(618, 328);
            this->Controls->Add(this->textBox4);
            this->Controls->Add(this->chart1);
            this->Controls->Add(this->button2);
            this->Controls->Add(this->button1);
            this->Controls->Add(this->textBox3);
            this->Controls->Add(this->textBox2);
            this->Controls->Add(this->textBox1);
            this->Controls->Add(this->label5);
            this->Controls->Add(this->label4);
            this->Controls->Add(this->label3);
            this->Controls->Add(this->label2);
            this->Controls->Add(this->label1);
            this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedToolWindow;
            this->Name = L"Form1";
            this->Text = L"Выполнил студент группы ЭСА-11-1 Иванов А.Д. Лабораторная работа 4";
            this->Load += gcnew System::EventHandler(this, &Form1::Form1_Load);
            (cli::safe_cast<System::ComponentModel::ISupportInitialize^  >(this->chart1))->EndInit();
            this->ResumeLayout(false);
            this->PerformLayout();
 
        }
#pragma endregion
    
private: System::Void button1_Click(System::Object^  sender, System::EventArgs^  e) {
             
double x,xn,xk,xh,y;
Series^ plot1 = chart1->Series[0];
Series^ plot2 = chart1->Series[1];
Series^ plot3 = chart1->Series[2];
//Очистка компонента Chart1
plot1->Points->Clear();
plot2->Points->Clear();
plot3->Points->Clear();
//Проверка, что введены данные xn, xk, xh и их преобразование в переменные типа Double
if((textBox1->Text!="")&&(textBox2->Text!="")
&&(textBox3->Text!=""))
{
xn = Convert::ToDouble(textBox1->Text);
xk = Convert::ToDouble(textBox2->Text);
xh = Convert::ToDouble(textBox3->Text); 
//Проверка правильности ввода данных
if ((xn>=xk)||(xh>(xk-xn))) 
    { 
MessageBox::Show( "Данные заполнены неверно", "Ошибка       ввода данных",MessageBoxButtons::OK,       MessageBoxIcon::Exclamation );
    } 
else
    {x=xn;
    while (x<=xk) 
    {if (x<=0) {y=x*x+1; plot1->Points->AddXY(x, y);}
else 
    if (x>0&&x<5) {y=cos(x-1);plot2->Points->AddXY(x, y);} 
    else {y=sqrt(x*x*x+2);plot3->Points->AddXY(x, y);}
//Нанесение точки с координатами Х и У в компоненте Chart1
 
        x=x+xh;
       }}
}
else
{
MessageBox::Show( "Заполните, пожалуйста, данные", "Ошибка    ввода данных", MessageBoxButtons::OK, MessageBoxIcon::Exclamation);
}
 
 
         }
private: System::Void button2_Click(System::Object^  sender, System::EventArgs^  e) {Application ::Exit();
         }
 
private: System::Void Form1_Load(System::Object^  sender, System::EventArgs^  e) {
         }
};
}
Посоветуйте, пожалуйста как бы переделать для любой функции, которую введём в текстбокс

Вернуться к обсуждению:
Визуальное програмирование, программа для построения графиков функции C++/CLI WinForms
Миниатюры
Визуальное програмирование, программа для построения графиков функции   Визуальное програмирование, программа для построения графиков функции  
0
Programming
Эксперт
94731 / 64177 / 26122
Регистрация: 12.04.2006
Сообщений: 116,782
28.11.2012, 20:46
Готовые ответы и решения:

Программа построения графиков функции
Вывести на экран в графическом режиме графики двух функций интервале от до с шагом dx. Первая...

Программа для построения графиков
Доброго времени суток! Задача стоит следующая: дан сигнал e(t)=10+8cos(Wt-90)+4cos3(Wt-90)....

Программа для построения графиков
Посоветуйте программу для построения графиков и визуального отображения данных из базы Access....

Программа для построения графиков
Нужна библиотека для создания изображений. Т.Е. создаётся файл имеющий заданное разрешение и...

8
28.11.2012, 20:46
IT_Exp
Эксперт
87844 / 49110 / 22898
Регистрация: 17.06.2006
Сообщений: 92,604
28.11.2012, 20:46
Помогаю со студенческими работами здесь

Программа для построения графиков не работает
Нашёл на просторах интернета код для программы. Расставил формы что бы имена совпадали. Но прога...

Программа для построения графиков в полярной системе координат
Как сделать программу на делфи, которая будет стоить график при вводе какой-либо функции в полярной...

Программа для построения графиков в Microsoft Visual Studio
Среда разработки Microsoft Visual Studio. Смысл программы такой: имеется форма на которой...

Разработать программу для построения графиков функции
Разработать программу для построения графиков функции. Считать из файла, указанного пользователем...

0
КиберФорум - форум программистов, компьютерный форум, программирование
Powered by vBulletin
Copyright ©2000 - 2024, CyberForum.ru