Click here to Skip to main content
12,897,830 members (67,862 online)
Click here to Skip to main content


13 bookmarked
Posted 23 Aug 2008

Hacking FontDialog

, 23 Aug 2008 CPOL
How to hide UI elements of a FontDialog (e.g., Font Size).
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);

        public static extern IntPtr GetDlgItem(IntPtr hDlg, int nIDDlgItem);

        public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);

        public static extern void GetClassName(IntPtr hWnd, StringBuilder param, int length);

        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.


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


About the Author

Hungary Hungary
No Biography provided

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.170424.1 | Last Updated 23 Aug 2008
Article Copyright 2008 by legcsabi
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid