如何实现Toolbar不够长的时候右边自动出来一个下拉按钮,并把隐藏的按钮项目放到菜单里面?我想可以用放到toolbar里的speedbutton来做那个下拉按钮并配合popupmenu来实现,但是遇到xpmenu等修改界面控件的时候就会出现toolbutton和speedbutton风格的不一致。我想问:1。怎样改变toolbar中某一个toolbutton的大小,并且不影响其他toolbutton。因为按照我上面的想法,用地道的toolbutton要比speedbutton好得多。2。如果不行,那么请推荐给我一个能够实现题目功能的控件,要求:
(1)能够和xpmenu之类的界面修改控件很好的配合,这样才能保证界面风格的一致性。
(2)最好在商业应用中能够免费。
(3)我知道D6的VCL自带的TActionToolbar,但是好像不能和xpmenu配合,并且界面生硬,最好不要告诉我是这个。
/////////////////////////////////////我更希望能够得到第一个问题的答案,谢谢!
(1)能够和xpmenu之类的界面修改控件很好的配合,这样才能保证界面风格的一致性。
(2)最好在商业应用中能够免费。
(3)我知道D6的VCL自带的TActionToolbar,但是好像不能和xpmenu配合,并且界面生硬,最好不要告诉我是这个。
/////////////////////////////////////我更希望能够得到第一个问题的答案,谢谢!
解决方案 »
- TTable 访问问题(oracle database link)
- 在delphi中如何设置才能使代码窗口中出现标注语句块的竖线呢?
- 一个初学者的疑问
- 大家看看怎么回事!
- 太难了,很多人不会
- 网络蚂蚁
- 如何正常关闭带有退出询问的外部程序?
- 请问怎么做才可以在子类窗体中看到父类窗口中建立的控件呢?
- 请问DELPHI编写的程序可以不使用动态链接库等。而在别的机器上别的WIN操作系统运行吗?
- alec_ma,你好!打包sql server是不是得用sql server本身环境来备份或恢复,能不能用sql语句来操作呢?
- 一个界面要求高,布局合理商业软件如何布局耳目一新的主窗口和子窗口,请给出建议,来者有分??
- access数据库中更新的SQL语句是什么啊,许多更新的语句在SQLSERVER中好使 但access出现错误
procedure TToolBar.CreateButtons(NewWidth, NewHeight: Integer); function ToolButtonVisible: Boolean;
var
I: Integer;
Control: TControl;
begin
for I := 0 to FButtons.Count - 1 do
begin
Control := TControl(FButtons[I]);
if (Control is TToolButton) and ((csDesigning in ComponentState) or
Control.Visible) and not (TToolButton(Control).Style in
[tbsSeparator, tbsDivider]) then
begin
Result := True;
Exit;
end;
end;
Result := False;
end;var
ImageWidth, ImageHeight: Integer;
I: Integer;
begin
BeginUpdate;
try
HandleNeeded;
Perform(TB_BUTTONSTRUCTSIZE, SizeOf(TTBButton), 0);
Perform(TB_SETINDENT, FIndent, 0);
if FImages <> nil then
begin
ImageWidth := FImages.Width;
ImageHeight := FImages.Height;
end
else if FDisabledImages <> nil then
begin
ImageWidth := FDisabledImages.Width;
ImageHeight := FDisabledImages.Height;
end
else if FHotImages <> nil then
begin
ImageWidth := FHotImages.Width;
ImageHeight := FHotImages.Height;
end
else
begin
ImageWidth := 0;
ImageHeight := 0;
end;//注意这句: Perform(TB_SETBITMAPSIZE, 0, MakeLParam(ImageWidth, ImageHeight));//<---------//我看了delphi里面有关TB_SETBITMAPSIZE的帮助,似乎windows并不支持toolbar的toolbuttons有不同大小。那么第一个问题无答案,不知道这样的判断是不是太早了 { Adjust the working height if there is a visible TToolButton whose caption
height is automatically added by the common control. }
// if ShowCaptions and ToolButtonVisible then Dec(NewHeight, FHeightMargin);
{ Prevent toolbar from setting default button size }
if NewWidth <= 0 then NewWidth := 1;
if NewHeight <= 0 then NewHeight := 1;
Perform(TB_SETBUTTONSIZE, 0, MakeLParam(NewWidth, NewHeight));
FButtonWidth := NewWidth;
FButtonHeight := NewHeight;
finally
EndUpdate;
end;
{ Retrieve current button sizes }
for I := 0 to InternalButtonCount - 1 do Perform(TB_DELETEBUTTON, 0, 0);
UpdateButtons;
UpdateImages;
GetButtonSize(FButtonWidth, FButtonHeight);
end;
再出现
所有button的宽度大于窗体或父控件的宽度的时候
你应该把超出的个数计算出来,然后添加一个双箭头的button,
并且是下拉式的,然后再往里面添加超出的button.
说得这么简单其实实现起来非常麻烦.建议下载toolbar2000控件
他的那个计算函数恐怖689行。大概的思路应该是这样
是否免费?
有无源码?
做界面,出现快捷菜单(就是ToolBar)折行的问题!
客户要求像IE那样在显示不下的情况下,出现下拉当然TB2k可实现差不多的效果,可是使用起来的机制好像有些不同!
因为我的ToolBarButton是动态创建的,而TB2k的相应方法不一样!
要是更换控件的话,我的单元要有大的改动!唉~烦恼中!
:(
见过没用过!
去找找这方面的资料去~
Creates a toolbar window and adds the specified buttons to the toolbar. Note: This function is obsolete. Use CreateWindow instead. ???????????????????????????HWND CreateToolbarEx(
HWND hwnd,
DWORD ws,
UINT wID,
int nBitmaps,
HINSTANCE hBMInst,
UINT_PTR wBMID,
LPCTBBUTTON lpButtons,
int iNumButtons,
int dxButton,
int dyButton,
int dxBitmap,
int dyBitmap,
UINT uStructSize
);Parameters
hwnd
Handle to the parent window for the toolbar.
ws
Window styles for the toolbar. The WS_CHILD style is included by default. This parameter can also include a combination of styles as discussed in Toolbar Control and Button Styles.
wID
Control identifier for the toolbar.
nBitmaps
Number of button images contained in the bitmap specified by hBMInst and wBMID.
hBMInst
Module instance with the executable file that contains the bitmap resource.
wBMID
Resource identifier for the bitmap resource. If hBMInst is NULL, this parameter must be a valid bitmap handle.
lpButtons
Address of an array of TBBUTTON structures that contain information about the buttons to add to the toolbar.
iNumButtons
Number of buttons to add to the toolbar.
dxButton
Width, in pixels, of the buttons to add to the toolbar.
dyButton
Height, in pixels, of the buttons to add to the toolbar.
dxBitmap
Width, in pixels, of the button images to add to the buttons in the toolbar.
dyBitmap
Height, in pixels, of the button images to add to the buttons in the toolbar.
uStructSize
Size of a TBBUTTON structure.
Return Values
Returns the window handle to the toolbar if successful, or NULL otherwise. To retrieve extended error information, call GetLastError. Res
Windows 95: The system can support a maximum of 16,364 window handles. Requirements
Windows NT/2000: Requires Windows NT 3.51 or later
Windows 95/98/Me: Requires Windows 95 or later
Header: Declared in commctrl.h.
Import Library: comctl32.lib.