代码编GUI编译成功但是窗口无内容,连标题都没,高分求助!!!

staybye 2009-10-31 12:51:43
---------------------------------------------head-----------------------------------------------------
#pragma once
#using <mscorlib.dll>
#using <system.dll>
#using <system.drawing.dll>
#using <system.windows.forms.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::Windows::Forms;
public __gc class RadioB:public Form
{
public:
RadioB();
private:
Label*promptL,*dispL;//标签
RadioButton*questionB,*informationB,*exclamationB,*errorB,*okB,*okcB,*abortB,*retryB,*yesnoB,*yesnocB;//单选按钮 CheakBox为复选
Button*dispB;
GroupBox*iconbox,*buttonbox;//
static MessageBoxIcon icontype=MessageBoxIcon::Error;
static MessageBoxButtons buttontype=MessageBoxButtons::OK;//
void initcom();
void buttontype_CheakedChanged(Object*,EventArgs*);
void icontype_CheakedChanged(Object*,EventArgs*);//
void dispB_Click(Object*,EventArgs*);
};


-------------------------------------------cpp-------------------------------------------------------------
#include"RadioB.h"
RadioB::RadioB()
{
void initcom();
}
void RadioB::initcom()
{
this->questionB=new RadioButton();
this->informationB=new RadioButton();
this->exclamationB=new RadioButton();
this->errorB=new RadioButton();
this->okB=new RadioButton();
this->okcB=new RadioButton();
this->abortB=new RadioButton();
this->retryB=new RadioButton();
this->yesnoB=new RadioButton();
this->yesnocB=new RadioButton();
this->iconbox=new GroupBox();
this->buttonbox=new GroupBox();
this->dispB=new Button();
this->promptL=new Label();
this->dispL=new Label();//变量定义完进入layout
this->SuspendLayout();
this->buttonbox->SuspendLayout();
this->iconbox->SuspendLayout();

//buttongroup
RadioButton*buttonarry[ ]={this->okB,this->okcB,this->abortB,this->retryB,this->yesnoB,this->yesnocB};
this->buttonbox->Controls->AddRange(buttonarry);
this->buttonbox->Name=S"buttonbox";
this->buttonbox->Location=Point(16,56);
this->buttonbox->Size=Drawing::Size(152,272);
this->buttonbox->Text=S"Button Type";
this->buttonbox->TabIndex=0;//用处?
//okB
this->okB->Checked=true;
this->okB->Location=Point(16,24);
this->okB->Name=S"okB";
this->okB->Size=Drawing::Size(100,23);
this->okB->Text=S"OK";
this->okB->CheckedChanged+=new EventHandler(this,&RadioB::buttontype_CheakedChanged);
//okcB
this->okcB->Location=Point(16,64);
this->okcB->Name=S"okcB";
this->okcB->Size=Drawing::Size(100,23);
this->okcB->Text=S"OKCancel";
this->okcB->CheckedChanged+=new EventHandler(this,&RadioB::buttontype_CheakedChanged);
//abortB
this->abortB->Location=Point(16,104);
this->abortB->Name=S"abortB";
this->abortB->Size=Drawing::Size(100,23);
this->abortB->Text=S"AbortRetry";
this->abortB->CheckedChanged+=new EventHandler(this,&RadioB::buttontype_CheakedChanged);
//retryB
this->retryB->Location=Point(16,144);
this->retryB->Name=S"retryB";
this->retryB->Size=Drawing::Size(100,23);
this->retryB->Text=S"Retry";
this->retryB->CheckedChanged+=new EventHandler(this,&RadioB::buttontype_CheakedChanged);
//yesnoB
this->yesnoB->Location=Point(16,184);
this->yesnoB->Name=S"yesnoB";
this->yesnoB->Size=Drawing::Size(100,23);
this->yesnoB->Text=S"YesNo";
this->yesnoB->CheckedChanged+=new EventHandler(this,&RadioB::buttontype_CheakedChanged);
//yesnocB
this->yesnocB->Location=Point(16,24);
this->yesnocB->Name=S"yesnocB";
this->yesnocB->Size=Drawing::Size(100,23);
this->yesnocB->Text=S"YESnoCANCEL";
this->yesnocB->CheckedChanged+=new EventHandler(this,&RadioB::buttontype_CheakedChanged);
//icontype
//icongroup
RadioButton*iconarry[ ]={this->questionB,this->informationB,this->exclamationB,this->errorB};
this->iconbox->Controls->AddRange(iconarry);
this->iconbox->Name=S"iconbox";
this->iconbox->Location=Point(200,56);
this->iconbox->Size=Drawing::Size(136,176);
this->iconbox->Text=S"Icon Type";
//this->iconbox->TabIndex=1;
//questionB
this->questionB->Location=Point(16,24);
this->questionB->Name=S"questionB";
this->questionB->Size=Drawing::Size(100,23);
this->questionB->Text=S"Question";
this->questionB->CheckedChanged+=new EventHandler(this,&RadioB::icontype_CheakedChanged);
//informationB
this->informationB->Location=Point(16,64);
this->informationB->Name=S"informationB";
this->informationB->Size=Drawing::Size(100,23);
this->informationB->Text=S"Information";
this->informationB->CheckedChanged+=new EventHandler(this,&RadioB::icontype_CheakedChanged);
//exclamationB
this->exclamationB->Location=Point(16,104);
this->exclamationB->Name=S"exclamationB";
this->exclamationB->Size=Drawing::Size(100,23);
this->exclamationB->Text=S"Exclamation";
this->exclamationB->CheckedChanged+=new EventHandler(this,&RadioB::icontype_CheakedChanged);
//errorB
this->errorB->Checked=true;
this->errorB->Location=Point(16,144);
this->errorB->Name=S"errorB";
this->errorB->Size=Drawing::Size(100,23);
this->errorB->Text=S"Error";
this->errorB->CheckedChanged+=new EventHandler(this,&RadioB::icontype_CheakedChanged);
//所有单选定义完成
//dispB
this->dispB->Location=Point(200,240);
this->dispB->Name=S"dispB";
this->dispB->Size=Drawing::Size(136,48);
this->dispB->Text=S"Display";
this->dispB->TabIndex=2;
this->dispB->Click+=new EventHandler(this,&RadioB::dispB_Click);
//label part
//dispL
this->dispL->Location=Point(200,304);
this->dispL->Name=S"dispL";
this->dispL->Size=Drawing::Size(136,24);
//promptL
this->promptL->Location=Point(8,6);
this->promptL->Name=S"promptL";
this->promptL->Size=Drawing::Size(344,244);
//this->promptL->Font=new Drawing::Font(
this->promptL->Text=S"你想要输出那种形式的对话框呢?";
//mainframe
this->AutoScaleBaseSize=Drawing::Size(5,13);
this->ClientSize=Drawing::Size(360,340);
Control*conall[ ]={this->iconbox,this->buttonbox,this->dispB,this->promptL,this->dispL};
this->Controls->AddRange(conall);
this->Name=S"initcom";
this->Text=S"很无聊的代码版对话框编程";
//here can resume layout
this->buttonbox->ResumeLayout();
this->iconbox->ResumeLayout();
this->ResumeLayout();
}
void RadioB::buttontype_CheakedChanged(Object*sender,EventArgs*e)
{
if(sender==okB)buttontype=MessageBoxButtons::OK;//
if(sender==okcB)buttontype=MessageBoxButtons::OKCancel;
if(sender==abortB)buttontype=MessageBoxButtons::AbortRetryIgnore;
if(sender==retryB)buttontype=MessageBoxButtons::RetryCancel;
if(sender==yesnoB)buttontype=MessageBoxButtons::YesNoCancel;
if(sender==yesnocB)buttontype=MessageBoxButtons::YesNoCancel;
}
void RadioB::icontype_CheakedChanged(Object*sender,EventArgs*e)
{
if(sender==questionB)icontype=MessageBoxIcon::Question;
if(sender==informationB)icontype=MessageBoxIcon::Information;
if(sender==exclamationB)icontype=MessageBoxIcon::Exclamation;
if(sender==errorB)icontype=MessageBoxIcon::Error;
}
//display button
void RadioB::dispB_Click(Object*sender,EventArgs*e)
{
MessageBox::Show(S"这就是你的对话框选择",S"标题",buttontype,icontype);//可查函数定义参数顺序

}
...全文
63 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
staybye 2009-10-31
  • 打赏
  • 举报
回复
有人知道吗,你们黏上试试吧,随便搞个主函数就能运行的

7,540

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧