ToolBar和Menu之间的BUG! |
尚未結案
|
power2010
一般會員 發表:10 回覆:11 積分:4 註冊:2004-11-11 發送簡訊給我 |
点击这个工具栏做成的菜单,File-BUG! 后,窗体变为BSNONE方式,这时,
在FORM上使用右键单击,发现POPMENU1的FILE项目变空! 我无法解决这个问题,请教各位大侠看看,谢谢了
----------------------------------------
Unit1.pas
-----------------------------------------
unit Unit1; interface uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, ToolWin, Menus, StdCtrls; type
TForm1 = class(TForm)
PopupMenu1: TPopupMenu;
Edit1: TMenuItem;
GoTo1: TMenuItem;
Replace1: TMenuItem;
Find1: TMenuItem;
File1: TMenuItem;
New1: TMenuItem;
ToolBar1: TToolBar;
ToolButton1: TToolButton;
ToolButton2: TToolButton;
Label1: TLabel;
procedure New1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end; var
Form1: TForm1; implementation {$R *.DFM} procedure TForm1.New1Click(Sender: TObject);
begin
ToolBar1.Visible:=False;
Form1.BorderStyle:=bsNone;
end; end. ----------------------------------------------------------------
Unit1.dfm内容
----------------------------------------------------------------
object Form1: TForm1
Left = 192
Top = 107
Width = 621
Height = 308
Caption = 'Form1'
Color = clBtnFace
Font.Charset = GB2312_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PopupMenu = PopupMenu1
PixelsPerInch = 96
TextHeight = 12
object Label1: TLabel
Left = 112
Top = 176
Width = 342
Height = 24
Caption =
'点击这个工具栏做成的菜单,File-BUG! 后,窗体变为BSNONE方式,'#13#10'这时,'
'在FORM上使用右键单击,发现POPMENU1的FILE项目变空!'
end
object ToolBar1: TToolBar
Left = 0
Top = 0
Width = 613
Height = 29
ButtonHeight = 20
ButtonWidth = 37
Caption = 'ToolBar1'
ShowCaptions = True
TabOrder = 0
object ToolButton1: TToolButton
Left = 0
Top = 2
Caption = '&File'
Grouped = True
MenuItem = File1
end
object ToolButton2: TToolButton
Left = 37
Top = 2
Caption = '&Edit'
Grouped = True
MenuItem = Edit1
PopupMenu = PopupMenu1
end
end
object PopupMenu1: TPopupMenu
Left = 88
Top = 72
object File1: TMenuItem
Caption = '&File'
object New1: TMenuItem
Caption = 'BUG!'
OnClick = New1Click
end
end
object Edit1: TMenuItem
Caption = '&Edit'
object Find1: TMenuItem
Caption = '&Find...'
end
object Replace1: TMenuItem
Caption = 'R&eplace...'
end
object GoTo1: TMenuItem
Caption = '&Go To...'
end
end
end
end 發表人 - power2010 於 2004/11/15 14:26:23
|
power2010
一般會員 發表:10 回覆:11 積分:4 註冊:2004-11-11 發送簡訊給我 |
|
wameng
版主 發表:31 回覆:1336 積分:1188 註冊:2004-09-16 發送簡訊給我 |
具體原因,由於近來甚忙也就不求甚解。 嘿嘿... 之前我遇到過使用 TWebBrowser 當 FormStyle 設為 BsNone 。
也會出現怪問題。{應該是 Delphi BUG }
當時有找出解決方法,拿來套用{沒想到!居然可以}。
看來原因應該是一樣的。
procedure TForm1.New1Click(Sender: TObject); procedure DoBroderNone; var WStyle : Longint; begin WStyle := GetWindowLong(handle,GWL_STYLE); WStyle := WStyle and (not WS_CAPTION) and (not WS_BORDER) and (not WS_THICKFRAME); WStyle := WStyle or WS_POPUP ; SetWindowLong(Handle,GWL_STYLE,WStyle); SetWindowPos (Handle,HWND_TOP,0,0,Width,Height,SWP_SHOWWINDOW or SWP_NOMOVE or SWP_DRAWFRAME); end; begin ToolBar1.Visible:=False; DoBroderNone; //Form1.BorderStyle:=bsNone; end;我在 Windows XP,2000 運行正常,Win9x 可能您要試一下! 發表人 - wameng 於 2004/11/15 22:59:32 |
power2010
一般會員 發表:10 回覆:11 積分:4 註冊:2004-11-11 發送簡訊給我 |
本站聲明 |
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。 2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。 3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇! |