System.Windows.Forms.Control.SetStyle(System.Windows.Forms.ControlStyles, bool)

Here are the examples of the csharp api class System.Windows.Forms.Control.SetStyle(System.Windows.Forms.ControlStyles, bool) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

88 Examples 7

1. Example

Project: TaskScheduler
Source File: TreeViewExtension.cs
View license
public static void SetExplorerTheme(this TreeView treeView, bool on = true)
		{
			// Make sure the TVS_NOHSCROLL style is set
			const int TVS_NOHSCROLL = 0x8000;
			treeView.SetStyle(TVS_NOHSCROLL);

			// Set explorer theme, set critical properties, and set extended styles
			Microsoft.Win32.NativeMethods.SetWindowTheme(treeView.Handle, "explorer", null);
			const int TVM_SETEXTENDEDSTYLE = 0x1100 + 44;
			const int TVS_EX_FADEINOUTEXPANDOS = 0x0040;
			const int TVS_EX_AUTOHSCROLL = 0x0020;
			treeView.HotTracking = true;
			treeView.ShowLines = false;
			Microsoft.Win32.NativeMethods.SendMessage(treeView.Handle, TVM_SETEXTENDEDSTYLE, TVS_EX_FADEINOUTEXPANDOS | TVS_EX_AUTOHSCROLL, TVS_EX_FADEINOUTEXPANDOS | TVS_EX_AUTOHSCROLL);
		}

2. Example

Project: dockpanelsuite
Source File: InertButton.cs
View license
private void InternalConstruct(Image imageEnabled, Image imageDisabled)
        {
            // Remember parameters
            ImageEnabled = imageEnabled;
            ImageDisabled = imageDisabled;

            // Prevent drawing flicker by blitting from memory in WM_PAINT
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            // Prevent base class from trying to generate double click events and
            // so testing clicks against the double click time and rectangle. Getting
            // rid of this allows the user to press then release button very quickly.
            //SetStyle(ControlStyles.StandardDoubleClick, false);

            // Should not be allowed to select this control
            SetStyle(ControlStyles.Selectable, false);

            m_timer = new Timer();
            m_timer.Enabled = false;
            m_timer.Tick += new EventHandler(Timer_Tick);
        }

3. Example

Project: Eddie
Source File: Form.cs
View license
public void CommonInit(string Title)
        {
            String TitleText = Constants.Name;
            if (Title != "")
                TitleText = TitleText + " - " + Title;

            Text = TitleText;
						
			Icon = global::Eddie.Forms.Properties.Resources.icon1;

            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);			

        }

4. Example

Project: SteamBulkActivator
Source File: BrowserForm.cs
View license
private void BrowserForm_Load(object sender, EventArgs e)
        {
            DoubleBuffered = true;
            SetStyle(ControlStyles.ResizeRedraw, true);
        }

5. Example

Project: ArnoldSimulator
Source File: InertButton.cs
View license
private void InternalConstruct(Image imageEnabled, Image imageDisabled)
		{
			// Remember parameters
			ImageEnabled = imageEnabled;
			ImageDisabled = imageDisabled;

			// Prevent drawing flicker by blitting from memory in WM_PAINT
			SetStyle(ControlStyles.ResizeRedraw, true);
			SetStyle(ControlStyles.UserPaint, true);
			SetStyle(ControlStyles.AllPaintingInWmPaint, true);

			// Prevent base class from trying to generate double click events and
			// so testing clicks against the double click time and rectangle. Getting
			// rid of this allows the user to press then release button very quickly.
			//SetStyle(ControlStyles.StandardDoubleClick, false);

			// Should not be allowed to select this control
			SetStyle(ControlStyles.Selectable, false);

			m_timer = new Timer();
			m_timer.Enabled = false;
			m_timer.Tick += new EventHandler(Timer_Tick);
		}

6. Example

Project: TileIconifier
Source File: SkinnableComboBox.cs
View license
private void ConfigureDrawingProperties()
        {
            if (HandleDrawing)
            {
                SetStyle(ControlStyles.UserPaint, true);
                DrawMode = DrawMode.OwnerDrawFixed;
                DoubleBuffered = true;
            }
            else
            {
                //These values could change in a future version of Winforms.
                SetStyle(ControlStyles.UserPaint, false);
                DrawMode = DrawMode.Normal;
                DoubleBuffered = false;
            }
        }

7. Example

View license
private void EnableOwnerDrawing()
        {
            var flags = new ControlStyles();
            foreach (ControlStyles s in customPaintingFlags)
            {
                flags |= s;
            }

            SetStyle(flags, true);
        }

8. Example

View license
private void ResetOwnerDrawing()
        {
            foreach (var k in defaultPaintingFlags.Keys)
            {
                SetStyle(k, defaultPaintingFlags[k]);
            }
        }

9. Example

Project: TileIconifier
Source File: SkinnableTrackBar.cs
View license
private void EnableOwnerDrawing()
        {
            var flags = new ControlStyles();
            foreach (ControlStyles s in _customPaintingFlags)
            {
                flags |= s;
            }

            SetStyle(flags, true);
        }

10. Example

Project: TileIconifier
Source File: SkinnableTrackBar.cs
View license
private void ResetOwnerDrawing()
        {
            foreach (var k in _defaultPaintingFlags.Keys)
            {
                SetStyle(k, _defaultPaintingFlags[k]);
            }
        }

11. Example

Project: tao
Source File: SimpleOpenGlControl.cs
View license
private void InitializeStyles() {
            this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            this.SetStyle(ControlStyles.DoubleBuffer, false);
            this.SetStyle(ControlStyles.Opaque, true);
            this.SetStyle(ControlStyles.ResizeRedraw, true);
            this.SetStyle(ControlStyles.UserPaint, true);
        }

12. Example

Project: OpenLiveWriter
Source File: BitmapButton.cs
View license
private void InitializeObject()
        {
            //	Turn on double buffered painting.
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            //	Redraw if resized (mainly for the designer).
            SetStyle(ControlStyles.ResizeRedraw, true);

            //  Allow transparent background color
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);

            AccessibleRole = AccessibleRole.PushButton;
        }

13. Example

Project: OpenLiveWriter
Source File: InformationBox.cs
View license
private void InitializeObject()
        {
            //	Turn off CS_CLIPCHILDREN.
            User32.SetWindowLong(Handle, GWL.STYLE, User32.GetWindowLong(Handle, GWL.STYLE) & ~WS.CLIPCHILDREN);

            //	Turn on double buffered painting.
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.DoubleBuffer, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
        }

14. Example

Project: ServiceBusExplorer
Source File: Grouper.cs
View license
private void InitializeStyles()
		{
			//Set the control styles----------------------------------
			this.SetStyle(ControlStyles.DoubleBuffer, true);
			this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			this.SetStyle(ControlStyles.UserPaint, true);
			this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
			//--------------------------------------------------------
		}

15. Example

Project: MailSystem.NET
Source File: ListViewVS.cs
View license
public void EnabledResizeRedraw(bool enable)
		{
			SetStyle(ControlStyles.ResizeRedraw, enable);
		}

16. Example

Project: MailSystem.NET
Source File: ProgressBarVS.cs
View license
void InitializeProgressControl(ProgressBarType barType, Color backgroundColor, 
			Color foregroundColor, Color borderColor, Bitmap foregroundBitmap, Bitmap backgroundBitmap, Color gradientStartColor,
			Color gradientMiddleColor, Color gradientEndColor)
		{
			// Setup Double buffering 
			SetStyle(ControlStyles.ResizeRedraw 
			|ControlStyles.AllPaintingInWmPaint|ControlStyles.UserPaint|ControlStyles.DoubleBuffer, true);
			
			this.barType = barType;
			this.backgroundColor = backgroundColor;
			this.foregroundColor = foregroundColor;
			this.borderColor = borderColor;
			this.foregroundBitmap = foregroundBitmap;
			this.backgroundBitmap = backgroundBitmap;
			this.gradientStartColor = gradientStartColor;
			this.gradientMiddleColor = gradientMiddleColor;
			this.gradientEndColor = gradientEndColor;
		}

17. Example

Project: SharpDX_Demo
Source File: Form1.cs
View license
private void Form1_Load(object sender, EventArgs e)
        {
            //Init Direct Draw
       /n ..... /n //View Source file for more details /n }

18. Example

Project: SirenOfShame
Source File: AnimationControl.cs
View license
void SetupObjects()
        {
            //Set Defaults
            aniTimer.Enabled = false;
            aniTimer.Tick += aniTimer_Tick;

            //This turns off internal double buffering of all custom GDI+ drawing
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint | ControlStyles.FixedHeight | ControlStyles.FixedWidth | ControlStyles.SupportsTransparentBackColor, true);
            SetStyle(ControlStyles.Selectable, false);
        }

19. Example

Project: partcover.net4
Source File: SettingsForm.cs
View license
private void UpdatePreview()
        {
            SetStyle(lbExample);
            SetStyle(lbGood);
            SetStyle(lbBad);

            lbGood.BackColor = Settings.Default.ViewPaneCoveredBlockBackroung;
            lbBad.BackColor = Settings.Default.ViewPaneUncoveredBlockBackroung;
            cbAllFile.Checked = Settings.Default.HighlightAllFile;
        }

20. Example

Project: MailSystem.NET
Source File: ListViewVS.cs
View license
public void EnabledResizeRedraw(bool enable)
		{
			SetStyle(ControlStyles.ResizeRedraw, enable);
		}

21. Example

Project: MailSystem.NET
Source File: ProgressBarVS.cs
View license
void InitializeProgressControl(ProgressBarType barType, Color backgroundColor, 
			Color foregroundColor, Color borderColor, Bitmap foregroundBitmap, Bitmap backgroundBitmap, Color gradientStartColor,
			Color gradientMiddleColor, Color gradientEndColor)
		{
			// Setup Double buffering 
			SetStyle(ControlStyles.ResizeRedraw 
			|ControlStyles.AllPaintingInWmPaint|ControlStyles.UserPaint|ControlStyles.DoubleBuffer, true);
			
			this.barType = barType;
			this.backgroundColor = backgroundColor;
			this.foregroundColor = foregroundColor;
			this.borderColor = borderColor;
			this.foregroundBitmap = foregroundBitmap;
			this.backgroundBitmap = backgroundBitmap;
			this.gradientStartColor = gradientStartColor;
			this.gradientMiddleColor = gradientMiddleColor;
			this.gradientEndColor = gradientEndColor;
		}

22. Example

Project: ynoteclassic
Source File: InertButton.cs
View license
private void InternalConstruct(Image imageEnabled, Image imageDisabled)
        {
            // Remember parameters
            ImageEnabled = imageEnabled;
            ImageDisabled = imageDisabled;

            // Prevent drawing flicker by blitting from memory in WM_PAINT
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            // Prevent base class from trying to generate double click events and
            // so testing clicks against the double click time and rectangle. Getting
            // rid of this allows the user to press then release button very quickly.
            //SetStyle(ControlStyles.StandardDoubleClick, false);

            // Should not be allowed to select this control
            SetStyle(ControlStyles.Selectable, false);

            m_timer = new Timer();
            m_timer.Enabled = false;
            m_timer.Tick += Timer_Tick;
        }

23. Example

Project: ynoteclassic
Source File: GradientForm.cs
View license
private void SetStyles()
        {
            // Makes sure the form repaints when it was resized
            SetStyle(ControlStyles.ResizeRedraw, true);
        }

24. Example

Project: QTTabBar
Source File: TabSwitchForm.cs
View license
private void SetCompositionState() {
            if(!QTUtility.IsXP) {
                if((0 <= PInvoke.DwmIsCompositionEnabled(out fCompositionEnabled)) && fCompositionEnabled) {
                    MARGINS pMarInset = new MARGINS();
                    pMarInset.cxLeftWidth = -1;
                    if(0 <= PInvoke.DwmExtendFrameIntoClientArea(Handle, ref pMarInset)) {
                        SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
                        BackColor = Color.Black;
                        return;
                    }
                }
                BackColor = SystemColors.Menu;
            }
            else {
                FormBorderStyle = FormBorderStyle.FixedToolWindow;
            }
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint, true);
        }

25. Example

Project: SquareOne
Source File: InertButton.cs
View license
private void InternalConstruct(Image imageEnabled, Image imageDisabled)
        {
            // Remember parameters
            ImageEnabled = imageEnabled;
            ImageDisabled = imageDisabled;

            // Prevent drawing flicker by blitting from memory in WM_PAINT
            SetStyle(ControlStyles.ResizeRedraw, true);
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);

            // Prevent base class from trying to generate double click events and
            // so testing clicks against the double click time and rectangle. Getting
            // rid of this allows the user to press then release button very quickly.
            //SetStyle(ControlStyles.StandardDoubleClick, false);

            // Should not be allowed to select this control
            SetStyle(ControlStyles.Selectable, false);

            m_timer = new Timer();
            m_timer.Enabled = false;
            m_timer.Tick += new EventHandler(Timer_Tick);
        }

26. Example

Project: ceptr
Source File: InertButton.cs
View license
private void InternalConstruct(Image imageEnabled, Image imageDisabled)
		{
			// Remember parameters
			ImageEnabled = imageEnabled;
			ImageDisabled = imageDisabled;

			// Prevent drawing flicker by blitting from memory in WM_PAINT
			SetStyle(ControlStyles.ResizeRedraw, true);
			SetStyle(ControlStyles.UserPaint, true);
			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			SetStyle(ControlStyles.DoubleBuffer, true);

			// Prevent base class from trying to generate double click events and
			// so testing clicks against the double click time and rectangle. Getting
			// rid of this allows the user to press then release button very quickly.
			SetStyle(ControlStyles.StandardDoubleClick, false);

			// Should not be allowed to select this control
			SetStyle(ControlStyles.Selectable, false);
		}

27. Example

Project: Cropper
Source File: DropDownButton.cs
View license
private void Initialize()
        {
            SetStyle(ControlStyles.Selectable, true);
            BackColor = SystemColors.Control;
            ForeColor = SystemColors.ControlText;
            TabStop = false;
            IsDefault = false;
            Cursor = Cursors.Default;
            FlatStyle = FlatStyle.Flat;
            FlatAppearance.BorderColor = SystemColors.ControlDarkDark;
            FlatAppearance.BorderSize = 1;
        }

28. Example

Project: HOPE
Source File: InertButton.cs
View license
private void InternalConstruct(Image imageEnabled, Image imageDisabled)
		{
			// Remember parameters
			ImageEnabled = imageEnabled;
			ImageDisabled = imageDisabled;

			// Prevent drawing flicker by blitting from memory in WM_PAINT
			SetStyle(ControlStyles.ResizeRedraw, true);
			SetStyle(ControlStyles.UserPaint, true);
			SetStyle(ControlStyles.AllPaintingInWmPaint, true);
			SetStyle(ControlStyles.DoubleBuffer, true);

			// Prevent base class from trying to generate double click events and
			// so testing clicks against the double click time and rectangle. Getting
			// rid of this allows the user to press then release button very quickly.
			SetStyle(ControlStyles.StandardDoubleClick, false);

			// Should not be allowed to select this control
			SetStyle(ControlStyles.Selectable, false);
		}

29. Example

Project: ImageGlass
Source File: ImageBox.cs
View license
protected virtual void OnAllowDoubleClickChanged(EventArgs e)
        {
            EventHandler handler;

            SetStyle(ControlStyles.StandardDoubleClick, AllowDoubleClick);

            handler = AllowDoubleClickChanged;

            if (handler != null)
            {
                handler(this, e);
            }
        }

30. Example

Project: VisualPlus
Source File: VisualTabPage.cs
View license
protected override ControlCollection CreateControlsInstance()
        {
            SetStyle(
                ControlStyles.UserPaint |
                ControlStyles.AllPaintingInWmPaint |
                ControlStyles.ResizeRedraw |
                ControlStyles.OptimizedDoubleBuffer |
                ControlStyles.SupportsTransparentBackColor,
                true);

            DoubleBuffered = true;

            return base.CreateControlsInstance();
        }

31. Example

Project: sharpgl
Source File: OpenGLControl.cs
View license
protected void InitialiseOpenGL()
        {
            object parameter = null;
           
            //  Native render context providers need a little bit more attention.
            if(RenderContextType == RenderContextType.NativeWindow)
            {
                SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
                parameter = Handle;
            }

            //  Create the render context.
            gl.Create(OpenGLVersion, RenderContextType, Width, Height, 32, parameter);

            //  Set the most basic OpenGL styles.
            gl.ShadeModel(OpenGL.GL_SMOOTH);
            gl.ClearColor(0.0f, 0.0f, 0.0f, 0.0f);
            gl.ClearDepth(1.0f);
            gl.Enable(OpenGL.GL_DEPTH_TEST);
            gl.DepthFunc(OpenGL.GL_LEQUAL);
            gl.Hint(OpenGL.GL_PERSPECTIVE_CORRECTION_HINT, OpenGL.GL_NICEST);

            //  Fire the OpenGL initialized event.
            DoOpenGLInitialized();

            //  Set the draw timer.
            timerDrawing.Tick += timerDrawing_Tick;
        }

32. Example

Project: EDDiscovery
Source File: TabControlCustom.cs
View license
private void ChangeFont(Font fs)
        {         // going back to normal mode seems to allow the tab to size properly to the font
            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint |
                                ControlStyles.Opaque | ControlStyles.ResizeRedraw, false);

            base.Font = fs;
            CleanUp();

            SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint |
                                ControlStyles.Opaque | ControlStyles.ResizeRedraw, (flatstyle != FlatStyle.System));
        }

33. Example

View license
private void init()
        {
            objToolTip = new ToolTip();

            animationManager = new AnimationManager(false)
            {
                Increment = 0.03,
                AnimationType = AnimationType.EaseOut
            };
            hoverAnimationManager = new AnimationManager
            {
                Increment = 0.07,
                AnimationType = AnimationType.Linear
            };

            hoverAnimationManager.OnAnimationProgress += sender => Invalidate();
            animationManager.OnAnimationProgress += sender => Invalidate();
            AutoSizeMode = AutoSizeMode.GrowAndShrink;

            Width = MaterialActionBar.ACTION_BAR_HEIGHT;
            Height = MaterialActionBar.ACTION_BAR_HEIGHT;
            Margin = new Padding(4, 6, 4, 6);
            Padding = new Padding(0);

            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw, true);
        }

34. Example

Project: GKeyBank
Source File: Root.cs
View license
protected override void OnCreateControl()
        {
            base.OnCreateControl();
            if (!DesignMode)
            {
                BackColor = App.CurrentConfig.GetThemeBackColor();
                ForeColor = App.CurrentConfig.ThemeColor;
                SetStyle(ControlStyles.SupportsTransparentBackColor, true);

                foreach (TabPage p in TabPages)
                {
                    p.BackColor = App.CurrentConfig.GetThemeBackColor(); ;
                    p.ForeColor = App.CurrentConfig.ThemeColor;
                    p.UseVisualStyleBackColor = true;
                }
            }
        }

35. Example

Project: LaserGRBL
Source File: ImageButton.cs
View license
private void Init()
		{
			SetStyle(System.Windows.Forms.ControlStyles.UserPaint, true);
			SetStyle(System.Windows.Forms.ControlStyles.AllPaintingInWmPaint, true);
			SetStyle(System.Windows.Forms.ControlStyles.DoubleBuffer, true);
			SetStyle(System.Windows.Forms.ControlStyles.ResizeRedraw, true);
			SetStyle(System.Windows.Forms.ControlStyles.SupportsTransparentBackColor, true);
			SetStyle(System.Windows.Forms.ControlStyles.ContainerControl, true);

			this.BackColor = Color.FromArgb(0, 0, 0, 0);
		}

36. Example

Project: poderosa
Source File: TabBar.cs
View license
public void Init(TabBar parent, TabKey key, int index) {
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.UserPaint | ControlStyles.DoubleBuffer, true);
            //??????????
            _parent = parent;
            _tabKey = key;
            _index = index;
            _image = key.Icon;

            _indexText = (index + 1).ToString();
        }

37. Example

Project: kit-kat
Source File: Theme.cs
View license
protected override void OnCreateControl()
        {
            base.OnCreateControl();
            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer | ControlStyles.ResizeRedraw | ControlStyles.UserPaint, true);
        }

38. Example

Project: QTTabBar
Source File: TabSwitchForm.cs
View license
private void HideSwitcherInner(bool fClickClose, bool fSwitch) {
            if(fIsShown) {
                if(fCompositionEnabled) {
                    SetStyle(ControlStyles.OptimizedDoubleBuffer, false);
                    fDoubleBufferRequired = true;
                }
                fIsShown = false;
                PInvoke.ShowWindow(Handle, 0);
                if(fSwitch && (Switched != null)) {
                    ItemCheckEventArgs e = new ItemCheckEventArgs(fClickClose ? iHoveredIndex : selectedIndex, CheckState.Checked, CheckState.Checked);
                    Switched(this, e);
                }
            }
        }

39. Example

Project: QTTabBar
Source File: TabSwitchForm.cs
View license
protected override void OnPaint(PaintEventArgs e) {
            if(lstPaths.Count > 0) {
                DrawItems(e.Graphics);
            }
            if(fDoubleBufferRequired) {
                SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
                fDoubleBufferRequired = false;
            }
        }

40. Example

Project: AnotherSc2Hack
Source File: AnotherCheckbox.cs
View license
private void Init()
        {
            base.Cursor = Cursor;

            Instances.Add(this);

            SetStyle(ControlStyles.OptimizedDoubleBuffer |
            ControlStyles.AllPaintingInWmPaint |
            ControlStyles.UserPaint, true);
        }

41. Example

Project: AnotherSc2Hack
Source File: NewMainHandler.cs
View license
private void Init()
        {
            _.Info("Initialize UI Classes and Renderer", _.InfoImporta/n ..... /n //View Source file for more details /n }

42. Example

Project: AnotherSc2Hack
Source File: BaseRenderer.cs
View license
private void InitCode()
        {
            IsHidden = true;
            IsAllowedToClose = false;

            SetStyle(ControlStyles.DoubleBuffer |
                     ControlStyles.UserPaint |
                     ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.AllPaintingInWmPaint, true);

            InitializeComponent();

            BorderWidth = 10;

            LoadPreferencesIntoControls();

            Text = HelpFunctions.SetWindowTitle();
        }

43. Example

Project: N3DSCmbViewer
Source File: TreeViewEx.cs
View license
protected override void OnHandleCreated(EventArgs e)
        {
            base.OnHandleCreated(e);

            this.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw, true);

            if (!this.DesignMode && Environment.OSVersion.Platform == PlatformID.Win32NT && Environment.OSVersion.Version.Major >= 6)
            {
                Win32.SetWindowTheme(this.Handle, "explorer", null);
                this.ShowLines = false;
            }
        }

44. Example

Project: SharpBoot
Source File: GroupedComboBox.cs
View license
protected void ToggleStyle() {
        if (Program.IsWin && _bufferedPainter != null && _bufferedPainter.BufferedPaintSupported && (DropDownStyle == ComboBoxStyle.DropDownList)) {
            _bufferedPainter.Enabled = true;
            SetStyle(ControlStyles.UserPaint, true);
            SetStyle(ControlStyles.AllPaintingInWmPaint, true);
            SetStyle(ControlStyles.SupportsTransparentBackColor, true);
        }
        else {
            if(Program.IsWin && _bufferedPainter != null) _bufferedPainter.Enabled = false;
            SetStyle(ControlStyles.UserPaint, false);
            SetStyle(ControlStyles.AllPaintingInWmPaint, false);
            SetStyle(ControlStyles.SupportsTransparentBackColor, false);
        }

        if (IsHandleCreated) RecreateHandle();
    }

45. Example

View license
private void InitC()
        {
            InitializeComponent();
            tt.InitialDelay = 100;
            tt.SetToolTip(labelHP, "Health");
            tt.SetToolTip(labelSt, "Stamina");
            tt.SetToolTip(labelOx, "Oxygen");
            tt.SetToolTip(labelFo, "Food");
            tt.SetToolTip(labelWe, "Weight");
            tt.SetToolTip(labelDm, "Melee Damage");
            tt.SetToolTip(labelSp, "Speed");
            tt.SetToolTip(labelSex, "Sex");
            tt.SetToolTip(labelMutations, "Mutation-Counter");
            labels = new List<Label> { labelHP, labelSt, labelOx, labelFo, labelWe, labelDm, labelSp };
            this.SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
            Disposed += PedigreeCreature_Disposed;
        }

46. Example

Project: Toxy
Source File: RectangleAnnotate.cs
View license
private void InitializeComponent()
        {
            SuspendLayout();
            AutoScaleDimensions = new SizeF(6F, 13F);
            AutoScaleMode = AutoScaleMode.Font;
            StartPosition = FormStartPosition.Manual;
            Bounds = ScreenRectangle;
            FormBorderStyle = FormBorderStyle.None;
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            Text = "ShareX - " + Resources.RectangleAnnotate_InitializeComponent_Rectangle_capture_annotate;
            ShowInTaskbar = false;
            TopMost = true;

            Shown += RectangleAnnotate_Shown;
            MouseDown += RectangleAnnotate_MouseDown;
            MouseUp += RectangleAnnotate_MouseUp;
            MouseWheel += RectangleAnnotate_MouseWheel;
            KeyDown += RectangleAnnotate_KeyDown;
            KeyUp += RectangleAnnotate_KeyUp;
            FormClosing += RectangleAnnotate_FormClosing;
            LostFocus += RectangleAnnotate_LostFocus;

            ResumeLayout(false);
        }

47. Example

Project: Toxy
Source File: RectangleLight.cs
View license
private void InitializeComponent()
        {
            SuspendLayout();

            AutoScaleDimensions = new SizeF(6F, 13F);
            AutoScaleMode = AutoScaleMode.Font;
            StartPosition = FormStartPosition.Manual;
            Bounds = ScreenRectangle;
            FormBorderStyle = FormBorderStyle.None;
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            Text = "ShareX - " + Resources.RectangleLight_InitializeComponent_Rectangle_capture_light;
            ShowInTaskbar = false;
            TopMost = true;

            Shown += RectangleLight_Shown;
            KeyUp += RectangleLight_KeyUp;
            MouseDown += RectangleLight_MouseDown;
            MouseUp += RectangleLight_MouseUp;

            ResumeLayout(false);
        }

48. Example

Project: Toxy
Source File: Surface.cs
View license
private void InitializeComponent()
        {
            SuspendLayout();
            AutoScaleDimensions = new SizeF(6F, 13F);
            AutoScaleMode = AutoScaleMode.Font;
            StartPosition = FormStartPosition.Manual;
            Bounds = ScreenRectangle;
            FormBorderStyle = FormBorderStyle.None;
            SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
            Text = "ShareX - " + Resources.Surface_InitializeComponent_Region_capture;
            ShowInTaskbar = false;
            TopMost = true;
            Shown += Surface_Shown;
            KeyUp += Surface_KeyUp;
            MouseDoubleClick += Surface_MouseDoubleClick;
            ResumeLayout(false);
        }

49. Example

View license
private void InitControls()
    {
      using (new LayoutSuspender(this))
      {
        // Self form properties
        Dock = DockStyle.Fill;
        TabStop = true;
        FormBorderStyle = FormBorderStyle.None;
        AutoScaleMode = AutoScaleMode.None;
        StartPosition = FormStartPosition.Manual;
        ShowInTaskbar = false;
        Size = new Size(16, 16); // Large initial sizes affect layouting badly
        KeyPreview = true;
        SetStyle(ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.Selectable | ControlStyles.Opaque | ControlStyles.ContainerControl, true);
        Text = "ReSharper ? Enter Zen Coding abbreviation";
        TextBox = new TextBox { Dock = DockStyle.Fill };
        Controls.Add(TextBox);
        DialogResult = DialogResult.Cancel;
        myLifetimeDefinition.Lifetime.AddDispose(new EditboxGlyph(TextBox, ZenCodingThemedIcons.Zencoding.Id, myIconManager));

        // Note: we're not setting the owner to the main window because the menu must be over whatever top level window has spawned it; a menu is topmost so this is not a problem.      
      }
      PerformLayout();
    }

50. Example

Project: mRemoteNG
Source File: NGComboBox.cs
View license
protected override void OnCreateControl()
        {
            base.OnCreateControl();
            if (Tools.DesignModeTest.IsInDesignMode(this)) return;
            _themeManager = ThemeManager.getInstance();
            if (!_themeManager.ThemingActive) return;
            _themeManager = ThemeManager.getInstance();
            BackColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("ComboBox_Background");
            ForeColor = _themeManager.ActiveTheme.ExtendedPalette.getColor("ComboBox_Foreground");
            DrawMode = DrawMode.OwnerDrawFixed;
            SetStyle(ControlStyles.OptimizedDoubleBuffer |
                     ControlStyles.UserPaint, true);
            DrawItem += NG_DrawItem;
            _mice = MouseState.OUT; 
            MouseEnter += (sender, args) =>
            {
                _mice = MouseState.HOVER;
                Invalidate();
            };
            MouseLeave += (sender, args) =>
            {
                _mice = MouseState.OUT;
                Invalidate();
            };
            MouseDown += (sender, args) =>
            {
                if (args.Button != MouseButtons.Left) return;
                _mice = MouseState.DOWN;
                Invalidate();
            };
            MouseUp += (sender, args) =>
            {
                _mice = MouseState.OUT;

                Invalidate();
            };
            Invalidate();
        }