rap2009 发表于 2008-4-15 18:10

如何使得控件浮动显示

请教各位:matlab可不可以设计浮动显示的对话框,或者fig图形,工具栏等

我看了下他们的属性好像都不能,还有工具栏也不可以浮动显示,只能固定在一个地方。

我说的浮动就是可以将其拖拽到窗口的任意位置上,并且总是置于顶层显示,而且焦点可以不落在它上面。

[ 本帖最后由 eight 于 2008-4-15 18:31 编辑 ]

eight 发表于 2008-4-15 18:35

浮动——看看有否与 dock 相关的属性

置顶—— [原创]一个十分简陋的链接修正程序看这个帖子7楼

花如月 发表于 2008-4-15 18:42

这个估计比较麻烦

   多看看控件属性看能否实现

rap2009 发表于 2008-4-17 19:25

好,我先看看,过两天回来反馈
呵呵,这贴子不够14个字,还不让发

eight 发表于 2008-4-17 19:54

我随便在matlab中搜索就找到了:

Docked WindowStyle

When WindowStyle is set to docked, the figure is docked in the desktop or a document window. When you issue the following command,

    set(figure_handle,'WindowStyle','docked')

MATLAB docks the figure identified by figure_handle and sets the DockControls property to on, if it was off.

rap2009 发表于 2008-4-17 21:02

我试过这个dock,它是将fig停靠在matlab窗口上,而不是浮动。

eight 发表于 2008-4-17 21:22

原帖由 rap2009 于 2008-4-17 21:02 发表 http://www.chinavib.com/forum/images/common/back.gif
我试过这个dock,它是将fig停靠在matlab窗口上,而不是浮动。 运行 figure 后,右上角有个 float 的按钮

rap2009 发表于 2008-4-17 21:36

那个float类似于多文档操作时候用的吧,我的意思是想实现页面能像暴风影音的窗口那样,可以显示任何窗口的最前面,并且点击其他页面时,它仍显示在任何窗口的最上面。
感觉好像matlab不能实现这样的功能,vc上的工具栏就可以停靠在窗口的任何地方,可matlab的工具栏就不能,我想原因应该如此吧。

eight 发表于 2008-4-17 21:45

原帖由 rap2009 于 2008-4-17 21:36 发表 http://www.chinavib.com/forum/images/common/back.gif
那个float类似于多文档操作时候用的吧,我的意思是想实现页面能像暴风影音的窗口那样,可以显示任何窗口的最前面,并且点击其他页面时,它仍显示在任何窗口的最上面。
感觉好像matlab不能实现这样的功能,vc上的工具 ... 工具栏浮动估计比较难,但是窗口置顶用 dll 就可以了,我上面在2楼不是给你提示了吗?工具栏浮动是否也可以用 c 做成 dll 呢?没有研究过,给点思路,你自己动手试试吧

[ 本帖最后由 eight 于 2008-4-17 21:52 编辑 ]

rap2009 发表于 2008-4-17 21:59

原帖由 eight 于 2008-4-17 21:45 发表 http://www.chinavib.com/forum/images/common/back.gif
工具栏浮动估计比较难,但是窗口置顶用 dll 就可以了,我上面在2楼不是给你提示了吗?


你的意思是,你做那个软件页面,非最小化时是置顶显示吗?

我运行一下,没有置顶。我没有装vc,我装了后再试试吧,还有你那个动库是实现置顶的吧,那没有源码啊,我自己试试吧。

[ 本帖最后由 rap2009 于 2008-4-17 22:00 编辑 ]

eight 发表于 2008-4-17 22:06

原帖由 rap2009 于 2008-4-17 21:59 发表 http://www.chinavib.com/forum/images/common/back.gif
你的意思是,你做那个软件页面,非最小化时是置顶显示吗?

我运行一下,没有置顶。我没有装vc,我装了后再试试吧,还有你那个动库是实现置顶的吧,那没有源码啊,我自己试试吧。 不会把?我前不久才用完,是置顶的(即总在最前),不需要装vc。你要按照我写的说明文字来下载正确的版本。如果确实不行,那你告诉我你用的 matlab 版本

源码就没有了,其实就两行代码,你到 simwe 论坛搜索一下吧,taohe 老大的作品
——居然让我找到了,哈哈:


/*=================================================================
* mexwndontop ---- makes an MATLAB window always on top
*
* Use this command-line to compile in MATLAB:
* mex mexwndontop.cpp user32.lib
*
* Input ---- A string
* Output ---- None
*
* Created by: taohe for simwe forum
*=================================================================*/
/* $Revision: 1.10 $ */
#include <windows.h>
#include "mex.h"
void mexFunction( int nlhs, mxArray *plhs[],
    int nrhs, const mxArray*prhs[] )
   
{
char *input_buf;
int   buflen,status;
    /* Check for proper number of arguments */
if (nrhs != 1) {
mexErrMsgTxt("One input argument required.");
    } else if (nlhs > 1) {
mexErrMsgTxt("Too many output arguments.");
    }
/* Input must be a string. */
if (mxIsChar(prhs) != 1)
    mexErrMsgTxt("Input must be a string.");
/* Input must be a row vector. */
if (mxGetM(prhs) != 1)
    mexErrMsgTxt("Input must be a row vector.");
/* Get the length of the input string. */
buflen = (mxGetM(prhs) * mxGetN(prhs)) + 1;
/* Allocate memory for input and output strings. */
input_buf = (char *)mxCalloc(buflen, sizeof(char));
/* Copy the string data from prhs into a C string
   * input_buf. If the string array contains several rows,
   * they are copied, one column at a time, into one long
   * string array. */
status = mxGetString(prhs, input_buf, buflen);
if (status != 0)
    mexWarnMsgTxt("Not enough space. String is truncated.");
    /* Do the actual computations in a subroutine */
//mexWarnMsgTxt(input_buf);
HWND hWnd;
hWnd = FindWindow(NULL, input_buf);
SetWindowPos(hWnd, HWND_TOPMOST, 0, 0, 1, 1, SWP_NOSIZE | SWP_DRAWFRAME);
return;
}


[ 本帖最后由 eight 于 2008-4-17 22:23 编辑 ]

rap2009 发表于 2008-4-18 10:26

原帖由 eight 于 2008-4-17 22:06 发表 http://www.chinavib.com/forum/images/common/back.gif
不会把?我前不久才用完,是置顶的(即总在最前),不需要装vc。你要按照我写的说明文字来下载正确的版本。如果确实不行,那你告诉我你用的 matlab 版本

源码就没有了,其实就两行代码,你到 simwe 论坛搜索一下吧 ...

老八谢谢你,我两个版本都下载了,把两个都解压了,可能后来的6.5版本文件把7.1的覆盖了,所以在执行时,就实现不了置顶了,现在能了,mexwndontop.mexw32这个文件就是你上面代码mex出来的吧,再次感谢了。

eight 发表于 2008-4-18 10:42

原帖由 rap2009 于 2008-4-18 10:26 发表 http://www.chinavib.com/forum/images/common/back.gif
mexwndontop.mexw32这个文件就是你上面代码mex出来的吧
是的
页: [1]
查看完整版本: 如何使得控件浮动显示