资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

浮动工具条vb.net 可以浮动字迹的工具

如何创建C#版浮动工具栏

1、拖动出来以后,需要创建一个大小合适的窗口,作为工具栏新的停靠容器,这个窗口可以这样设置:

创新互联是一家集网站建设,夏县企业网站建设,夏县品牌网站建设,网站定制,夏县网站建设报价,网络营销,网络优化,夏县网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;

ShowIcon = false;

ShowInTaskbar = false;

TopMost = true;

2、浮动工具栏可以扩展自.Net

Framework提供的ToolStrip,它被拖动都某个位置,松开鼠标左键时,会触发EndDarg事件,在这个事件中,我们将其从原来的停靠容器中移除,同时根据鼠标左键松开时,在鼠标所在位置上创建一个窗口,作为工具栏的新容器。

这个就是基本的思路了,下面是浮动工具栏FloatToolstrip 具体的实现代码:

[csharp] view plain copy print?

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Drawing;

using System.Data;

using System.Text;

using System.Windows.Forms;

namespace FloatToolStripDemo

{

public partial class FloatToolstrip : ToolStrip

{

private ToolStripPanel tsPanel;

public FloatToolstrip()

{

InitializeComponent();

this.EndDrag += new EventHandler(MyToolStrip_EndDrag);

this.SizeChanged += new EventHandler(MyToolStrip_SizeChanged);

}

private ToolStripFloatWindow floatForm;

public ToolStripFloatWindow FloatForm

{

get { return floatForm; }

set

{

floatForm = value;

if (floatForm != null)

{

floatForm.LocationChanged += new EventHandler(floatForm_LocationChanged);

floatForm.FormClosing += new FormClosingEventHandler(floatForm_FormClosing);

}

}

}

void floatForm_FormClosing(object sender, FormClosingEventArgs e)

{

e.Cancel = true;

}

private void floatForm_LocationChanged(object sender, EventArgs e)

{

//当floatwindws的位置移动到toolstrippanel中时,将this放置到 toolstripPanel上

if (this.floatForm == null)

{

return;

}

else

{

if (floatForm.HasCreated)

{

Point currentPt = new Point(floatForm.Location.X, floatForm.Location.Y);

Point minPt = this.tsPanel.PointToScreen(tsPanel.Location);

Point maxPt;

if (this.tsPanel.Height = 20)

{

maxPt = new Point(minPt.X + this.tsPanel.Width, minPt.Y + 20);

}

else

{

maxPt = new Point(minPt.X + this.tsPanel.Width, minPt.Y + this.tsPanel.Height);

}

if ((currentPt.X minPt.X) (currentPt.X maxPt.X) (currentPt.Y minPt.Y - 25) (currentPt.Y maxPt.Y - 25))

{

this.floatForm.Controls.Remove(this);

this.tsPanel.SuspendLayout();

this.tsPanel.Controls.Add(this);

this.Location = this.tsPanel.PointToClient(currentPt);

this.tsPanel.ResumeLayout();

this.floatForm.Dispose();

this.floatForm = null;

}

}

}

}

public bool isFloating

{

get

{

return (floatForm != null);

}

}

public ToolStripPanel ToolStripPanel

{

get

{

return this.tsPanel;

}

set

{

this.tsPanel = value;

}

}

private void MyToolStrip_EndDrag(object sender, EventArgs e)

{

//判断移除时

if (this.tsPanel == null)

{

MessageBox.Show("请先设置ToolStripPanel属性");

return;

}

Point dockPoint = Cursor.Position;

int openX, openY;

openX = dockPoint.X;

openY = dockPoint.Y;

Point clientPt = this.tsPanel.Parent.PointToClient(dockPoint);

if (clientPt.Y tsPanel.Height)

{

ToolStripFloatWindow tsfw = new ToolStripFloatWindow();

this.tsPanel.Controls.Remove(this);

tsfw.Controls.Add(this);

this.Left = 0;

this.Top = 0;

this.FloatForm = tsfw;

Point newLoc = new Point(openX, openY);

tsfw.Show();

tsfw.Location = newLoc;

tsfw.SetBounds(newLoc.X, newLoc.Y, this.ClientSize.Width, this.ClientSize.Height+25);

}

}

private void MyToolStrip_SizeChanged(object sender, EventArgs e)

{

if (this.isFloating)

{

this.floatForm.Width = this.ClientSize.Width;

}

}

}

}

动态创建的作为浮动工具栏临时容器的窗口,需要加入一些处理技巧,以免发生在创建该窗口的工作尚未结束时,Dispose了这个窗口,这种情况发生在快速拖动工具栏时,触发了EndDrag事件,导致去创建临时窗口作为工具栏新的容器,而这时又将工具栏拖回原停靠容器中,会导致Dispose还没有创建完毕的临时窗口,发生异常!

vb.net怎么制作浮动菜单?用toolbar吗,还是其他的?vs2008怎么找不到toolbar?那里加载?

可以做一个窗体,该窗体中放入你需要的菜单。

这个窗体几个特殊设置:

1。TOPmost设置为TRUE

2。Formborderstyle设置为none

3。showintaskbar设置为False

4。size设置为你的菜单大小

用的时候new一下就有啦!

这样就相当于悬浮窗体了,细节自己研究吧!^_^

如何禁止对话框关闭按钮和浮动工具条上的系统菜单

1、禁止对话框中的关闭按钮有二种方法。 第一种方法 ,用ModiftMenu()涵数来实现: CMenu* pMenu = this-GetSystemMenu(FALSE); pMenu-ModifyMenu(SC_CLOSE,MF_BYCOMMAND | MF_GRAYED );第二种方法 ,用EnableMenuItem()涵数来实现: CMenu* pMenu = this-GetSystemMenu(FALSE); pMenu-EnableMenuItem( SC_CLOSE, MF_BYCOMMAND|MF_GRAYED); 2、禁止浮动工具条上的系统菜单。 新建一个CToolBar的派生类CxxToolBar,在新类中的左键双击(CxxToolBar::OnLButtonDblClk(...))和左键单击(CxxToolBar:: OnLButtonDown(...))涵数中分别加入下面代码既可: if (IsFloating()) //工具条正在浮动状态中{CWnd* pMiniFrame; CWnd* pDockBar; pDockBar = GetParent(); pMiniFrame = pDockBar-GetParent(); //去除其上系统菜单 pMiniFrame-ModifyStyle(WS_SYSMENU, NULL); //重绘工具条 pMiniFrame-ShowWindow(SW_HIDE); pMiniFrame-ShowWindow(SW_SHOW);}3、禁止窗口最大化按钮

Mac系统屏幕下方的浮动工具条会自动隐藏,怎么让他不自动隐藏

1、首先点击屏幕左上角的苹果标志。

2、选择“系统偏好设置”。

3、打开后,选择“dock”,注意,10.14以上版本的Mac系统中这里叫“程序坞”。

4、取消勾选自动显示和隐藏Dock。

5、取消之后,下方就会出现工具条了。

6、最后点击左上角的红色叉号,关闭系统偏好设置即可。

怎么让VB CommandBars靠左侧边框显示,或者浮动显示?

创建工具栏很简单,直接使用CommandBars集合的Add方法,除了需要指定Name属性之外,可以接受其它所有的默认属性值。可以通过Position属性指定工具栏显示的位置。

Position属性的值由msoBarPosition常数指定。

msoBarLeft: 0,工具栏显示在工作表左边

msoBarTop: 1,工具栏显示在工作表上边

msoBarRight: 2,工具栏显示在工作表右边

msoBarBottom: 3,工具栏显示在工作表下边

msoBarFloating: 4,工具栏浮动显示

msoBarMenuBar: 5,这个常数表示创建菜单栏,不用于创建工具栏

msoBarPopup: 6,这个常数表示创建弹出菜单


网站题目:浮动工具条vb.net 可以浮动字迹的工具
新闻来源:http://cdkjz.cn/article/dooshhe.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

业务热线:400-028-6601 / 大客户专线   成都:13518219792   座机:028-86922220