Move or resize control in parent window
V = move(c)
V = move(c,position)
mwsamp control and change its
f = figure('Position',[100 100 200 200]); h = actxcontrol('mwsamp.mwsampctrl.1',[0 0 200 200],f); pos = move(h,[50 50 200 200])
pos = 50 50 200 200
mwsamp control to always be centered in
the figure as you resize the figure window.
Create a script
resizectrl.m with the following
% Get the new position and size of the figure window fpos = get(gcbo,'position'); % Resize the control accordingly move(h,[0 0 fpos(3) fpos(4)]);
Create the control and run the script. Notice that the circle moves so that it is always positioned in the center of the window.
f = figure('Position',[100 100 200 200]); h = actxcontrol('mwsamp.mwsampctrl.1',[0 0 200 200]); set(f,'ResizeFcn','resizectrl');
c— COM object
COM object, specified as a function handle.
New position in x,y pixel coordinates, specified as integers.
[0 0 200 200]
V— Position vector
Position vector, specified as four-element integer vector containing the position
and size of the control in the parent figure window. The elements of the vector are
[x, y, width, height]. The values
y are offsets in pixels from the bottom left corner of the figure
window to the same corner of the control. The values
height are the size of the control itself.