c++ builder学习
1 界面设计
为对话框添加背景图片
方法 :在对话框中添加Additional中的image控件,然后找到其picture属性添加图片
按钮:
在c++ builder中按钮有三种TButton,TBitBtn,TSpeedbtn,后两者可以改变其背景图片,方法:点击其glyph属性
树形控件:
String str[5]={"朋友","同事","家人","同学","好朋友"};
TreeView1->Items->Clear();//删除所有节点
int i=0,j=0,count=0;
for(i;i<5;i++)
{
TreeView1->Items->Add(NULL,str[i]);
}
String strname = NULL;
TTreeNode *Node1;
for(i=0;i<5;i++)
{
Node1 = TreeView1->Items->Item[count];
for(j=0;j<10;j++)
{
strname = str[i] + IntToStr(j);
TreeView1->Items->AddChild(Node1,strname);
count++;
}
count=count+1;
}
HRGN hRgnr = CreateEllipticRgn(0,0,BitBtn1->Width,BitBtn1->Height);//改变按钮的形状 圆形
SetWindowRgn(BitBtn1->Handle,hRgnr,TRUE);
Form2->Canvas->TextOut(10,10,"hello world");