/// <summary> /// Sets the Focus to a databound control within a given Form or a UserControl by /// specifying the column to which it is bound. /// /// </summary> /// <param name="AContainerControl">Either a Form or a UserControl.</param> /// <param name="ABindingManagerBase">BindingManagerBase where the data binding /// information is stored</param> /// <param name="AColumnName">Name of the column whose databound control should get the /// focus.</param> /// <returns>Name of the control, or empty string if not found. /// </returns> public static String SetFocusOnDataBoundControlInternal(ContainerControl AContainerControl, BindingManagerBase ABindingManagerBase, String AColumnName) { Int16 Counter1; String ControlName; ControlName = ""; // MessageBox.Show('SetFocusOnDataBoundControlInternal: looking for control that belongs to DataColumn ' + AColumnName + '...'); // MessageBox.Show('Number of Bindings: ' + ABindingManagerBase.Bindings.Count.ToString); for (Counter1 = 0; Counter1 <= ABindingManagerBase.Bindings.Count - 1; Counter1 += 1) { // MessageBox.Show('ABindingManagerBase.Bindings.Item[Counter1].BindingMemberInfo.BindingField: ' + ABindingManagerBase.Bindings.Item[Counter1].BindingMemberInfo.BindingField); if (ABindingManagerBase.Bindings[Counter1].BindingMemberInfo.BindingField == AColumnName) { // MessageBox.Show('BmbPartnerLocation.Bindings.Item[Counter1].Control.Name: ' + ABindingManagerBase.Bindings.Item[Counter1].Control.Name); ControlName = TFocusing.SetFocusOnControlInFormOrUserControl(AContainerControl, ABindingManagerBase.Bindings[Counter1].Control.Name); break; } } return ControlName; }
protected void InternalConstruct(Control callingControl, Source source, Content c, WindowContent wc, FloatingForm ff, DockingManager dm, Point offset) { // Store the starting state _callingControl = callingControl; _source = source; _content = c; _windowContent = wc; _dockingManager = dm; _container = _dockingManager.Container; _floatingForm = ff; _hotZones = null; _currentHotZone = null; _insideRect = new Rectangle(); _outsideRect = new Rectangle(); _offset = offset; // Begin tracking straight away EnterTrackingMode(); }
public static Control AttachTo(this Control e, ContainerControl parent) { parent.Controls.Add(e); e.Show(); return e; }
public ToolStripButtonBlink(ref ContainerControl ParentControl, ref ToolStripButton TSButton, Image[] ImList) : this(ref ParentControl, ref TSButton, ImList, new[] {TSButton.ForeColor}) { }
internal RdpClient(ContainerControl parent, Size size, EventHandler resizeHandler) { this.parent = parent; this.size = size; try { rdpControl = new MsRdpClient6(); RDPConfigure(size); // CA-96135: Try adding rdpControl to parent.Controls list; this will throw exception when // MsRdpClient6 control cannot be created (there is no appropriate version of dll present) parent.Controls.Add(rdpControl); RDPSetSettings(); rdpControl.Resize += resizeHandler; } catch (Exception ex) { Log.Error("MsRdpClient6 control cannot be added.", ex); if (rdpControl != null) { if (parent.Controls.Contains(rdpControl)) parent.Controls.Remove(rdpControl); rdpControl.Dispose(); rdpControl = null; } } }
/// <summary> /// Scans controls that are not contained by <c>Controls</c> /// collection, like <c>MenuItem</c>s, <c>StatusBarPanel</c>s /// and <c>ColumnHeader</c>s. /// </summary> /// <param name="form"> /// <c>ContainerControl</c> object to scan. /// </param> /// <param name="resources"> /// <c>ResourceManager</c> used to get localized resources. /// </param> protected virtual void ScanNonControls(System.Windows.Forms.ContainerControl containerControl, System.Resources.ResourceManager resources) { FieldInfo[] fieldInfo = containerControl.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); for (int i = 0; i < fieldInfo.Length; i++) { object obj = fieldInfo[i].GetValue(containerControl); string fieldName = fieldInfo[i].Name; if (obj is System.Windows.Forms.MenuItem) { System.Windows.Forms.MenuItem menuItem = (System.Windows.Forms.MenuItem)obj; menuItem.Text = (string)GetSafeValue(resources, fieldName + ".Text", menuItem.Text); } if (obj is System.Windows.Forms.ColumnHeader) { System.Windows.Forms.ColumnHeader header = (System.Windows.Forms.ColumnHeader)obj; header.Text = (string)(GetSafeValue(resources, fieldName + ".Text", header.Text)); header.TextAlign = (System.Windows.Forms.HorizontalAlignment)(GetSafeValue(resources, fieldName + ".TextAlign", header.TextAlign)); header.Width = (int)(GetSafeValue(resources, fieldName + ".Width", header.Width)); } if (obj is System.Windows.Forms.ToolBarButton) { System.Windows.Forms.ToolBarButton button = (System.Windows.Forms.ToolBarButton)obj; button.Enabled = (bool)(GetSafeValue(resources, fieldName + ".Enabled", button.Enabled)); button.ImageIndex = (int)(GetSafeValue(resources, fieldName + ".ImageIndex", button.ImageIndex)); button.ToolTipText = (string)(GetSafeValue(resources, fieldName + ".ToolTipText", button.ToolTipText)); button.Visible = (bool)(GetSafeValue(resources, fieldName + ".Visible", button.Visible)); } } }
//dynamically add an item to the favourites drop down menu given a Favourite public void addFavToMenu(Favourite f) { ContainerControl cc = new ContainerControl(); cc.BackColor = Color.WhiteSmoke; ToolStripControlHost c = new ToolStripControlHost(cc); Button b = new Button(); b.Parent = cc; initRemoveFavButton(b); b.Click += (s, e) => { favMenu.DropDownItems.Remove(c);favs.removeFavourite(f); }; TextBox temp = new TextBox(); temp.Text = f.name; temp.Click += (s, e) => { initNewTab(f.url); }; temp.Parent = cc; temp.Left = b.Size.Width; temp.Left = (int)Math.Floor((float)temp.Left * 1.3f); initFavBox(temp); Button t = new Button(); t.Text = f.url; t.Parent = cc; initMenuButton(t); t.Top = temp.Height>b.Height?temp.Height :b.Height; t.Top = (int)Math.Floor((float)t.Top * 1.1f); t.Left = temp.Left; t.Enabled = false; Button eb = new Button(); eb.Parent = cc; eb.Left = temp.Left + temp.Size.Width; eb.Click += (s, e) => editButtonClick(temp, eb, f); initEditButton(eb); favMenu.DropDownItems.Add(c); }
public MainForm() { try { this.InitializeComponent(); LoadCustomBranding(Properties.Settings.Default); this.Height = Screen.PrimaryScreen.Bounds.Height; this.Width = Screen.PrimaryScreen.Bounds.Width; this.WindowState = FormWindowState.Maximized; appName = Process.GetCurrentProcess().ProcessName; if (Process.GetProcessesByName(appName).Length == 1) { Shell = this; AppManager.UseBaseDirectoryForExtensionsDirectory = true; this.appManager.ExtensionsActivating += (object sender, EventArgs e) => { this.appManager.CompositionAutomationExtension(); }; this.appManager.LoadExtensions(); } } catch (Exception ex) { string msg = string.Format("MainForm 构造方法执行出错,原因详情:{1}{2}", ex.Message, ex.StackTrace); Logger.Error(msg); XtraMessageBox.Show(msg, "错误", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
/// <summary> /// Initializes a new instance of the <see cref="MainForm"/> class. /// </summary> public MainForm() { InitializeComponent(); Shell = this; appManager.LoadExtensions(); }
public cExport(ContainerControl sender, Delegate senderDelegate, cGlobalParas.PublishType pType,string FileName,System.Data.DataTable pData ) { m_sender = sender; m_senderDelegate = senderDelegate; m_pType =pType ; m_FileName = FileName; m_pData = pData; }
public Form1() { InitializeComponent(); if (DesignMode) return; Shell = this; appManager1.LoadExtensions(); }
public void TestFixtureSetUp() { InitializeApiKeys(); _shell = new ContainerControl(); _appManager.Map = new Map(); _btlPlugin.App = _appManager; _btlPlugin.Activate(); //_appManager.LoadExtensions(); }
public ApartmentReports(System.Windows.Forms.ContainerControl contentControl, System.Windows.Forms.ToolStripSplitButton tsAccountReportMenu, GetCurrentAccountHandler onGetCurrentAccount, bool inAccountant) { this.InAccountant = inAccountant; this.m_AccountReportTypeClasses = new System.Collections.Generic.Dictionary<AccountReportType, object>(10); this.ContentControl = contentControl; this.OnGetCurrentAccountHandler = onGetCurrentAccount; this.AddAccountReportMenuItems(); this.GenerateAccountReportMenu(tsAccountReportMenu); }
public ToolStripButtonBlink(ref ContainerControl ParentControl, ref ToolStripButton TSButton, Image[] ImList, Color[] ColorList) { m_Parent = ParentControl; m_TSB = TSButton; m_ImageList = ImList; m_ColorList = ColorList; m_TSB.Disposed += DisposedHandler; m_Parent.Disposed += DisposedHandler; }
public void Decrypt( object inputObject ) { object[] inputObjects = ( object[] )inputObject; containerControl = ( Form )inputObjects[ 0 ]; finishedProcessDelegate = ( Delegate )inputObjects[ 1 ]; updateTextDelegate = ( Delegate )inputObjects[ 2 ]; string decryptedString = DecryptString( ( string )inputObjects[ 3 ], ( int )inputObjects[ 4 ], ( string )inputObjects[ 5 ] ); containerControl.Invoke( updateTextDelegate, new object[] { decryptedString } ); containerControl.Invoke( finishedProcessDelegate ); }
/// <summary> /// Method for ThreadPool QueueWorkerItem /// </summary> /// <param name="obj"></param> public void RunProcess ( object obj ) { Thread.CurrentThread.IsBackground = true; //make them a daemon object[] objArray = (object[]) obj; m_sender = (System.Windows.Forms.Form) objArray[0]; m_senderDelegate = (System.Delegate) objArray[1]; m_tmpSocket = (List<Socket>)objArray[2]; LocalRunProcess(); }
public void Encrypt(object inputObject) { var inputObjects = (object[])inputObject; containerControl = (Form)inputObjects[0]; finishedProcessDelegate = (Delegate)inputObjects[1]; updateTextDelegate = (Delegate)inputObjects[2]; string encryptedString = RSA.EncryptString((string)inputObjects[3], (string)inputObjects[4]); containerControl.Invoke(updateTextDelegate, new object[] {encryptedString}); containerControl.Invoke(finishedProcessDelegate); }
public TemplateSelector(NuGenEventHandler handler, NuGenPopupMenu parent) : base(handler, parent) { this.templ = handler.GetTemplates(); selectListen = handler.GetTemplListener(); // setUndecorated(true); System.Windows.Forms.ContainerControl temp_Container; temp_Container = new System.Windows.Forms.ContainerControl(); temp_Container.Parent = this; // temp_Container.setWindowDecorationStyle(JRootPane.NONE); //UPGRADE_TODO: Method 'java.awt.Component.setSize' was converted to 'System.Windows.Forms.Control.Size' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtComponentsetSize_int_int'" Size = new System.Drawing.Size(WIDTH + 10, HEIGHT + 5); content = new TemplateBorder(); content.Dock = System.Windows.Forms.DockStyle.Fill; Controls.Add(content); System.Drawing.Color bckgr = BackColor; //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getRed' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getGreen' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getBlue' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" System.Drawing.Color shade1 = Color.WhiteSmoke;// System.Drawing.Color.FromArgb(System.Math.Max((int)bckgr.R - 8, 0), System.Math.Max((int)bckgr.G - 8, 0), (int)bckgr.B); //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getRed' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getGreen' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getBlue' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" System.Drawing.Color shade2 = System.Drawing.Color.FromArgb(System.Math.Max((int)bckgr.R - 16, 0), System.Math.Max((int)bckgr.G - 16, 0), (int)bckgr.B); for (int n = 0; n < NUM_WIDGETS; n++) { if (n < templ.NumTemplates()) { pics[n] = new EditorPane(MOL_WIDTH, MOL_HEIGHT, true); pics[n].SetEditable(false); pics[n].BackColor = shade1; pics[n].Replace(templ.GetTemplate(n)); pics[n].ScaleToFit(); //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'" content.Controls.Add(pics[n]); //UPGRADE_TODO: Method 'java.awt.Component.setLocation' was converted to 'System.Windows.Forms.Control.Location' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtComponentsetLocation_int_int'" pics[n].Location = new System.Drawing.Point(FRAME_SIZE + MOL_WIDTH * (n % MOL_COL) + 5, FRAME_SIZE + MOL_HEIGHT * (n / MOL_COL) + 5); pics[n].SetToolCursor(); pics[n].SetMolSelectListener((MolSelectListener)this); } } //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" numPages = (int)System.Math.Ceiling(templ.NumTemplates() / (double)NUM_WIDGETS); content.BackColor = Color.DimGray; this.Size = new Size(content.Size.Width, content.Size.Height - 10); this.MaximumSize = this.Size; this.MinimumSize = this.Size; // addWindowFocusListener(this); }
internal static List<MudData.FormulaAction> PopulateMudData(ContainerControl.ControlCollection controls) { var ret = new List<MudData.FormulaAction>(); foreach (ScriptActionEditControl ctl in controls) { ret.Add(ctl.PopulateActionDictionary()); } return ret; }
/// <summary> /// Khởi tạo lớp tiện ích cho phép tùy chọn cấu hình việc ẩn hiện của cột trong một GridView /// </summary> /// <param name="_Container">Điều khiển gốc, thường là Form hoặc UserControl. Ví dụ: this(C#),Me(VB)</param> /// <param name="BranchID">Mã chi nhánh làm việc. Ví dụ: PD1400,PD0200,...</param> /// <param name="UID">Tên người dùng. Ví dụ: HoanBQ,HungND,...</param> /// <param name="SubSystem">Mã phân hệ. Ví dụ: Hoadon.DLL,Dodem.dll,...</param> /// /// <param name="AllowSearchOnGrid">Cho phép nhấn F3 để kích hoạt việc tìm kiếm dữ liệu trên lưới thông qua sự kiện Keydown của DataGrid hiện tại</param> public GridViewUtils(ContainerControl _Container, string BranchID, string UID, string SubSystem, bool AllowSearchOnGrid) { this._Container = _Container; this.BranchID = BranchID; this.UID = UID; this.SubSystem = SubSystem; this.AllowSearchOnGrid = AllowSearchOnGrid; _CtxMnu.Items.Add("Ẩn hiện cột trên lưới dữ liệu", null, new EventHandler(_Onclick)); StartUp(); }
/// <summary> /// Initializes a new instance of the MainForm class. /// </summary> public ContainerForm() { InitializeComponent(); //The AppManager is a piece of DotSpatial that we'll use only here and there. appManager = new AppManager(); //Set the main application window to be the "Shell" Shell = this; appManager.LoadExtensions(); }
public MainForm() { InitializeComponent(); this.WindowState = FormWindowState.Maximized; if (DesignMode) return; Shell = this; appManager1.LoadExtensions(); }
public void RegisterControls(ContainerControl container) { foreach (Control co in container.Controls) { if (co is AWBTextBox) { AWBTextBox tb = co as AWBTextBox; editBoxes.Add( tb.AttributeName, tb ); } } }
public void EndEditToDataBinding(System.Windows.Forms.ContainerControl mainControl) { if (IsCurrentCellInEditMode) { EndEdit(); if (IsCurrentCellInEditMode) { CancelEdit(); } mainControl.ActiveControl = null; } }
public TemplateSelector(NuGenEventHandler handler, NuGenPopupMenu parent):base(handler, parent) { this.templ = handler.GetTemplates(); selectListen = handler.GetTemplListener(); // setUndecorated(true); System.Windows.Forms.ContainerControl temp_Container; temp_Container = new System.Windows.Forms.ContainerControl(); temp_Container.Parent = this; // temp_Container.setWindowDecorationStyle(JRootPane.NONE); //UPGRADE_TODO: Method 'java.awt.Component.setSize' was converted to 'System.Windows.Forms.Control.Size' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtComponentsetSize_int_int'" Size = new System.Drawing.Size(WIDTH + 10, HEIGHT + 5); content = new TemplateBorder(); content.Dock = System.Windows.Forms.DockStyle.Fill; Controls.Add(content); System.Drawing.Color bckgr = BackColor; //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getRed' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getGreen' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getBlue' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" System.Drawing.Color shade1 = Color.WhiteSmoke;// System.Drawing.Color.FromArgb(System.Math.Max((int)bckgr.R - 8, 0), System.Math.Max((int)bckgr.G - 8, 0), (int)bckgr.B); //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getRed' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getGreen' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Color.getBlue' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'" System.Drawing.Color shade2 = System.Drawing.Color.FromArgb(System.Math.Max((int) bckgr.R - 16, 0), System.Math.Max((int) bckgr.G - 16, 0), (int) bckgr.B); for (int n = 0; n < NUM_WIDGETS; n++) if (n < templ.NumTemplates()) { pics[n] = new EditorPane(MOL_WIDTH, MOL_HEIGHT, true); pics[n].SetEditable(false); pics[n].BackColor = shade1; pics[n].Replace(templ.GetTemplate(n)); pics[n].ScaleToFit(); //UPGRADE_TODO: Method 'java.awt.Container.add' was converted to 'System.Windows.Forms.ContainerControl.Controls.Add' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtContaineradd_javaawtComponent'" content.Controls.Add(pics[n]); //UPGRADE_TODO: Method 'java.awt.Component.setLocation' was converted to 'System.Windows.Forms.Control.Location' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javaawtComponentsetLocation_int_int'" pics[n].Location = new System.Drawing.Point(FRAME_SIZE + MOL_WIDTH * (n % MOL_COL) + 5, FRAME_SIZE + MOL_HEIGHT * (n / MOL_COL) + 5); pics[n].SetToolCursor(); pics[n].SetMolSelectListener((MolSelectListener)this); } //UPGRADE_WARNING: Data types in Visual C# might be different. Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'" numPages = (int) System.Math.Ceiling(templ.NumTemplates() / (double) NUM_WIDGETS); content.BackColor = Color.DimGray; this.Size = new Size(content.Size.Width, content.Size.Height - 10); this.MaximumSize = this.Size; this.MinimumSize = this.Size; // addWindowFocusListener(this); }
public static void Init() { if (instance != null) return; control = new ContainerControl(); control.CreateControl(); WindowsDeviceConfig.UseForm = false; WindowsDeviceConfig.ControlToUse = control; new UIHandler(); instance.IsFixedTimeStep = false; instance.RunOneFrame(); }
public Form1() { InitializeComponent(); if (DesignMode) return; //------ These 2 lines required to load extensions Shell = this; appManager.LoadExtensions(); //----------- appManager.UpdateProgress("Control is Ready"); // Show some status message }
public Form1() { InitializeComponent(); if (DesignMode) return; //------ These 2 lines required to load extensions Shell = this; appManager.LoadExtensions(); //----------- appManager.UpdateProgress("Ready"); // Show some status message // Add some menus new DefaultMenuBars(appManager).Initialize(appManager.HeaderControl); }
public FullScreenAdapter(PresenterModel model, ContainerControl control) { this.m_Model = model; this.m_Control = control; this.m_EventQueue = new ControlEventQueue(this.m_Control); this.m_FullScreenChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleFullScreenChanged)); this.m_RoleChangedDispatcher = new EventQueue.PropertyEventDispatcher(this.m_EventQueue, new PropertyEventHandler(this.HandleRoleChanged)); this.m_Model.ViewerState.Changed["PrimaryMonitorFullScreen"].Add(this.m_FullScreenChangedDispatcher.Dispatcher); this.m_FullScreenChangedDispatcher.Dispatcher(this, null); this.m_Model.Participant.Changed["Role"].Add(this.m_RoleChangedDispatcher.Dispatcher); this.m_RoleChangedDispatcher.Dispatcher(this, null); this.m_FullScreenButtons = new FullScreenButtons(this.m_Model, this.m_EventQueue); //this.m_FullScreenToolBar.Dock = DockStyle.Top; }
public HookWindowsInputAndSendToWidget(ContainerControl controlToHook, WidgetForWindowsFormsAbstract widgetToSendTo) { this.widgetToSendTo = widgetToSendTo; controlToHook.GotFocus += new EventHandler(controlToHook_GotFocus); controlToHook.LostFocus += new EventHandler(controlToHook_LostFocus); controlToHook.KeyDown += new System.Windows.Forms.KeyEventHandler(controlToHook_KeyDown); controlToHook.KeyUp += new System.Windows.Forms.KeyEventHandler(controlToHook_KeyUp); controlToHook.KeyPress += new System.Windows.Forms.KeyPressEventHandler(controlToHook_KeyPress); controlToHook.MouseDown += new MouseEventHandler(controlToHook_MouseDown); controlToHook.MouseMove += new MouseEventHandler(formToHook_MouseMove); controlToHook.MouseUp += new MouseEventHandler(controlToHook_MouseUp); controlToHook.MouseWheel += new MouseEventHandler(controlToHook_MouseWheel); controlToHook.MouseCaptureChanged += new EventHandler(controlToHook_MouseCaptureChanged); controlToHook.MouseLeave += new EventHandler(controlToHook_MouseLeave); }
public ActivitySplash(ContainerControl Parent) { this.Parent = Parent; m_Show = new AutoResetEvent(false); m_Hide = new ManualResetEvent(false); m_Thread = this.f_GenerateThread(); m_Thread.Start(); this.Parent.HandleDestroyed += (o, e) => ThreadPool.QueueUserWorkItem(state => { while (!m_IsShown) { m_Show.Set(); Thread.Sleep(10); } if (m_Thread != null) { m_Thread.Abort(); m_Thread = null; } }); if (this.Parent is Form) { var prnt = this.Parent as Form; prnt.FormClosing += (o, e) => ThreadPool.QueueUserWorkItem(state => { while (!m_IsShown) { m_Show.Set(); Thread.Sleep(10); } if (m_Thread != null) { m_Thread.Abort(); m_Thread = null; } }); } this.Parent.Resize += this.f_ParentResizeHandler; }
public BorderedTextBox() { Drawn = false; textBox = new TextBox() { BorderStyle = BorderStyle.FixedSingle, Location = new Point(-1, -1), Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right }; Control container = new ContainerControl() { Dock = DockStyle.Fill, Padding = new Padding(-1) }; container.Controls.Add(textBox); this.Controls.Add(container); DefaultBorderColor = SystemColors.ControlDark; FocusedBorderColor = Color.Red; BackColor = DefaultBorderColor; Padding = new Padding(1); Size = textBox.Size; }
//根据指定的控件 父控件名称找到该控件 private Control getParentControl(System.Windows.Forms.Control parent, string parentCtlTypeName) { if (parent == null) { return(null); } if (string.Compare(parent.GetType().Name, parentCtlTypeName, true) == 0) { return(parent); } System.Windows.Forms.ContainerControl conCtl = parent as System.Windows.Forms.ContainerControl; if (conCtl != null) { return(conCtl.ParentForm); } else { return(getParentControl(parent.Parent, parentCtlTypeName)); } }
private void button2_Click(object sender, EventArgs e) { this.textBox1.Text += "\r\n" + rm.GetString("Info102"); Application.DoEvents(); this.button2.Enabled = false; this.button1.Enabled = false; //����һ����̨�߳����ڵ������ݲ��� IsDownloadDelegate IsDownload = new IsDownloadDelegate(IsDownloadSoft); m_sender = this; m_senderDelegate = IsDownload; IsDownloading = true; Thread t = new Thread(new ThreadStart(DownloadSoft)); t.IsBackground = true; t.Start(); return; }
/// <summary> /// 静态方法。 /// </summary> /// <param name="ctl"></param> /// <returns></returns> private static System.Windows.Forms.Form getCtlParentForm(System.Windows.Forms.Control ctl) { if (ctl == null) { return(null); } System.Windows.Forms.Form frm = ctl as System.Windows.Forms.Form; if (frm != null) { return(frm); } System.Windows.Forms.ContainerControl conCtl = ctl as System.Windows.Forms.ContainerControl; if (conCtl != null) { return(conCtl.ParentForm); } else { return(getCtlParentForm(ctl.Parent)); } }
/// <summary> /// Scans controls that are not contained by <c>Controls</c> /// collection, like <c>MenuItem</c>s, <c>StatusBarPanel</c>s /// and <c>ColumnHeader</c>s. /// </summary> /// <param name="form"> /// <c>ContainerControl</c> object to scan. /// </param> /// <param name="resources"> /// <c>ResourceManager</c> used to get localized resources. /// </param> protected virtual void ScanNonControls(System.Windows.Forms.ContainerControl containerControl, System.Resources.ResourceManager resources) { FieldInfo[] fieldInfo = containerControl.GetType().GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public); for (int i = 0; i < fieldInfo.Length; i++) { object obj = fieldInfo[i].GetValue(containerControl); string fieldName = fieldInfo[i].Name; if (obj is System.Windows.Forms.MenuItem) { System.Windows.Forms.MenuItem menuItem = (System.Windows.Forms.MenuItem)obj; menuItem.Enabled = (bool)(GetSafeValue(resources, fieldName + ".Enabled", menuItem.Enabled)); menuItem.Shortcut = (System.Windows.Forms.Shortcut)(GetSafeValue(resources, fieldName + ".Shortcut", menuItem.Shortcut)); menuItem.ShowShortcut = (bool)(GetSafeValue(resources, fieldName + ".ShowShortcut", menuItem.ShowShortcut)); menuItem.Text = (string)GetSafeValue(resources, fieldName + ".Text", menuItem.Text); menuItem.Visible = (bool)(GetSafeValue(resources, fieldName + ".Visible", menuItem.Visible)); } if (obj is System.Windows.Forms.StatusBarPanel) { System.Windows.Forms.StatusBarPanel panel = (System.Windows.Forms.StatusBarPanel)obj; panel.Alignment = (System.Windows.Forms.HorizontalAlignment)(GetSafeValue(resources, fieldName + ".Alignment", panel.Alignment)); panel.Icon = (System.Drawing.Icon)(GetSafeValue(resources, fieldName + ".Icon", panel.Icon)); panel.MinWidth = (int)(GetSafeValue(resources, fieldName + ".MinWidth", panel.MinWidth)); panel.Text = (string)(GetSafeValue(resources, fieldName + ".Text", panel.Text)); panel.ToolTipText = (string)(GetSafeValue(resources, fieldName + ".ToolTipText", panel.ToolTipText)); panel.Width = (int)(GetSafeValue(resources, fieldName + ".Width", panel.Width)); } if (obj is System.Windows.Forms.ColumnHeader) { System.Windows.Forms.ColumnHeader header = (System.Windows.Forms.ColumnHeader)obj; header.Text = (string)(GetSafeValue(resources, fieldName + ".Text", header.Text)); header.TextAlign = (System.Windows.Forms.HorizontalAlignment)(GetSafeValue(resources, fieldName + ".TextAlign", header.TextAlign)); header.Width = (int)(GetSafeValue(resources, fieldName + ".Width", header.Width)); } if (obj is System.Windows.Forms.ToolBarButton) { System.Windows.Forms.ToolBarButton button = (System.Windows.Forms.ToolBarButton)obj; button.Enabled = (bool)(GetSafeValue(resources, fieldName + ".Enabled", button.Enabled)); button.ImageIndex = (int)(GetSafeValue(resources, fieldName + ".ImageIndex", button.ImageIndex)); button.Text = (string)(GetSafeValue(resources, fieldName + ".Text", button.Text)); button.ToolTipText = (string)(GetSafeValue(resources, fieldName + ".ToolTipText", button.ToolTipText)); button.Visible = (bool)(GetSafeValue(resources, fieldName + ".Visible", button.Visible)); } if (obj is Telerik.WinControls.UI.RibbonTab) { Telerik.WinControls.UI.RibbonTab tab = (Telerik.WinControls.UI.RibbonTab)obj; tab.Enabled = (bool)(GetSafeValue(resources, fieldName + ".Enabled", tab.Enabled)); tab.Text = (string)(GetSafeValue(resources, fieldName + ".Text", tab.Text)); tab.ToolTipText = (string)(GetSafeValue(resources, fieldName + ".ToolTipText", tab.ToolTipText)); } if (obj is Telerik.WinControls.UI.RadRibbonBarGroup) { Telerik.WinControls.UI.RadRibbonBarGroup group = (Telerik.WinControls.UI.RadRibbonBarGroup)obj; group.Enabled = (bool)(GetSafeValue(resources, fieldName + ".Enabled", group.Enabled)); group.Text = (string)(GetSafeValue(resources, fieldName + ".Text", group.Text)); group.ToolTipText = (string)(GetSafeValue(resources, fieldName + ".ToolTipText", group.ToolTipText)); } if (obj is Telerik.WinControls.UI.RadButtonElement) { Telerik.WinControls.UI.RadButtonElement button = (Telerik.WinControls.UI.RadButtonElement)obj; button.Enabled = (bool)(GetSafeValue(resources, fieldName + ".Enabled", button.Enabled)); button.Text = (string)(GetSafeValue(resources, fieldName + ".Text", button.Text)); button.ToolTipText = (string)(GetSafeValue(resources, fieldName + ".ToolTipText", button.ToolTipText)); } if (obj is Telerik.WinControls.UI.RadGridView) { Telerik.WinControls.UI.RadGridView gridview = (Telerik.WinControls.UI.RadGridView)obj; if (gridview.ColumnCount == 0) { return; } foreach (Telerik.WinControls.UI.GridViewColumn column in gridview.Columns) { // Resource key: GridViewID.ColumnId.HeaderText column.HeaderText = (string)(GetSafeValue(resources, fieldName + "." + column.Name + ".HeaderText", column.HeaderText)); } } } }
public ErrorProvider(System.Windows.Forms.ContainerControl ParentControl) : base(ParentControl) { ErrorList = new Dictionary <Control, string>(); }
public ErrorProvider(ContainerControl parentControl) : this() { container = parentControl; }
public ContainerControlProvider(SWF.ContainerControl panel) : base(panel) { }
/// <summary> /// 构造函授数... /// </summary> public UIDataInputValidated(System.Windows.Forms.ContainerControl containerControl) { _ErrorProvider = new System.Windows.Forms.ErrorProvider(); _ErrorProvider.ContainerControl = containerControl; // _ErrorProvider.BlinkStyle = System.Windows.Forms.ErrorBlinkStyle.NeverBlink; }
public ErrorProvider(ContainerControl parentControl) { throw null; }
private void Recalculate(bool doLayout) { if (!IsHandleCreated) { return; } Size_ canvas = canvas_size; Size_ client = ClientSize; canvas.Width += auto_scroll_margin.Width; canvas.Height += auto_scroll_margin.Height; int right_edge = client.Width; int bottom_edge = client.Height; int prev_right_edge; int prev_bottom_edge; bool hscroll_visible; bool vscroll_visible; do { prev_right_edge = right_edge; prev_bottom_edge = bottom_edge; if ((force_hscroll_visible || (canvas.Width > right_edge && auto_scroll)) && client.Width > 0) { hscroll_visible = true; bottom_edge = client.Height - SystemInformation.HorizontalScrollBarHeight; } else { hscroll_visible = false; bottom_edge = client.Height; } if ((force_vscroll_visible || (canvas.Height > bottom_edge && auto_scroll)) && client.Height > 0) { vscroll_visible = true; right_edge = client.Width - SystemInformation.VerticalScrollBarWidth; } else { vscroll_visible = false; right_edge = client.Width; } } while (right_edge != prev_right_edge || bottom_edge != prev_bottom_edge); if (right_edge < 0) { right_edge = 0; } if (bottom_edge < 0) { bottom_edge = 0; } Rectangle_ hscroll_bounds; Rectangle_ vscroll_bounds; hscroll_bounds = new Rectangle_(0, client.Height - SystemInformation.HorizontalScrollBarHeight, ClientRectangle.Width, SystemInformation.HorizontalScrollBarHeight); vscroll_bounds = new Rectangle_(client.Width - SystemInformation.VerticalScrollBarWidth, 0, SystemInformation.VerticalScrollBarWidth, ClientRectangle.Height); /* the ScrollWindow calls here are needed * because (this explanation sucks): * * when we transition from having a scrollbar to * not having one, we won't receive a scrollbar * moved (value changed) event, so we need to * manually scroll the canvas. * * if you can fix this without requiring the * ScrollWindow calls, pdb and toshok will each * pay you $5. */ if (!vscrollbar.Visible) { vscrollbar.Value = 0; } if (!hscrollbar.Visible) { hscrollbar.Value = 0; } /* Manually setting the Size_ of the thumb should be done before * the other assignments */ if (hscroll_visible) { hscrollbar.manual_thumb_size = right_edge; hscrollbar.LargeChange = right_edge; hscrollbar.SmallChange = 5; hscrollbar.Maximum = canvas.Width - 1; } else { if (hscrollbar != null && hscrollbar.VisibleInternal) { ScrollWindow(-scroll_position.X, 0); } scroll_position.X = 0; } if (vscroll_visible) { vscrollbar.manual_thumb_size = bottom_edge; vscrollbar.LargeChange = bottom_edge; vscrollbar.SmallChange = 5; vscrollbar.Maximum = canvas.Height - 1; } else { if (vscrollbar != null && vscrollbar.VisibleInternal) { ScrollWindow(0, -scroll_position.Y); } scroll_position.Y = 0; } if (hscroll_visible && vscroll_visible) { hscroll_bounds.Width -= SystemInformation.VerticalScrollBarWidth; vscroll_bounds.Height -= SystemInformation.HorizontalScrollBarHeight; sizegrip.Bounds = new Rectangle_(hscroll_bounds.Right, vscroll_bounds.Bottom, SystemInformation.VerticalScrollBarWidth, SystemInformation.HorizontalScrollBarHeight); } SuspendLayout(); hscrollbar.SetBoundsInternal(hscroll_bounds.X, hscroll_bounds.Y, hscroll_bounds.Width, hscroll_bounds.Height, BoundsSpecified.None); hscrollbar.Visible = hscroll_visible; if (hscrollbar.Visible) { XplatUI.SetZOrder(hscrollbar.Handle, IntPtr.Zero, true, false); } vscrollbar.SetBoundsInternal(vscroll_bounds.X, vscroll_bounds.Y, vscroll_bounds.Width, vscroll_bounds.Height, BoundsSpecified.None); vscrollbar.Visible = vscroll_visible; if (vscrollbar.Visible) { XplatUI.SetZOrder(vscrollbar.Handle, IntPtr.Zero, true, false); } UpdateSizeGripVisible(); ResumeLayout(doLayout); // We should now scroll the active control into view, // the funny part is that ScrollableControl does not have // the concept of active control. ContainerControl container = this as ContainerControl; if (container != null && container.ActiveControl != null) { ScrollControlIntoView(container.ActiveControl); } }