Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Hacking FontDialog

, 23 Aug 2008 CPOL
How to hide UI elements of a FontDialog (e.g., Font Size).
FontDialogHack.zip
FontDialogHack
FontDialogHack
bin
Debug
FontDialogHack.exe
FontDialogHack.vshost.exe
Properties
Settings.settings
using System;
using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace DrawTools
{
    public enum SetWindowPosFlags
    {
        SWP_NOSIZE = 0x0001,
        SWP_NOMOVE = 0x0002,
        SWP_NOZORDER = 0x0004,
        SWP_NOREDRAW = 0x0008,
        SWP_NOACTIVATE = 0x0010,
        SWP_FRAMECHANGED = 0x0020,
        SWP_SHOWWINDOW = 0x0040,
        SWP_HIDEWINDOW = 0x0080,
        SWP_NOCOPYBITS = 0x0100,
        SWP_NOOWNERZORDER = 0x0200,
        SWP_NOSENDCHANGING = 0x0400,
        SWP_DRAWFRAME = 0x0020,
        SWP_NOREPOSITION = 0x0200,
        SWP_DEFERERASE = 0x2000,
        SWP_ASYNCWINDOWPOS = 0x4000
    }

    public static class Win32
    {
        public delegate bool EnumWindowsCallBack(IntPtr hWnd, int lParam);

        [DllImport("user32.dll")]
        public static extern IntPtr GetDlgItem(IntPtr hDlg, int nIDDlgItem);

        [DllImport("user32.dll")]
        public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

        [DllImport("User32.Dll")]
        public static extern void GetClassName(IntPtr hWnd, StringBuilder param, int length);

        [DllImport("user32.Dll")]
        public static extern bool EnumChildWindows(IntPtr hWndParent, EnumWindowsCallBack lpEnumFunc, int lParam);

        [DllImport("user32.dll", CharSet = CharSet.Auto)]
        public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int x, int y, int Width, int Height, SetWindowPosFlags flags);

        public const int SW_HIDE = 0;
        public const int SW_SHOW = 5;
        public const int WM_ACTIVATE = 0x0006;
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

legcsabi

Hungary Hungary
No Biography provided

| Advertise | Privacy | Mobile
Web02 | 2.8.141015.1 | Last Updated 23 Aug 2008
Article Copyright 2008 by legcsabi
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid