c# - AxWindowsMediaPlayer control location/size -
i have axwindowsmediaplayer control on winform.
everything works far. can't resize or move control.
i initialize control this:
mediaplayer = new axwmplib.axwindowsmediaplayer(); mediaplayer.createcontrol(); mediaplayer.enablecontextmenu = false; ((system.componentmodel.isupportinitialize)(mediaplayer)).begininit(); mediaplayer.name = "wmplayer"; mediaplayer.enabled = true; mediaplayer.dock = system.windows.forms.dockstyle.fill; mediaplayer.size = this.size; this.controls.add(mediaplayer); ((system.componentmodel.isupportinitialize)(mediaplayer)).endinit(); mediaplayer.uimode = "none"; mediaplayer.url = filename; mediaplayer.settings.setmode("loop", true); mediaplayer.ctlcontrols.play();
but size ist same. how can set size or bounds of controls?
thanks help
it better in designer, rather code.
in code, set size of player control large form.
//occupies form's available space mediaplayer.dock = system.windows.forms.dockstyle.fill; //again, player same size form mediaplayer.size = this.size;
in order set bound of player control within form, can set anchorstyle
- anchoring control edges of form- , set control's location
, size
properties.
mediaplayer.location = new point(50, 50); mediaplayer.size = new size(this.clientsize.width - 100, this.clientsize.height - 100); mediaplayer.anchor = anchorstyles.top | anchorstyles.left | anchorstyles.right | anchorstyles.bottom;
Comments
Post a Comment