public static void SaveDesignForm(System.Windows.Forms.SplitterPanel ctr) { UIMessage.DBEngine.exec("FormLayout_Save", "@FormName", ctr.FindForm().Name, "@ControlName", ctr.Name, "@SystemType", string.Format("{0},{1}", ctr.GetType().FullName, ctr.GetType().Namespace), "@LocationX", ctr.Location.X, "@LocationY", ctr.Location.Y, "@Height", ctr.Size.Height, "@Width", ctr.Size.Width); }
protected override void Initialize(System.Windows.Forms.ToolStrip toolStrip) { base.Initialize(toolStrip); this.rendererFor = toolStrip; toolStrip.FindForm().Activated += this.Form_Activated; toolStrip.FindForm().Deactivate += this.Form_Deactivated; }
public void ShowTip(Skybound.VisualTips.VisualTip tip, System.Drawing.Rectangle exclude, System.Windows.Forms.Control sourceControl, Skybound.VisualTips.VisualTipDisplayOptions options) { if (tip == null) throw new System.ArgumentNullException("tip", "The tip parameter may not be null."); if ((sourceControl != null) && !sourceControl.IsDisposed) { if ((options & Skybound.VisualTips.VisualTipDisplayOptions.HideOnKeyDown) == Skybound.VisualTips.VisualTipDisplayOptions.HideOnKeyDown) sourceControl.KeyDown += new System.Windows.Forms.KeyEventHandler(ShowTipControl_KeyDown); if ((options & Skybound.VisualTips.VisualTipDisplayOptions.HideOnKeyPress) == Skybound.VisualTips.VisualTipDisplayOptions.HideOnKeyPress) sourceControl.KeyPress += new System.Windows.Forms.KeyPressEventHandler(ShowTipControl_KeyPress); if ((options & Skybound.VisualTips.VisualTipDisplayOptions.HideOnLostFocus) == Skybound.VisualTips.VisualTipDisplayOptions.HideOnLostFocus) sourceControl.LostFocus += new System.EventHandler(ShowTipControl_LostFocus); if ((options & Skybound.VisualTips.VisualTipDisplayOptions.HideOnMouseDown) == Skybound.VisualTips.VisualTipDisplayOptions.HideOnMouseDown) sourceControl.MouseDown += new System.Windows.Forms.MouseEventHandler(ShowTipControl_MouseDown); if ((options & Skybound.VisualTips.VisualTipDisplayOptions.HideOnTextChanged) == Skybound.VisualTips.VisualTipDisplayOptions.HideOnTextChanged) sourceControl.TextChanged += new System.EventHandler(ShowTipControl_TextChanged); sourceControl.HandleDestroyed += new System.EventHandler(ShowTipControl_HandleDestroyed); System.Windows.Forms.Form form = sourceControl.FindForm(); if (form != null) form.Deactivate += new System.EventHandler(ShowTipControl_Form_Deactivate); } ShowTipCore(sourceControl, null, tip, exclude, options); }
private void HideShowTip(System.Windows.Forms.Control control) { control.MouseDown -= new System.Windows.Forms.MouseEventHandler(ShowTipControl_MouseDown); control.LostFocus -= new System.EventHandler(ShowTipControl_LostFocus); control.KeyDown -= new System.Windows.Forms.KeyEventHandler(ShowTipControl_KeyDown); control.KeyPress -= new System.Windows.Forms.KeyPressEventHandler(ShowTipControl_KeyPress); control.HandleDestroyed -= new System.EventHandler(ShowTipControl_HandleDestroyed); System.Windows.Forms.Form form = control.FindForm(); if (form != null) form.Deactivate -= new System.EventHandler(ShowTipControl_Form_Deactivate); if (CurrentControl == control) HideTip(); }
public override void Initialize(System.Windows.Forms.Control ownerControl, string videoFileName, EventHandler onVideoLoaded, EventHandler onVideoEnded) { _ownerControl = ownerControl; if (ownerControl != null) _parentForm = ownerControl.FindForm(); OnVideoLoaded = onVideoLoaded; OnVideoEnded = onVideoEnded; if (!string.IsNullOrEmpty(videoFileName)) { string[] initParameters = new string[] { "--no-sub-autodetect-file" }; //, "--no-video-title-show" }; //TODO: Put in options/config file _libVlc = libvlc_new(initParameters.Length, initParameters); IntPtr media = libvlc_media_new_path(_libVlc, Encoding.UTF8.GetBytes(videoFileName + "\0")); _mediaPlayer = libvlc_media_player_new_from_media(media); libvlc_media_release(media); // Linux: libvlc_media_player_set_xdrawable (_mediaPlayer, xdrawable); // Mac: libvlc_media_player_set_nsobject (_mediaPlayer, view); libvlc_media_player_set_hwnd(_mediaPlayer, ownerControl.Handle); // windows if (onVideoEnded != null) { _videoEndTimer = new System.Windows.Forms.Timer { Interval = 500 }; _videoEndTimer.Tick += VideoEndTimerTick; _videoEndTimer.Start(); } libvlc_media_player_play(_mediaPlayer); _videoLoadedTimer = new System.Windows.Forms.Timer { Interval = 500 }; _videoLoadedTimer.Tick += new EventHandler(VideoLoadedTimer_Tick); _videoLoadedTimer.Start(); } }
public LibVlcMono MakeSecondMediaPlayer(System.Windows.Forms.Control ownerControl, string videoFileName, EventHandler onVideoLoaded, EventHandler onVideoEnded) { LibVlcMono newVlc = new LibVlcMono(); newVlc._libVlc = this._libVlc; newVlc._libVlcDLL = this._libVlcDLL; newVlc._ownerControl = ownerControl; if (ownerControl != null) newVlc._parentForm = ownerControl.FindForm(); newVlc.OnVideoLoaded = onVideoLoaded; newVlc.OnVideoEnded = onVideoEnded; if (!string.IsNullOrEmpty(videoFileName)) { IntPtr media = libvlc_media_new_path(_libVlc, Encoding.UTF8.GetBytes(videoFileName + "\0")); newVlc._mediaPlayer = libvlc_media_player_new_from_media(media); libvlc_media_release(media); // Linux: libvlc_media_player_set_xdrawable (_mediaPlayer, xdrawable); // Mac: libvlc_media_player_set_nsobject (_mediaPlayer, view); libvlc_media_player_set_hwnd(newVlc._mediaPlayer, ownerControl.Handle); // windows if (onVideoEnded != null) { newVlc._videoEndTimer = new System.Windows.Forms.Timer { Interval = 500 }; newVlc._videoEndTimer.Tick += VideoEndTimerTick; newVlc._videoEndTimer.Start(); } libvlc_media_player_play(newVlc._mediaPlayer); newVlc._videoLoadedTimer = new System.Windows.Forms.Timer { Interval = 500 }; newVlc._videoLoadedTimer.Tick += new EventHandler(newVlc.VideoLoadedTimer_Tick); newVlc._videoLoadedTimer.Start(); } return newVlc; }
public override void Initialize(System.Windows.Forms.Control ownerControl, string videoFileName, EventHandler onVideoLoaded, EventHandler onVideoEnded) { _ownerControl = ownerControl; if (ownerControl != null) _parentForm = ownerControl.FindForm(); string dllFile = GetVlcPath("libvlc.dll"); if (File.Exists(dllFile)) { Directory.SetCurrentDirectory(Path.GetDirectoryName(dllFile)); _libVlcDLL = LoadLibrary(dllFile); LoadLibVlcDynamic(); } else if (!Directory.Exists(videoFileName)) { return; } OnVideoLoaded = onVideoLoaded; OnVideoEnded = onVideoEnded; if (!string.IsNullOrEmpty(videoFileName)) { string[] initParameters = new string[] { "--no-sub-autodetect-file" }; //, "--no-video-title-show" }; //TODO: Put in options/config file _libVlc = _libvlc_new(initParameters.Length, initParameters); IntPtr media = _libvlc_media_new_path(_libVlc, Encoding.UTF8.GetBytes(videoFileName + "\0")); _mediaPlayer = _libvlc_media_player_new_from_media(media); _libvlc_media_release(media); // Linux: libvlc_media_player_set_xdrawable (_mediaPlayer, xdrawable); // Mac: libvlc_media_player_set_nsobject (_mediaPlayer, view); if (ownerControl != null) { _libvlc_media_player_set_hwnd(_mediaPlayer, ownerControl.Handle); // windows //hack: sometimes vlc opens in it's own windows - this code seems to prevent this for (int j = 0; j < 50; j++) { System.Threading.Thread.Sleep(10); System.Windows.Forms.Application.DoEvents(); } _libvlc_media_player_set_hwnd(_mediaPlayer, ownerControl.Handle); // windows } if (onVideoEnded != null) { _videoEndTimer = new System.Windows.Forms.Timer { Interval = 500 }; _videoEndTimer.Tick += VideoEndTimerTick; _videoEndTimer.Start(); } _libvlc_media_player_play(_mediaPlayer); _videoLoadedTimer = new System.Windows.Forms.Timer { Interval = 500 }; _videoLoadedTimer.Tick += new EventHandler(VideoLoadedTimer_Tick); _videoLoadedTimer.Start(); _mouseTimer = new System.Windows.Forms.Timer { Interval = 25 }; _mouseTimer.Tick += MouseTimerTick; _mouseTimer.Start(); } }