External Interfaces/API Reference |
Move and/or resize a COM control in its parent window
Syntax
Arguments
h
Handle for a MATLAB COM control object.
position
A four-element vector specifying the position of the control in the parent window. The elements of the vector are
Description
Moves the control to the position specified by the position
argument. When you use move with only the handle argument, h, it returns a four-element vector indicating the current position of the control.
Examples
This example moves the control:
f = figure('Position', [100 100 200 200]); h = actxcontrol('mwsamp.mwsampctrl.1', [0 0 200 200]); pos = move(h, [50 50 200 200]) pos = 50 50 200 200
The next example resizes the control to always be centered in the figure as you resize the figure window. Start by creating the script resizectrl.m
that contains
% 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)]);
Now execute the following in MATLAB or in an M-file:
f = figure('Position', [100 100 200 200]); h = actxcontrol('mwsamp.mwsampctrl.1', [0 0 200 200]); set(f, 'ResizeFcn', 'resizectrl');
As you resize the figure window, notice that the circle moves so that it is always positioned in the center of the window.
See Also
methodsview | propedit (COM) |