/ Forside / Teknologi / Udvikling / C/C++ / Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn

Kodeord


Reklame
Top 10 brugere
C/C++
#NavnPoint
BertelBra.. 2425
pmbruun 695
Master_of.. 501
Bech_bb 500
kyllekylle 500
jdjespers.. 500
gibson 300
scootergr.. 300
molokyle 287
10  strarup 270
MS Visual C++ forms
Fra : G123456


Dato : 21-11-07 23:09

Hvordan får man forms til at arbejde med egne data.
jeg ønsker i mit program at kunne arbejde med værdier som er lavet i forms
(design).

min c kode:
------------------------------------
// test.cpp : main project file.

#include "stdafx.h"
#include "Form1.h"

using namespace test;

const int vol_min = 10;
const int vol_max = 100;
static int vol_value = 15;
static int mute = false;

//Form1::trackBar1->Minimum = vol_min; // Changing the min volume on the
trackBar
//Form1::trackBar1->Maximun = vol_max; // Changing the max volume on the
trackBar
//Form1::trackBar1->*(Value) = &vol_value; // set the volume on the trackBar

// Isn´t it posibel to set any text at the tick markers on the trackBar ?

//Form1::checkBox1->Checked = mute; // Set the Mute button.

[STAThreadAttribute]
int main(array<System::String ^> ^args)
{
// Enabling Windows XP visual effects before any controls are created
Application::EnableVisualStyles();
Application::SetCompatibleTextRenderingDefault(false);

// Create the main window and run it
Application::Run(gcnew Form1());
return 0;
}
------------------------------------

forms (genereret af visual designer):
------------------------------------------
#pragma once


namespace test {

using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;

/// <summary>
/// Summary for Form1
///
/// WARNING: If you change the name of this class, you will need to change
the
/// 'Resource File Name' property for the managed resource
compiler tool
/// associated with all .resx files this class depends on.
Otherwise,
/// the designers will not be able to interact properly with
localized
/// resources associated with this form.
/// </summary>
public ref class Form1 : public System::Windows::Forms::Form
{
public:
Form1(void)
{
InitializeComponent();
//
//TODO: Add the constructor code here
//
}

protected:
/// <summary>
/// Clean up any resources being used.
/// </summary>
~Form1()
{
if (components)
{
delete components;
}
}

protected:
private: System::Windows::Forms::TrackBar^ trackBar1;
private: System::Windows::Forms::CheckBox^ checkBox1;


private:
/// <summary>
/// Required designer variable.
/// </summary>
System::ComponentModel::Container ^components;

#pragma region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
void InitializeComponent(void)
{
this->trackBar1 = (gcnew System::Windows::Forms::TrackBar());
this->checkBox1 = (gcnew System::Windows::Forms::CheckBox());
(cli::safe_cast<System::ComponentModel::ISupportInitialize^
>(this->trackBar1))->BeginInit();
this->SuspendLayout();
//
// trackBar1
//
this->trackBar1->Location = System::Drawing::Point(83, 89);
this->trackBar1->Name = L"trackBar1";
this->trackBar1->Size = System::Drawing::Size(104, 45);
this->trackBar1->TabIndex = 1;
//
// checkBox1
//
this->checkBox1->AutoSize = true;
this->checkBox1->Location = System::Drawing::Point(83, 33);
this->checkBox1->Name = L"checkBox1";
this->checkBox1->Size = System::Drawing::Size(50, 17);
this->checkBox1->TabIndex = 2;
this->checkBox1->Text = L"Mute";
this->checkBox1->UseVisualStyleBackColor = true;
//
// Form1
//
this->AutoScaleDimensions = System::Drawing::SizeF(6, 13);
this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font;
this->ClientSize = System::Drawing::Size(292, 266);
this->Controls->Add(this->checkBox1);
this->Controls->Add(this->trackBar1);
this->Name = L"Form1";
this->Text = L"Form1";
(cli::safe_cast<System::ComponentModel::ISupportInitialize^
>(this->trackBar1))->EndInit();
this->ResumeLayout(false);
this->PerformLayout();

}
#pragma endregion
};
}
------------------------------------------

Mvh Peter



 
 
Søg
Reklame
Statistik
Spørgsmål : 177558
Tips : 31968
Nyheder : 719565
Indlæg : 6408914
Brugere : 218888

Månedens bedste
Årets bedste
Sidste års bedste