public TabPage AddWpfControl(System.Windows.Controls.UserControl control, string tabTitle, TabLocation tabLocation = TabLocation.Center) { TabPage existingTabPage; TabControl existingTabControl; GetContainers(control, out existingTabPage, out existingTabControl); bool alreadyExists = existingTabControl != null; TabPage tabPage = existingTabPage; if (!alreadyExists) { System.Windows.Forms.Integration.ElementHost wpfHost; wpfHost = new System.Windows.Forms.Integration.ElementHost(); wpfHost.Dock = DockStyle.Fill; wpfHost.Child = control; tabPage = CreateTabPage(tabTitle); TabControl tabControl = GetTabFromLocation(tabLocation); tabControl.Controls.Add(tabPage); tabPage.Controls.Add(wpfHost); } return(tabPage); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.toolsPanelNew = ((iS3.Client.ToolsPaneForZHGL)(target)); return; case 2: this.DocMan = ((Telerik.Windows.Controls.RadDocking)(target)); return; case 3: this.ViewHolder = ((Telerik.Windows.Controls.RadPaneGroup)(target)); #line 43 "..\..\..\MainFrame\MainFrameForZHGL.xaml" this.ViewHolder.SelectionChanged += new Telerik.Windows.Controls.RadSelectionChangedEventHandler(this.ViewHolder_SelectionChanged); #line default #line hidden return; case 4: this.ObjsViewHolder = ((Telerik.Windows.Controls.RadPaneGroup)(target)); return; case 5: this.ComonObjsViewHolder = ((iS3.Client.CommonObjsView)(target)); return; case 6: this.ToolsHolder1 = ((Telerik.Windows.Controls.RadPaneGroup)(target)); return; case 7: this.ipcHost = ((iS3.Python.IronPythonControl)(target)); return; case 8: this.OldWindow = ((Telerik.Windows.Controls.RadSplitContainer)(target)); return; case 9: this.DomainTreeHolder = ((Telerik.Windows.Controls.RadPaneGroup)(target)); return; case 10: this.FloatWindow = ((Telerik.Windows.Controls.RadSplitContainer)(target)); return; case 11: this.temp = ((System.Windows.Forms.Integration.ElementHost)(target)); return; } this._contentLoaded = true; }
public PluginTab AddWpfControl(System.Windows.Controls.UserControl control, string tabTitle, TabLocation tabLocation = TabLocation.Center) { string AppTheme = "Light"; control.Resources = new System.Windows.ResourceDictionary(); control.Resources.Source = new Uri($"/Themes/{AppTheme}.xaml", UriKind.Relative); //Style style = this.TryFindResource("UserControlStyle") as Style; //if (style != null) //{ // this.Style = style; //} //ResourceDictionary = Resources; TabPage existingTabPage; TabControl existingTabControl; GetContainers(control, out existingTabPage, out existingTabControl); bool alreadyExists = existingTabControl != null; TabPage tabPage = existingTabPage; if (!alreadyExists) { System.Windows.Forms.Integration.ElementHost wpfHost; wpfHost = new System.Windows.Forms.Integration.ElementHost(); wpfHost.Dock = DockStyle.Fill; wpfHost.Child = control; tabPage = CreateTabPage(tabTitle); TabControl tabControl = GetTabFromLocation(tabLocation); tabControl.Controls.Add(tabPage); tabPage.Controls.Add(wpfHost); } return(new PluginTab { Page = tabPage }); }
private void CreateBox(int x, int y, string shelf, string info, string floor, string cell, int w_element, int h_element, int w_box, int h_box, bool bg_clolor) { //this.BeginInvoke((Action)(() => //{ System.Windows.Forms.Integration.ElementHost Element = new System.Windows.Forms.Integration.ElementHost(); LocationBox.BoxSmall1 box = new LocationBox.BoxSmall1(); box.setSizeBox(w_box, h_box); box.setVisible(bg_clolor); // box.Caption = shelf.Substring(0, 1); box.Caption = info; box.SetCaption(); // box.Caption1 = shelf.Substring(1, 2); box.Caption1 = shelf; //shelf; box.SetCaption1(); box.TabIndex = index; box.Name = "A" + shelf.Substring(0, 3); box.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(BoxHead_MouseLeftButtonUp); Element.Name = shelf; Element.Location = new Point(x, y); Element.Size = new Size(w_element, h_element); Element.TabIndex = index; // if (bg_clolor) Element.BackColor = Color.SkyBlue; Element.Child = box; // if (bf== true) // Element.SendToBack(); // Element.BringToFront(); // Element.BackColor = Color.White; //perform on the UI thread // this.Controls.Add(Element); splMain.Panel1.Controls.Add(Element); //this.Controls.Add(Element); Element.BringToFront(); index++; //})); }
private static void UpdateBackgroundImage(ElementHost host) { if (host != null && host.HostContainerInternal != null) { if (host.BackColorTransparent) { Control parent = host.Parent; if (parent != null && parent.Visible) { using (SD.Bitmap parentBitmap = HostUtils.GetCoveredPortionOfBitmap(parent, host)) { host.HostContainerInternal.Background = new SWM.ImageBrush(Convert.ToSystemWindowsMediaImagingBitmapImage(parentBitmap)); } } } else { using (SD.Bitmap elementHostBitmap = HostUtils.GetBitmapOfControl(host, host)) { host.HostContainerInternal.Background = new SWM.ImageBrush(Convert.ToSystemWindowsMediaImagingBitmapImage(elementHostBitmap)); } } } }
private void AddAwesomeAxiomTaskPaneSFEdit(Word.Document doc, string Id, string FileName, string ParentType, string ParentId) { this.SetRibbon(); System.Windows.Forms.Integration.ElementHost elHost = new System.Windows.Forms.Integration.ElementHost(); ContractEdit.SForceEditSideBar2 ssb = new ContractEdit.SForceEditSideBar2(Id, FileName, ParentType, ParentId); elHost.Child = ssb; elHost.Dock = System.Windows.Forms.DockStyle.Fill; System.Windows.Forms.UserControl u = new System.Windows.Forms.UserControl(); u.Controls.Add(elHost); Microsoft.Office.Tools.CustomTaskPane taskPaneValue = Globals.ThisAddIn.CustomTaskPanes.Add(u, "Axiom IRIS Edit", doc.ActiveWindow); taskPaneValue.Visible = true; taskPaneValue.Width = 300; }
private void AddAwesomeAxiomTaskPane(Word.Document doc) { this.SetRibbon(); // WPF Form if (isTemplate() || isExportTemplate() || isClause()) { System.Windows.Forms.Integration.ElementHost elHost = new System.Windows.Forms.Integration.ElementHost(); TemplateEdit.TEditSidebar tsb = new TemplateEdit.TEditSidebar(doc); elHost.Child = tsb; elHost.Dock = System.Windows.Forms.DockStyle.Fill; System.Windows.Forms.UserControl u = new System.Windows.Forms.UserControl(); u.Controls.Add(elHost); Microsoft.Office.Tools.CustomTaskPane taskPaneValue = Globals.ThisAddIn.CustomTaskPanes.Add(u, "Axiom IRIS Template", doc.ActiveWindow); taskPaneValue.Visible = true; taskPaneValue.Width = 300; taskPaneValue.VisibleChanged += new EventHandler(taskPaneValue_VisibleChanged); } else if (isContract() || isUnAttachedContract()) { ElementHost elHost = new ElementHost(); ContractEdit.SForceEditSideBar2 csb = new ContractEdit.SForceEditSideBar2(); elHost.Child = csb; elHost.Dock = DockStyle.Fill; System.Windows.Forms.UserControl u = new System.Windows.Forms.UserControl(); u.Controls.Add(elHost); Microsoft.Office.Tools.CustomTaskPane taskPaneValue = this.CustomTaskPanes.Add(u, "Axiom IRIS Contract", doc.ActiveWindow); taskPaneValue.Visible = true; taskPaneValue.Width = 400; taskPaneValue.VisibleChanged += new EventHandler(taskPaneValue_VisibleChanged); } }
public WallPaperEngine() { //下記処理(レジストリを)をリセットする this.FormClosing += Form1_FormClosing; //IEのレジストリキーを登録 regkey.SetValue(process_name, 11001, Microsoft.Win32.RegistryValueKind.DWord); regkey.SetValue(process_dbg_name, 11001, Microsoft.Win32.RegistryValueKind.DWord); //壁紙にFormを張り付ける IntPtr progman = IntPtr.Zero; progman = Wallpainter.SetupWallpaper(); if (progman == IntPtr.Zero) { writeLog("Error : Failed to retrieve progman!"); } if (WinAPI.SetParent(this.Handle, progman) == IntPtr.Zero) { writeLog("Error : Failed to set Parent!"); } WinAPI.ShowWindowAsync(this.Handle, 1); // フォームの設定 writeLog("init Form"); this.Text = "WallPaperEngine"; this.FormBorderStyle = FormBorderStyle.None; SetDisplay setdsp = new SetDisplay(this); setdsp.setPrimaryDsp(); // フォーム内のパーツ writeLog("init form parts"); this.elementHost = new System.Windows.Forms.Integration.ElementHost(); this.mediaElement = new System.Windows.Controls.MediaElement(); this.contextMenu = new System.Windows.Forms.ContextMenu(); //TODO : MenuItemを配列として定義に変更 this.menuItem0 = new System.Windows.Forms.MenuItem(); this.menuItem1 = new System.Windows.Forms.MenuItem(); this.menuItem2 = new System.Windows.Forms.MenuItem(); this.menuItem3 = new System.Windows.Forms.MenuItem(); this.menuItem4 = new System.Windows.Forms.MenuItem(); this.menuItem5 = new System.Windows.Forms.MenuItem(); this.notifyIcon = new System.Windows.Forms.NotifyIcon(); this.webBrowser = new System.Windows.Controls.WebBrowser(); // mediaElementを置くためのパーツ writeLog("init elementHost"); this.elementHost.Visible = true; this.elementHost.Dock = DockStyle.Fill; this.Controls.Add(this.elementHost); // 動画再生パーツ writeLog("init mediaElement"); this.mediaElement.Visibility = System.Windows.Visibility.Visible; this.mediaElement.Margin = new System.Windows.Thickness(0, 0, 0, 0); this.mediaElement.UnloadedBehavior = System.Windows.Controls.MediaState.Manual; this.mediaElement.MediaEnded += (sender, eventArgs) => { this.mediaElement.Position = TimeSpan.FromMilliseconds(1); this.mediaElement.Play(); }; this.elementHost.Child = this.mediaElement; writeLog("init webBrowser"); this.webBrowser.Visibility = System.Windows.Visibility.Visible; this.webBrowser.Margin = new System.Windows.Thickness(0, 0, 0, 0); // 動画ソースの読み込み writeLog("load video"); loadVideo(); // メニューにmenuItemを追加 writeLog("add notifyIcon"); this.contextMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItem0, this.menuItem1, this.menuItem2, this.menuItem3, this.menuItem4, this.menuItem5 }); // menuItem0として終了ボタンを追加 this.menuItem0.Index = 0; this.menuItem0.Text = "E&xit"; this.menuItem0.Click += new System.EventHandler(this.menuItem0_Click); // menuItem1としてミュートボタンを追加 this.menuItem1.Index = 1; this.menuItem1.Text = "Mute Audio"; this.menuItem1.Click += new System.EventHandler(this.menuItem1_Click); this.menuItem1.Checked = this.mediaElement.IsMuted; // menuItem2としてロードビデオボタンを追加 this.menuItem2.Index = 2; this.menuItem2.Text = "Load Video"; this.menuItem2.Click += new System.EventHandler(this.menuItem2_Click); // menuItem3としてロードURLボタンを追加 this.menuItem3.Index = 3; this.menuItem3.Text = "Load URL"; this.menuItem3.Click += new System.EventHandler(this.menuItem3_Click); // menuItem4として「作者に奢る」ボタンを追加 this.menuItem4.Index = 5; this.menuItem4.Text = "作者に奢る"; this.menuItem4.Click += new System.EventHandler(this.menuItem4_Click); // menuItem5としてターゲットディスプレイボタンを追加 this.menuItem5.Index = 4; this.menuItem5.Text = "Target Display"; MenuItem5_subMenu_utility submenu_utility = new MenuItem5_subMenu_utility(setdsp); //接続されているディスプレイの数だけmenuItem5にサブメニューを追加 Screen[] sc_array = System.Windows.Forms.Screen.AllScreens; foreach (Screen sc in sc_array) { System.Windows.Forms.MenuItem submenuItem = new MenuItem(); submenuItem.Text = sc.DeviceName; submenuItem.Click += submenu_utility.menuItem5_subMenu_Click(sc); submenu_utility.addSubMenuItem(submenuItem); this.menuItem5.MenuItems.Add(submenuItem); } // タスクトレイのアイコンの設定 this.notifyIcon.Icon = new Icon("favicon.ico"); this.notifyIcon.ContextMenu = this.contextMenu; this.notifyIcon.Text = this.Text; this.notifyIcon.Visible = true; }