超级菜鸟:speedbutton为何看不见?

KnowLittle 2004-01-06 12:45:35
我改别人的程序,把它的一个speedbutton copy paste,改名,换图片,换位置,为何看不见?
...全文
42 10 打赏 收藏 转发到动态 举报
写回复
用AI写文章
10 条回复
切换为时间正序
请发表友善的回复…
发表回复
耙子 2004-01-06
  • 打赏
  • 举报
回复
估计你得容器选择错了。
rockswj 2004-01-06
  • 打赏
  • 举报
回复
或者设置为透明的,你可以在属性框找到它,然后在看窗体上的具体位置是怎么回事
还有bringtofront等
hthunter 2004-01-06
  • 打赏
  • 举报
回复
看不见的原因应该是被其它的控件盖住了
hthunter 2004-01-06
  • 打赏
  • 举报
回复
在Object TreeView里面把它拖到你要放到的容器里面去
jb99334 2004-01-06
  • 打赏
  • 举报
回复
自己加一个不就得了,再修改属性!
hthunter 2004-01-06
  • 打赏
  • 举报
回复
何苦呢,你直接在你的容器里面新建一个SpeedButton就可以了啊,参照原来的样式修改一下属性,几分钟就搞定了。
你的容器是不是标准控件?如果是的话用上述方式应该就可以解决了,如果是第三方控件而用上面的方法又解决不了的话,那应该就是那个控件的问题。我以前也遇到过类似的问题,后来我就弃用了那个控件。
yongxin800 2004-01-06
  • 打赏
  • 举报
回复
看看在属性编辑器中的,combobox中有没有? 有的话,说明被别的覆盖了
KnowLittle 2004-01-06
  • 打赏
  • 举报
回复
各位帮我看看阿!急死我了!
KnowLittle 2004-01-06
  • 打赏
  • 举报
回复
因为是复制的,所以其他属性应该都是对的
transparent是true

石头兄说得 bringtofront是什么,在哪里看?
KnowLittle 2004-01-06
  • 打赏
  • 举报
回复
我也估计是容器的问题,但是我拖不到我想让他进去的容器里面去.不知道为什么.
我找到容器的代码行,直接照葫芦定义,又报错说这个object未定义
附录:源程序 //-------------------主窗体 查询与浏览--------------------------------------- #include #pragma hdrstop #include "Unit1.h" #include "Unit2.h" #include "Unit3.h" #include "Unit4.h" #include "Unit5.h" #include "Unit6.h" #pragma package(smart_init) #pragma resource "*.dfm" TFmain *Fmain; bool onshow=false; __fastcall TFmain::TFmain(TComponent* Owner) : TForm(Owner) { } void __fastcall TFmain::N5Click(TObject *Sender) { Close();//退出程序 } void __fastcall TFmain::SpeedButton3Click(TObject *Sender) { DataModule3->ADOQuery1->First() ; StatusBar1->Panels->Items[0]->Text="数据指向第一个"; } void __fastcall TFmain::SpeedButton1Click(TObject *Sender) { DataModule3->ADOQuery1->Prior() ; StatusBar1->Panels->Items[0]->Text="数据指向上一个"; } void __fastcall TFmain::SpeedButton2Click(TObject *Sender) { DataModule3->ADOQuery1->Next() ; StatusBar1->Panels->Items[0]->Text="数据指向下一个"; } void __fastcall TFmain::SpeedButton4Click(TObject *Sender) { DataModule3->ADOQuery1->Last() ; StatusBar1->Panels->Items[0]->Text="数据指向最后"; } void __fastcall TFmain::Button2Click(TObject *Sender) { //添加新的数据 Fadd->Caption="添加数据"; DataModule3->ADOQuery1->Append() ; Fadd->ShowModal() ; } void __fastcall TFmain::FormClose(TObject *Sender, TCloseAction &Action) { //对退出程序做确认处理 if(MessageBox(this->Handle,"确定要退出吗?","提示",MB_YESNO+MB_ICONQUESTION) == IDNO) Action=caNone; } void __fastcall TFmain::N10Click(TObject *Sender) { AboutBox->ShowModal() ; //显示关于对话框 } void __fastcall TFmain::Button4Click(TObject *Sender) { //以下为查找语句 AnsiString sql; if(Edit1->Text=="")return; if( ComboBox1->Text =="精确")sql=" ='"+Edit1->Text+"';"; else sql=" like '%"+Edit1->Text+"%';"; sql="select * from renshi where "+ComboBox2->Text+sql; StatusBar1->Panels->Items[0]->Text=sql; DataModule3->ADOQuery1->Active =false; DataModule3->ADOQuery1->SQL->Clear(); DataModule3->ADOQuery1->SQL->Add(sql); DataModule3->ADOQuery1->Active =true; if(DataModule3->ADOQuery1->RecordCount==0) StatusBar1->Panels->Items[1]->Text="无符合条件数据"; else StatusBar1->Panels->Items[1]->Text="符合条件数据个数为:"+IntToStr(DataModule3->ADOQuery1->RecordCount); } void __fastcall TFmain::Button6Click(TObject *Sender) { //以下为显示所有数据 AnsiString sql; sql="select * from renshi;"; StatusBar1->Panels->Items[0]->Text="显示全部数据"; DataModule3->ADOQuery1->Active =false; DataModule3->ADOQuery1->SQL->Clear(); DataModule3->ADOQuery1->SQL->Add(sql); DataModule3->ADOQuery1->Active =true; if(DataModule3->ADOQuery1->RecordCount==0) StatusBar1->Panels->Items[1]->Text="无符合条件数据"; else StatusBar1->Panels->Items[1]->Text="数据总量为:"+IntToStr(DataModule3->ADOQuery1->RecordCount); } void __fastcall TFmain::Button1Click(TObject *Sender) { //刷新显示 DataModule3->ADOQuery1->Active =false; DataModule3->ADOQuery1->Active =true; } void __fastcall TFmain::N9Click(TObject *Sender) { //帮助内容 ShowMessage("\ 大家好,虽然只是一个简单的程序但是也要写帮助。\n\ 简单的操作如下:\n\ 一、打开程序。\n\ 二、可以进行数据的添加、删除、浏览、查找\n\ 三、关闭。\n\ 谢谢使用!\n\ "); } void __fastcall TFmain::Button3Click(TObject *Sender) { //数据删除操作 AnsiString printstr="确定删除编号为"+DataModule3->ADOQuery1->FieldByName("编号")->AsString+"的数据吗?"; if(MessageDlg(printstr,mtWarning,TMsgDlgButtons() << mbOK Delete() ; StatusBar1->Panels->Items[0]->Text="数据已经删除"; } } void __fastcall TFmain::N3Click(TObject *Sender) { //更改显示字体 if(FontDialog1->Execute())Fmain->Font=FontDialog1->Font; } void __fastcall TFmain::N12Click(TObject *Sender) { //更改窗体颜色 if(ColorDialog1->Execute()) { Fmain->Color=ColorDialog1->Color;//主窗体 Fadd->Color=ColorDialog1->Color; //添加、修改窗体 } } void __fastcall TFmain::N13Click(TObject *Sender) { //更改数据域颜色 if(ColorDialog1->Execute()) DBGrid1->Color=ColorDialog1->Color; } void __fastcall TFmain::N11Click(TObject *Sender) { Fshow->QuickRep1->Preview();//打印数据 } void __fastcall TFmain::Button5Click(TObject *Sender) { Fadd->Caption="修改数据"; Fadd->ShowModal() ; //修改数据 } void __fastcall TFmain::FormShow(TObject *Sender) { if(onshow==false) { Fwelcome->ShowModal() ; onshow=true; return; } } //-------------------------------------------------------------------------- //------------系统封面------------------------------------------------------ #include #pragma hdrstop #include "Unit2.h" #include "Unit1.h" #pragma package(smart_init) #pragma resource "*.dfm" TFwelcome *Fwelcome; int logintime=15; //进入系统等待时间X秒 __fastcall TFwelcome::TFwelcome(TComponent* Owner) : TForm(Owner) { } void __fastcall TFwelcome::Timer1Timer(TObject *Sender) { if(logintime==0){ Timer1->Enabled=false; Close(); } logintime--; SpeedButton1->Caption ="进入("+IntToStr(logintime)+")"; } void __fastcall TFwelcome::SpeedButton2Click(TObject *Sender) { Application->Terminate() ; } void __fastcall TFwelcome::SpeedButton1Click(TObject *Sender) { logintime=15; Timer1->Enabled=false; Close(); } //-------------------------------------------------------------------------- //---------------------数据修改窗体----------------------------------------- #include #pragma hdrstop #include "Unit4.h" #include "Unit3.h" #pragma package(smart_init) #pragma resource "*.dfm" TFadd *Fadd; __fastcall TFadd::TFadd(TComponent* Owner) : TForm(Owner) { } void __fastcall TFadd::Button1Click(TObject *Sender) { if(DBEdit1->Text =="")return; DataModule3->ADOQuery1->Refresh() ; Close(); } void __fastcall TFadd::Button2Click(TObject *Sender) { DataModule3->ADOQuery1->Cancel() ; Close(); } void __fastcall TFadd::FormClose(TObject *Sender, TCloseAction &Action) { DataModule3->ADOQuery1->Cancel() ; } //--------------------------------------------------------------------------
unit XMLexample; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, xmldom, XMLIntf, cxGraphics, cxControls, cxLookAndFeels, cxLookAndFeelPainters, dxSkinsCore, dxSkinsDefaultPainters, StdCtrls, Buttons, cxContainer, cxListBox, msxmldom, XMLDoc; type TForm1 = class(TForm) XMLDocument1: TXMLDocument; lstSource: TcxListBox; lstTarget: TcxListBox; SpeedButton2: TSpeedButton; SpeedButton1: TSpeedButton; SpeedButton3: TSpeedButton; SpeedButton4: TSpeedButton; SpeedButton6: TSpeedButton; SpeedButton5: TSpeedButton; SpeedButton7: TSpeedButton; SpeedButton8: TSpeedButton; Button1: TButton; cxListBox1: TcxListBox; cxListBox2: TcxListBox; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure SpeedButton2Click(Sender: TObject); procedure SpeedButton1Click(Sender: TObject); procedure SpeedButton3Click(Sender: TObject); procedure SpeedButton6Click(Sender: TObject); procedure SpeedButton5Click(Sender: TObject); procedure SpeedButton7Click(Sender: TObject); private { Private declarations } public procedure MoveUp(A: TcxListBox); //上移 procedure MoveDown(A: TcxListBox); //下移 procedure DeleteItem(A: TcxListBox); //删除 procedure ReLoadItems(A: TcxListBox; const Flag: Integer = 0); //重置 procedure CreateXML(APath:string); end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin CreateXML('C:\Documents and Settings\Administrator\桌面\XML'); end; procedure TForm1.Button2Click(Sender: TObject); var Node: IXMLNode; Root: IXMLNode; //根节点 ParentNode: IXMLNode; //首节点 StrDir: string; xmlDocument: IXMLDocument; I: Integer; begin xmlDocument := TXMLDocument.Create(nil); StrDir := 'C:\Documents and Settings\Administrator\桌面\XMLConfig.xml'; xmlDocument.XML.LoadFromFile(StrDir); xmlDocument.Active := true; Root := xmlDocument.DocumentElement; //源字段 ParentNode:=Root.ChildNodes.FindNode('FieldsFromSource'); for I := 1 to ParentNode.ChildNodes.Count - 1 do begin Node:=ParentNode.ChildNodes[i]; cxListBox1.Items.Add(Node.ChildValues['FieldName']); end; //目标字段 ParentNode:=Root.ChildNodes.FindNode('FieldsFromTarget'); for I := 1 to ParentNode.ChildNodes.Count - 1 do begin Node:=ParentNode.ChildNodes[i]; cxListBox2.Items.Add(Node.ChildValues['FieldName']); end; end; procedure TForm1.CreateXML(APath: string); var xmlDocument: IXMLDocument; sDir: string; i:Integer; begin xmlDocument := TXMLDocument.Create(nil); with xmlDocument.XML do begin //开始写XML Add(''); Add(''); //源字段信息写入XML if lstSource.Count>0 then begin Add(''); Add('' + IntToStr(lstSource.Count) + ''); for I := 0 to lstSource.Count - 1 do begin Add(''); Add('' + IntToStr(i) + ''); Add(''+ lstSource.Items[i]+''); Add(''+ ''+''); Add(''+ ''+''); Add(''+ ''+''); Add(''+ ''+''); Add(''); end; Add(''); end else begin Add(''); Add('0'); Add(''); end; //目标字段写入XML if lstTarget.Count>0 then begin Add(''); Add('' + IntToStr(lstTarget.Count) + ''); for I := 0 to lstTarget.Count - 1 do begin Add(''); Add('' + IntToStr(i) + ''); Add(''+ lstTarget.Items[i]+''); Add(''+ ''+''); Add(''+ ''+''); Add(''+ ''+''); Add(''+ ''+''); Add(''); end; Add(''); end else begin Add(''); Add('0'); Add(''); end; Add(''); //XML注释 Add(''); Add(''); Add(''); Add(''); Add(''); Add(''); Add(''); Add(''); Add(''); Add(''); //XML结束 end; xmlDocument.Active := True; sDir := APath; if not DirectoryExists(sDir) then begin if not CreateDir(sDir) then begin ShowMessage('创建文件夹失败'); Exit; end; end; xmlDocument.SaveToFile(sDir + 'Config.xml'); end; procedure TForm1.DeleteItem(A: TcxListBox); var _Index: Integer; begin with A do begin if (Items.Count > 0) and (ItemIndex <> -1) then begin _Index := ItemIndex; Items.Delete(_Index); end; end; end; procedure TForm1.MoveDown(A: TcxListBox); var CurrIndex, LastIndex: Integer; begin with A do begin CurrIndex := ItemIndex; LastIndex := Items.Count; if ItemIndex <> -1 then begin if CurrIndex + 1 < LastIndex then begin Items.Move(ItemIndex, (CurrIndex + 1)); ItemIndex := CurrIndex + 1; end; end; end; end; procedure TForm1.MoveUp(A: TcxListBox); var CurrIndex: Integer; begin with A do begin if ItemIndex > 0 then begin CurrIndex := ItemIndex; Items.Move(ItemIndex, (CurrIndex - 1)); ItemIndex := CurrIndex - 1; end; end; end; procedure TForm1.ReLoadItems(A: TcxListBox; const Flag: Integer); begin end; procedure TForm1.SpeedButton1Click(Sender: TObject); begin MoveDown(lstSource); end; procedure TForm1.SpeedButton2Click(Sender: TObject); begin MoveUp(lstSource); end; procedure TForm1.SpeedButton3Click(Sender: TObject); begin DeleteItem(lstSource); end; procedure TForm1.SpeedButton5Click(Sender: TObject); begin MoveDown(lstTarget); end; procedure TForm1.SpeedButton6Click(Sender: TObject); begin MoveUp(lstTarget); end; procedure TForm1.SpeedButton7Click(Sender: TObject); begin DeleteItem(lstTarget); end; end.

5,388

社区成员

发帖
与我相关
我的任务
社区描述
Delphi 开发及应用
社区管理员
  • VCL组件开发及应用社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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