//static void OnThemeChanged(object sender, EventArgs e)
        //{
        //    RecreateFonts();
        //}

        #endregion

        #region Helper methods
        private static void SetDoubleBufferControl(Control c)
        {
            Type         t   = typeof(Control);
            BindingFlags all = BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance;

            PropertyInfo pi = t.GetProperty("DoubleBuffered", all);

            if (pi != null)
            {
                pi.SetValue(c, true, null);
            }

            ControlStyles doubleBufferStyles = ControlStyles.OptimizedDoubleBuffer | ControlStyles.DoubleBuffer;

            FieldInfo fi = t.GetField("controlStyle", all);

            if (fi != null)
            {
                ControlStyles cs = (ControlStyles)fi.GetValue(c);
                if ((cs & doubleBufferStyles) != doubleBufferStyles)
                {
                    cs |= doubleBufferStyles;
                    fi.SetValue(c, cs);
                }
            }
        }
예제 #2
0
        public static void CheckStyles(Control ctrl, string msg, params ControlStyles [] ExpectedStyles)
        {
            MethodInfo method = ctrl.GetType().GetMethod("GetStyle", BindingFlags.ExactBinding | BindingFlags.NonPublic | BindingFlags.Instance, null, new Type [] { typeof(ControlStyles) }, null);

            Assert.IsNotNull(method, "Cannot complete test, didn't find GetStyle method on Control");

            string failed = "";

            if (ExpectedStyles == null)
            {
                ExpectedStyles = new ControlStyles [0];
            }
            foreach (ControlStyles style in Enum.GetValues(typeof(ControlStyles)))
            {
                bool result = (bool)method.Invoke(ctrl, new object [] { style });
                if (Array.IndexOf(ExpectedStyles, style) >= 0)
                {
                    if (!result)
                    {
                        failed += "\t" + "ControlStyles." + style.ToString() + " was expected, but is not set." + Environment.NewLine;
                    }
                }
                else
                {
                    if (result)
                    {
                        failed += "\t" + "ControlStyles." + style.ToString() + " is set, but was not expected." + Environment.NewLine;
                    }
                }
            }
            if (failed != String.Empty)
            {
                Assert.Fail(msg + Environment.NewLine + failed);
            }
        }
예제 #3
0
        public CustomCombo()
        {
            ControlStyles styleTrue = ControlStyles.AllPaintingInWmPaint |
                                      ControlStyles.DoubleBuffer |
                                      ControlStyles.FixedHeight |
                                      ControlStyles.ResizeRedraw |
                                      ControlStyles.UserPaint;

            SetStyle(styleTrue, true);
            SetStyle(ControlStyles.Selectable, false);

            m_editbox             = new TextBox();
            m_editbox.BorderStyle = BorderStyle.None;
            m_editbox.MouseEnter += new EventHandler(OnEditMouseEnter);
            m_editbox.KeyDown    += new KeyEventHandler(OnEditKeyDown);
            m_editbox.MouseWheel += new MouseEventHandler(OnEditMouseWheel);
            m_editbox.Leave      += new System.EventHandler(OnEditLeave);
            m_editbox.Enter      += new System.EventHandler(OnEditEnter);

            m_dropDownForm = new Form();
            m_dropDownForm.FormBorderStyle = FormBorderStyle.None;
            m_dropDownForm.StartPosition   = FormStartPosition.Manual;
            m_dropDownForm.TopMost         = true;
            m_dropDownForm.ShowInTaskbar   = false;
            m_dropDownForm.BackColor       = SystemColors.Highlight;
            m_dropDownForm.Deactivate     += new EventHandler(OnDropDownLostFocus);

            m_strFormat               = new StringFormat();
            m_strFormat.Alignment     = StringAlignment.Near;
            m_strFormat.LineAlignment = StringAlignment.Center;
            m_strFormat.FormatFlags   = StringFormatFlags.LineLimit;
        }
        public CollapsibleSplitContainer()
        {
            // Register mouse events
            this.Click      += OnClick;
            this.Resize     += OnResize;
            this.MouseLeave += OnMouseLeave;
            this.MouseMove  += OnMouseMove;
            this.MouseUp    += OnMouseUp;

            //mxd. Set drawing style
            const ControlStyles cs = ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer;

            this.SetStyle(cs, true);

            object[]   args          = new object[] { cs, true };
            MethodInfo objMethodInfo = typeof(Control).GetMethod("SetStyle", BindingFlags.NonPublic | BindingFlags.Instance);

            objMethodInfo.Invoke(this.Panel1, args);
            objMethodInfo.Invoke(this.Panel2, args);

            // Force the width to 8px so that everything always draws correctly
            this.SplitterWidth = 8;

            //mxd. Create some scaled coordinates...
            int[] coords = new[] { 1, 2, 3, 4, 6, 8, 9, 14, 115 };
            scaled = new Dictionary <int, int>(coords.Length);
            foreach (int i in coords)
            {
                scaled[i] = (int)Math.Round(i * MainForm.DPIScaler.Width);
            }
        }
예제 #5
0
        public DasmPanel()
        {
            TabStop = true;
            //         BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
            this.Font = new Font("Courier", 13, System.Drawing.FontStyle.Regular, GraphicsUnit.Pixel);
            Size      = new System.Drawing.Size(424, 148);
            ControlStyles styles = ControlStyles.Selectable |
                                   ControlStyles.UserPaint |
                                   ControlStyles.ResizeRedraw |
                                   ControlStyles.StandardClick |       // csClickEvents
                                   ControlStyles.UserMouse |           // csCaptureMouse
                                   ControlStyles.ContainerControl |    // csAcceptsControls?
                                   ControlStyles.StandardDoubleClick | // csDoubleClicks
                                                                       //                                ControlStyles.Opaque  |                 // csOpaque
                                   0;

            base.SetStyle(styles, true);

            mouseTimer          = new Timer();
            mouseTimer.Enabled  = false;
            mouseTimer.Interval = 50;
            mouseTimer.Tick    += OnMouseTimer;

            fLineHeight       = 1;
            fVisibleLineCount = 0;
            fTopAddress       = 0;
            fActiveLine       = 0;
            fBreakColor       = Color.Red;
            fBreakForeColor   = Color.Black;
            UpdateLines();
        }
예제 #6
0
        public DataPanel()
        {
            TabStop   = true;
            this.Font = new Font("Courier", 13, System.Drawing.FontStyle.Regular, GraphicsUnit.Pixel);
            Size      = new System.Drawing.Size(424, 99);
            ControlStyles styles = ControlStyles.Selectable |
                                   ControlStyles.UserPaint |
                                   ControlStyles.ResizeRedraw |
                                   ControlStyles.StandardClick |           // csClickEvents
                                   ControlStyles.UserMouse |               // csCaptureMouse
                                   ControlStyles.ContainerControl |        // csAcceptsControls?
                                   ControlStyles.StandardDoubleClick |     // csDoubleClicks
                                   0;

            base.SetStyle(styles, true);

            mouseTimer          = new Timer();
            mouseTimer.Enabled  = false;
            mouseTimer.Interval = 50;
            mouseTimer.Tick    += OnMouseTimer;

            fLineHeight       = 1;
            fVisibleLineCount = 0;
            fTopAddress       = 0;
            fActiveLine       = 0;
            fActiveColumn     = 0;
            fColCount         = 8;
            UpdateLines();
        }
예제 #7
0
        public void WebBrowserBase_GetStyle_Invoke_ReturnsExpected(ControlStyles flag, bool expected)
        {
            using var control = new SubWebBrowserBase("8856f961-340a-11d0-a96b-00c04fd705a2");
            Assert.Equal(expected, control.GetStyle(flag));

            // Call again to test caching.
            Assert.Equal(expected, control.GetStyle(flag));
        }
예제 #8
0
        public void FlowLayoutPanel_GetStyle_Invoke_ReturnsExpected(ControlStyles flag, bool expected)
        {
            using var control = new SubFlowLayoutPanel();
            Assert.Equal(expected, control.GetStyle(flag));

            // Call again to test caching.
            Assert.Equal(expected, control.GetStyle(flag));
        }
예제 #9
0
 public static bool SetStyle(Control c, ControlStyles Style, bool value)
 {
     bool retval = false;
     Type typeTB = typeof(Control);
     System.Reflection.MethodInfo misSetStyle = typeTB.GetMethod("SetStyle", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
     if (misSetStyle != null && c != null) { misSetStyle.Invoke(c, new object[] { Style, value }); retval = true; }
     return retval;
 }
예제 #10
0
        public void ComponentEditorPage_GetStyle_Invoke_ReturnsExpected(ControlStyles flag, bool expected)
        {
            using var control = new SubComponentEditorPage();
            Assert.Equal(expected, control.GetStyle(flag));

            // Call again to test caching.
            Assert.Equal(expected, control.GetStyle(flag));
        }
예제 #11
0
        public void HScrollBar_GetStyle_Invoke_ReturnsExpected(ControlStyles flag, bool expected)
        {
            using var control = new SubHScrollBar();
            Assert.Equal(expected, control.GetStyle(flag));

            // Call again to test caching.
            Assert.Equal(expected, control.GetStyle(flag));
        }
예제 #12
0
        /// <summary>
        /// Invokes the GetStyle method of the specified <see cref="T:Control"/>.
        /// </summary>
        /// <param name="ctrl">Specifies the <see cref="T:Control"/> to invoke the GetStyle method for.</param>
        /// <param name="ctrlStyles">Specifies the control style to check.</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="ctrl"/> is <see langword="null"/>.
        /// </exception>
        private static bool InvokeGetStyle(Control ctrl, ControlStyles ctrlStyles)
        {
            if (ctrl == null)
            {
                throw new ArgumentNullException("ctrl");
            }

            return((bool)NuGenInvoker.InvokeMethod(ctrl, "GetStyle", ctrlStyles));
        }
예제 #13
0
        /// <summary>
        /// Invokes the SetStyle method of the <see cref="T:Control"/>.
        /// </summary>
        /// <param name="ctrl">Specifies the <see cref="T:System.Windows.Forms.Control"/> to invoke the SetStyle method for.</param>
        /// <param name="ctrlStyles">Control styles to set.</param>
        /// <param name="value"><see langword="true"/> to apply the specified styles to the control;
        /// otherwise, <see langword="false"/>.</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="ctrl"/> is <see langword="null"/>.
        /// </exception>
        private static void InvokeSetStyle(Control ctrl, ControlStyles ctrlStyles, bool value)
        {
            if (ctrl == null)
            {
                throw new ArgumentNullException("ctrl");
            }

            NuGenInvoker.InvokeMethod(ctrl, "SetStyle", ctrlStyles, value);
        }
예제 #14
0
        private static void OverrideSetStyle(Control c, ControlStyles styles, bool value)
        {
            MethodInfo info = c.GetType().GetMethod("SetStyle", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);

            if (info != null)
            {
                info.Invoke(c, new object[] { styles, value });
            }
        }
        /*
         * GetStyle
         */

        /// <summary>
        /// Checks if the specified style is set for the specified <see cref="T:System.Windows.Forms.Control"/>.
        /// </summary>
        /// <param name="ctrl">Specifies the <see cref="Control"/> to check the style for.</param>
        /// <param name="flag">Specifies the style to check.</param>
        /// <returns><see langword="true"/> if the specified style is set; otherwise, <see langword="false"/>.</returns>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="ctrl"/> is <see langword="null"/>.
        /// </exception>
        public static bool GetStyle(Control ctrl, ControlStyles flag)
        {
            if (ctrl == null)
            {
                throw new ArgumentNullException("ctrl");
            }

            return(InvokeGetStyle(ctrl, flag));
        }
        /*
         * SetStyle
         */

        /// <summary>
        /// Sets the specified style for the specified <see cref="T:System.Windows.Forms.Control"/>.
        /// </summary>
        /// <param name="ctrl">Specifies the <see cref="T:System.Windows.Forms.Control"/> to set the style for.</param>
        /// <param name="ctrlStyles">Specifies the style to set.</param>
        /// <param name="value"><see langword="true"/> to set the style for the <see cref="T:System.Windows.Forms.Control"/>;
        /// otherwise, <see langword="false"/>.</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="ctrl"/> is <see langword="null"/>.
        /// </exception>
        public static void SetStyle(Control ctrl, ControlStyles ctrlStyles, bool value)
        {
            if (ctrl == null)
            {
                throw new ArgumentNullException("ctrl");
            }

            NuGenControlPaint.InvokeSetStyle(ctrl, ctrlStyles, value);
        }
		/*
		 * GetStyle
		 */

		/// <summary>
		/// Checks if the specified style is set for the specified <see cref="T:System.Windows.Forms.Control"/>.
		/// </summary>
		/// <param name="ctrl">Specifies the <see cref="Control"/> to check the style for.</param>
		/// <param name="flag">Specifies the style to check.</param>
		/// <returns><see langword="true"/> if the specified style is set; otherwise, <see langword="false"/>.</returns>
		/// <exception cref="T:System.ArgumentNullException">
		/// <paramref name="ctrl"/> is <see langword="null"/>.
		/// </exception>
		public static bool GetStyle(Control ctrl, ControlStyles flag)
		{
			if (ctrl == null)
			{
				throw new ArgumentNullException("ctrl");
			}

			return InvokeGetStyle(ctrl, flag);
		}
        public static void SetStyle(this Control ctrl, ControlStyles cs, bool b)
        {
            MethodInfo mi = ctrl.GetType().GetMethod("SetStyle", BindingFlags.Instance | BindingFlags.NonPublic);

            if (mi != null)
            {
                mi.Invoke(ctrl, new object[] { cs, b });
            }
        }
예제 #19
0
        /// <summary>
        /// Invokes the GetStyle method of the specified <see cref="T:Control"/>.
        /// </summary>
        /// <param name="ctrl">Specifies the <see cref="T:Control"/> to invoke the GetStyle method for.</param>
        /// <param name="ctrlStyles">Specifies the control style to check.</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="ctrl"/> is <see langword="null"/>.
        /// </exception>
        private static bool InvokeGetStyle(Control ctrl, ControlStyles ctrlStyles)
        {
            if (ctrl == null)
            {
                throw new ArgumentNullException("ctrl");
            }

            return(new NuGenInvoker(ctrl).Methods["GetStyle"].Invoke <bool>(ctrlStyles));
        }
예제 #20
0
        private void ChangeControlStyles(Control ctrl, ControlStyles flag, bool value)
        {
            MethodInfo method = ctrl.GetType().GetMethod("SetStyle", BindingFlags.Instance | BindingFlags.NonPublic);

            if (method != null)
            {
                method.Invoke(ctrl, new object[] { flag, value });
            }
        }
예제 #21
0
파일: Note.cs 프로젝트: J3057/MobileApp
                public Note(string noteXml)
                {
                    // store our XML
                    NoteXml = noteXml;

                    mStyle = new Style( );
                    mStyle.Initialize( );

                    ControlStyles.Initialize( );
                }
예제 #22
0
 /// <summary>
 /// Go through all our display styles, and add those ones that are set to our collection
 /// </summary>
 private void DetermineDefaultStyle()
 {
     foreach (ControlStyles Style in Enum.GetValues(typeof(ControlStyles)))
     {
         if (GetStyle(Style))
         {
             DefaultStyle |= Style;
         }
     }
 }
예제 #23
0
파일: Control.cs 프로젝트: wdstest/ReVision
 public void SetStyle(ControlStyles style, bool isEnabled)
 {
     if (isEnabled)
     {
         ControlStyle |= style;
     }
     else
     {
         ControlStyle &= style;
     }
 }
예제 #24
0
        /// <summary>
        /// Invokes the SetStyle method of the <see cref="T:Control"/>.
        /// </summary>
        /// <param name="ctrl">Specifies the <see cref="T:System.Windows.Forms.Control"/> to invoke the SetStyle method for.</param>
        /// <param name="ctrlStyles">Control styles to set.</param>
        /// <param name="value"><see langword="true"/> to apply the specified styles to the control;
        /// otherwise, <see langword="false"/>.</param>
        /// <exception cref="T:System.ArgumentNullException">
        /// <paramref name="ctrl"/> is <see langword="null"/>.
        /// </exception>
        private static void InvokeSetStyle(Control ctrl, ControlStyles ctrlStyles, bool value)
        {
            if (ctrl == null)
            {
                throw new ArgumentNullException("ctrl");
            }

            NuGenInvoker invoker = new NuGenInvoker(ctrl);

            invoker.Methods["SetStyle"].Invoke(ctrlStyles, value);
        }
예제 #25
0
        public ImagePanel()
        {
            InitializeComponent();
            ControlStyles flag = ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint;

            this.SetStyle(flag, true);

            _StringFormat = new StringFormat();

            this.Text = "";
        }
        /// <summary>
        ///     Sets the appropriate flags to the control so that it can be owner drawn.
        /// </summary>
        private void EnableOwnerDrawing()
        {
            var flags = new ControlStyles();

            foreach (ControlStyles s in customPaintingFlags)
            {
                flags |= s;
            }

            SetStyle(flags, true);
        }
예제 #27
0
        public static void SetStyleAll(this Control control, ControlStyles controlStyles, bool value)
        {
            typeof(Control).InvokeMember("SetStyle",
                                         BindingFlags.InvokeMethod | BindingFlags.Instance | BindingFlags.NonPublic,
                                         null, control, new object[] { controlStyles, value });

            foreach (Control childControl in control.Controls)
            {
                childControl.SetStyleAll(controlStyles, value);
            }
        }
예제 #28
0
        /// <summary>
        /// Uses reflection to enable the setting of a style, e.g. double buffering, on a control
        /// from outside its class
        /// </summary>
        /// <param name="ctrl">The control to set the stype on</param>
        /// <param name="style">The styles to set</param>
        /// <param name="enable">Wether to enable or disable the specified styles</param>
        public static void SetStyleEx(this Control ctrl, ControlStyles style, bool enable = true)
        {
            Type         type   = ctrl.GetType();
            BindingFlags flags  = BindingFlags.NonPublic | BindingFlags.Instance;
            MethodInfo   method = type.GetMethod("SetStyle", flags);

            if (method != null)
            {
                object[] param = { style, enable };
                method.Invoke(ctrl, param);
            }
        }
예제 #29
0
        public CollapsibleSplitContainer()
        {
            // Bug fix for SplitContainer problems with flickering and resizing
            ControlStyles cs = ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.OptimizedDoubleBuffer;

            this.SetStyle(cs, true);
            object[]   objArgs       = new object[] { cs, true };
            MethodInfo objMethodInfo = typeof(Control).GetMethod("SetStyle", BindingFlags.NonPublic | BindingFlags.Instance);

            objMethodInfo.Invoke(this.Panel1, objArgs);
            objMethodInfo.Invoke(this.Panel2, objArgs);
        }
예제 #30
0
        public static void SetStyles(Control control, ControlStyles styles)
        {
            ClearStyles(control);

            foreach (ControlStyles style in Enum.GetValues(typeof(ControlStyles)))
            {
                if (styles.HasFlag(style))
                {
                    SetStyle(control, style, true);
                }
            }
        }
예제 #31
0
파일: Form1.cs 프로젝트: klunya72/PwKeeper
        public static void SetStl(this Control control, ControlStyles flags, bool value)
        {
            Type         type         = control.GetType();
            BindingFlags bindingFlags = BindingFlags.NonPublic | BindingFlags.Instance;
            MethodInfo   method       = type.GetMethod("SetStyle", bindingFlags);

            if (method != null)
            {
                object[] param = { flags, value };
                method.Invoke(control, param);
            }
        }
예제 #32
0
        public static bool SetStyle(Control c, ControlStyles Style, bool value)
        {
            bool retval = false;
            Type typeTB = typeof(Control);

            System.Reflection.MethodInfo misSetStyle = typeTB.GetMethod("SetStyle", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
            if (misSetStyle != null && c != null)
            {
                misSetStyle.Invoke(c, new object[] { Style, value }); retval = true;
            }
            return(retval);
        }
예제 #33
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            this.graphics.PreferredBackBufferWidth = WINDOW_WIDTH;
            this.graphics.PreferredBackBufferHeight = WINDOW_HEIGHT;
            this.graphics.ApplyChanges();

            this.IsMouseVisible = true;

            GameState = GameStates.Playing;
            ControlStyle = ControlStyles.KBM_RH;

            base.Initialize();
        }
예제 #34
0
		public static void CheckStyles (Control ctrl, string msg, params ControlStyles [] ExpectedStyles)
		{
			MethodInfo method = ctrl.GetType ().GetMethod ("GetStyle", BindingFlags.ExactBinding | BindingFlags.NonPublic | BindingFlags.Instance, null, new Type [] {typeof(ControlStyles)}, null);
			Assert.IsNotNull (method, "Cannot complete test, didn't find GetStyle method on Control");
			
			string failed = "";
			
			if (ExpectedStyles == null)
				ExpectedStyles = new ControlStyles [0];
			foreach (ControlStyles style in Enum.GetValues (typeof(ControlStyles))) {
				bool result = (bool) method.Invoke (ctrl, new object [] {style});
				if (Array.IndexOf (ExpectedStyles, style) >= 0) {
					if (!result) 
						failed += "\t" + "ControlStyles." + style.ToString () + " was expected, but is not set." + Environment.NewLine;
				} else {
					if (result)
						failed += "\t" + "ControlStyles." + style.ToString () + " is set, but was not expected." + Environment.NewLine;
				}
			}
			if (failed != String.Empty) {
				Assert.Fail (msg + Environment.NewLine + failed);
			}
		}
 public static void SetStyleHack(Control control, ControlStyles flag)
 {
     control.GetType().GetMethod("SetStyle", BindingFlags.NonPublic | BindingFlags.Instance).Invoke(control, new object[] { flag, true });
 }
예제 #36
0
	// Get a particular style flag.
	protected bool GetStyle(ControlStyles flag)
			{
				return (((ControlStyles)controlStyle & flag) == flag);
			}
예제 #37
0
	protected void SetStyle(ControlStyles flag, bool value)
			{
				if(value)
				{
					controlStyle |= (int)flag;
				}
				else
				{
					controlStyle &= ~(int)flag;
				}
			}
예제 #38
0
파일: Utils.cs 프로젝트: GoldMax/Pulsar.NET
 //-------------------------------------------------------------------------------------
 /// <summary>
 /// Устанавливает стили для контрола
 /// </summary>
 /// <param name="c">Контрол, для которого требуется установить стили.</param>
 /// <param name="styles">Устанавливаемые стили.</param>
 /// <param name="set">Значение установки или снятия.</param>
 public static void SetStyle(Control c, ControlStyles styles, bool set)
 {
  Type t = typeof(Control);
  t.InvokeMember("SetStyle", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.InvokeMethod,
                  null, c, new object[] { styles, set });
 }
예제 #39
0
		/// <summary>
		/// Invokes the SetStyle method of the <see cref="T:Control"/>.
		/// </summary>
		/// <param name="ctrl">Specifies the <see cref="T:System.Windows.Forms.Control"/> to invoke the SetStyle method for.</param>
		/// <param name="ctrlStyles">Control styles to set.</param>
		/// <param name="value"><see langword="true"/> to apply the specified styles to the control;
		/// otherwise, <see langword="false"/>.</param>
		/// <exception cref="T:System.ArgumentNullException">
		/// <paramref name="ctrl"/> is <see langword="null"/>.
		/// </exception>
		private static void InvokeSetStyle(Control ctrl, ControlStyles ctrlStyles, bool value)
		{
			if (ctrl == null)
			{
				throw new ArgumentNullException("ctrl");
			}

			NuGenInvoker.InvokeMethod(ctrl, "SetStyle", ctrlStyles, value);
		}
예제 #40
0
			public bool PublicGetStyle (ControlStyles flag) { return base.GetStyle (flag); }
예제 #41
0
			public bool GetControlStyle (ControlStyles style)
			{
				return base.GetStyle (style);
			}
예제 #42
0
파일: Control.cs 프로젝트: nlhepler/mono
		protected internal bool GetStyle(ControlStyles flag) {
			return (control_style & flag) != 0;
		}
예제 #43
0
파일: Control.cs 프로젝트: nlhepler/mono
		protected internal void SetStyle(ControlStyles flag, bool value) {
			if (value) {
				control_style |= flag;
			} else {
				control_style &= ~flag;
			}
		}
예제 #44
0
			public bool GetStylePublic (ControlStyles flag) {
				return GetStyle (flag);
			}
예제 #45
0
		/// <summary>
		/// Invokes the SetStyle method of the <see cref="T:Control"/>.
		/// </summary>
		/// <param name="ctrl">Specifies the <see cref="T:System.Windows.Forms.Control"/> to invoke the SetStyle method for.</param>
		/// <param name="ctrlStyles">Control styles to set.</param>
		/// <param name="value"><see langword="true"/> to apply the specified styles to the control;
		/// otherwise, <see langword="false"/>.</param>
		/// <exception cref="T:System.ArgumentNullException">
		/// <paramref name="ctrl"/> is <see langword="null"/>.
		/// </exception>
		private static void InvokeSetStyle(Control ctrl, ControlStyles ctrlStyles, bool value)
		{
			if (ctrl == null)
			{
				throw new ArgumentNullException("ctrl");
			}

			NuGenInvoker invoker = new NuGenInvoker(ctrl);
			invoker.Methods["SetStyle"].Invoke(ctrlStyles, value);
		}
예제 #46
0
			public void PublicSetStyle (ControlStyles flag, bool value) { base.SetStyle (flag, value); }
예제 #47
0
		/// <summary>
		/// Invokes the GetStyle method of the specified <see cref="T:Control"/>.
		/// </summary>
		/// <param name="ctrl">Specifies the <see cref="T:Control"/> to invoke the GetStyle method for.</param>
		/// <param name="ctrlStyles">Specifies the control style to check.</param>
		/// <exception cref="T:System.ArgumentNullException">
		/// <paramref name="ctrl"/> is <see langword="null"/>.
		/// </exception>
		private static bool InvokeGetStyle(Control ctrl, ControlStyles ctrlStyles)
		{
			if (ctrl == null)
			{
				throw new ArgumentNullException("ctrl");
			}

			return new NuGenInvoker(ctrl).Methods["GetStyle"].Invoke<bool>(ctrlStyles);
		}
예제 #48
0
			public void SetControlStyle (ControlStyles style, bool value)
			{
				base.SetStyle (style, value);
			}
예제 #49
0
		/// <summary>
		/// Invokes the GetStyle method of the specified <see cref="T:Control"/>.
		/// </summary>
		/// <param name="ctrl">Specifies the <see cref="T:Control"/> to invoke the GetStyle method for.</param>
		/// <param name="ctrlStyles">Specifies the control style to check.</param>
		/// <exception cref="T:System.ArgumentNullException">
		/// <paramref name="ctrl"/> is <see langword="null"/>.
		/// </exception>
		private static bool InvokeGetStyle(Control ctrl, ControlStyles ctrlStyles)
		{
			if (ctrl == null)
			{
				throw new ArgumentNullException("ctrl");
			}

			return (bool)NuGenInvoker.InvokeMethod(ctrl, "GetStyle", ctrlStyles);
		}
		/*
		 * SetStyle
		 */

		/// <summary>
		/// Sets the specified style for the specified <see cref="T:System.Windows.Forms.Control"/>.
		/// </summary>
		/// <param name="ctrl">Specifies the <see cref="T:System.Windows.Forms.Control"/> to set the style for.</param>
		/// <param name="ctrlStyles">Specifies the style to set.</param>
		/// <param name="value"><see langword="true"/> to set the style for the <see cref="T:System.Windows.Forms.Control"/>;
		/// otherwise, <see langword="false"/>.</param>
		/// <exception cref="T:System.ArgumentNullException">
		/// <paramref name="ctrl"/> is <see langword="null"/>.
		/// </exception>
		public static void SetStyle(Control ctrl, ControlStyles ctrlStyles, bool value)
		{
			if (ctrl == null)
			{
				throw new ArgumentNullException("ctrl");
			}

			NuGenControlPaint.InvokeSetStyle(ctrl, ctrlStyles, value);
		}
예제 #51
0
        /// <summary>
        /// Uses reflection to enable the setting of a style, e.g. double buffering, on a control
        /// from outside its class
        /// </summary>
        /// <param name="ctrl">The control to set the stype on</param>
        /// <param name="style">The styles to set</param>
        /// <param name="enable">Wether to enable or disable the specified styles</param>
        public static void SetStyleEx(this Control ctrl, ControlStyles style, bool enable = true)
        {
            Type type = ctrl.GetType();
            BindingFlags flags = BindingFlags.NonPublic | BindingFlags.Instance;
            MethodInfo method = type.GetMethod("SetStyle", flags);

            if (method != null)
            {
                object[] param = { style, enable };
                method.Invoke(ctrl, param);
            }
        }
예제 #52
0
파일: Control.cs 프로젝트: nlhepler/mono
		public Control ()
		{
			if (WindowsFormsSynchronizationContext.AutoInstall)
				if (!(SynchronizationContext.Current is WindowsFormsSynchronizationContext))
					SynchronizationContext.SetSynchronizationContext (new WindowsFormsSynchronizationContext ());

			layout_type = LayoutType.Anchor;
			anchor_style = AnchorStyles.Top | AnchorStyles.Left;

			is_created = false;
			is_visible = true;
			is_captured = false;
			is_disposed = false;
			is_enabled = true;
			is_entered = false;
			layout_pending = false;
			is_toplevel = false;
			causes_validation = true;
			has_focus = false;
			layout_suspended = 0;
			mouse_clicks = 1;
			tab_index = -1;
			cursor = null;
			right_to_left = RightToLeft.Inherit;
			border_style = BorderStyle.None;
			background_color = Color.Empty;
			dist_right = 0;
			dist_bottom = 0;
			tab_stop = true;
			ime_mode = ImeMode.Inherit;
			use_compatible_text_rendering = true;
			show_keyboard_cues = false;
			show_focus_cues = SystemInformation.MenuAccessKeysUnderlined;
			use_wait_cursor = false;

			backgroundimage_layout = ImageLayout.Tile;
			use_compatible_text_rendering = Application.use_compatible_text_rendering;
			padding = this.DefaultPadding;
			maximum_size = new Size();
			minimum_size = new Size();
			margin = this.DefaultMargin;
			auto_size_mode = AutoSizeMode.GrowOnly;

			control_style = ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | 
					ControlStyles.Selectable | ControlStyles.StandardClick | 
					ControlStyles.StandardDoubleClick;
			control_style |= ControlStyles.UseTextForAccessibility;

			parent = null;
			background_image = null;
			text = string.Empty;
			name = string.Empty;

			window_target = new ControlWindowTarget(this);
			window = new ControlNativeWindow(this);
			child_controls = CreateControlsInstance();
			
			bounds.Size = DefaultSize;
			client_size = ClientSizeFromSize (bounds.Size);
			client_rect = new Rectangle (Point.Empty, client_size);
			explicit_bounds = bounds;
		}