/
Forside
/
Teknologi
/
Udvikling
/
C/C++
/
Nyhedsindlæg
Login
Glemt dit kodeord?
Brugernavn
*
Kodeord
*
Husk mig
Brugerservice
Kom godt i gang
Bliv medlem
Seneste indlæg
Find en bruger
Stil et spørgsmål
Skriv et tip
Fortæl en ven
Pointsystemet
Kontakt Kandu.dk
Emnevisning
Kategorier
Alfabetisk
Karriere
Interesser
Teknologi
Reklame
Top 10 brugere
C/C++
#
Navn
Point
1
BertelBra..
2425
2
pmbruun
695
3
Master_of..
501
4
jdjespers..
500
5
kyllekylle
500
6
Bech_bb
500
7
scootergr..
300
8
gibson
300
9
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
Alle emner
Teknologi
Udvikling
C/C++
Indstillinger
Spørgsmål
Tips
Usenet
Reklame
Statistik
Spørgsmål :
177577
Tips :
31968
Nyheder :
719565
Indlæg :
6409071
Brugere :
218888
Månedens bedste
Årets bedste
Sidste års bedste
Copyright © 2000-2024 kandu.dk. Alle rettigheder forbeholdes.