Click here to Skip to main content
15,908,841 members
Home / Discussions / C#
   

C#

 
QuestionFetching Website Visitor Details By Email Pin
rowdykuttan3-Jan-11 2:11
rowdykuttan3-Jan-11 2:11 
AnswerRe: Fetching Website Visitor Details By Email Pin
Not Active3-Jan-11 2:40
mentorNot Active3-Jan-11 2:40 
AnswerRe: Fetching Website Visitor Details By Email Pin
GenJerDan3-Jan-11 4:28
GenJerDan3-Jan-11 4:28 
AnswerRe: Fetching Website Visitor Details By Email Pin
T M Gray3-Jan-11 9:49
T M Gray3-Jan-11 9:49 
QuestionSFTP using Sharp SSH Pin
SG21072-Jan-11 20:02
SG21072-Jan-11 20:02 
AnswerRe: SFTP using Sharp SSH Pin
OriginalGriff2-Jan-11 21:04
mveOriginalGriff2-Jan-11 21:04 
AnswerRe: SFTP using Sharp SSH Pin
Bernhard Hiller2-Jan-11 21:17
Bernhard Hiller2-Jan-11 21:17 
QuestionChanging Console font Pin
Mc_Topaz2-Jan-11 11:28
Mc_Topaz2-Jan-11 11:28 
I want to change the font size of the Console but that is not easy. After googling, the WinAPI SetCurrentConsoleFontEx() located in the kernel32.dll should do the trix. This is my code:

using System;
using System.Runtime.InteropServices;
using System.Diagnostics;

namespace ConsoleApplication1
{
    class Program
    {
        [StructLayout(LayoutKind.Sequential)]
        public struct COORD
        {
            public short X;
            public short Y;
        }

        [StructLayout(LayoutKind.Sequential)]
        public struct CONSOLE_FONT_INFO_EX
        {
            public uint cbSize;
            public uint nFont;
            public COORD dwFontSize;
            public ushort FontFamily;
            public ushort FontWeight;

            // todo: this isn't right, needs fixing
            //WCHAR FaceName[LF_FACESIZE];
            string FaceName;
        }

        [DllImport("kernel32.dll", SetLastError = true)]
        static extern bool SetCurrentConsoleFontEx(IntPtr ConsoleOutput, bool MaximumWindow, CONSOLE_FONT_INFO_EX ConsoleCurrentFontEx);

        static void Main(string[] args)
        {
            CONSOLE_FONT_INFO_EX font = new CONSOLE_FONT_INFO_EX();
            // font.cbSize = // <------ Don't know how to instantiate
            //SetCurrentConsoleFontEx(Process.GetCurrentProcess().MainWindowHandle, false, font);
        }

    }
}


My code is is in the Main() method, all other code I have googled and pasted in.
The only thing I miss is how I shall instantiate the CONSOLE_FONT_INFO_EX struct?
I want the font to be 16 x 12. Some suggestions?

Some sites I used:
http://msdn.microsoft.com/en-us/library/ms686200%28VS.85%29.aspx[^]
http://msdn.microsoft.com/en-us/library/ms682069%28v=VS.85%29.aspx[^]
AnswerRe: Changing Console font PinPopular
PIEBALDconsult2-Jan-11 15:19
mvePIEBALDconsult2-Jan-11 15:19 
AnswerRe: Changing Console font Pin
DaveyM692-Jan-11 18:03
professionalDaveyM692-Jan-11 18:03 
GeneralRe: Changing Console font Pin
Mc_Topaz2-Jan-11 22:16
Mc_Topaz2-Jan-11 22:16 
QuestionCan't set Label.Text Pin
Pelgar2-Jan-11 6:57
Pelgar2-Jan-11 6:57 
AnswerRe: Can't set Label.Text Pin
Luc Pattyn2-Jan-11 7:07
sitebuilderLuc Pattyn2-Jan-11 7:07 
GeneralRe: Can't set Label.Text [modified] Pin
Pelgar2-Jan-11 7:13
Pelgar2-Jan-11 7:13 
GeneralRe: Can't set Label.Text Pin
Luc Pattyn2-Jan-11 9:01
sitebuilderLuc Pattyn2-Jan-11 9:01 
GeneralRe: Can't set Label.Text Pin
Jeff Connelly3-Jan-11 4:40
Jeff Connelly3-Jan-11 4:40 
GeneralRe: Can't set Label.Text Pin
Luc Pattyn3-Jan-11 5:32
sitebuilderLuc Pattyn3-Jan-11 5:32 
QuestionA nice idea or not? Pin
venomation2-Jan-11 5:01
venomation2-Jan-11 5:01 
AnswerRe: A nice idea or not? Pin
OriginalGriff2-Jan-11 5:24
mveOriginalGriff2-Jan-11 5:24 
AnswerRe: A nice idea or not? (compensated) Pin
OriginalGriff2-Jan-11 5:25
mveOriginalGriff2-Jan-11 5:25 
GeneralRe: A nice idea or not? (compensated) Pin
venomation2-Jan-11 6:00
venomation2-Jan-11 6:00 
GeneralRe: A nice idea or not? (compensated) Pin
PIEBALDconsult2-Jan-11 7:12
mvePIEBALDconsult2-Jan-11 7:12 
GeneralRe: A nice idea or not? (compensated) Pin
jschell2-Jan-11 9:07
jschell2-Jan-11 9:07 
GeneralRe: A nice idea or not? (compensated) Pin
OriginalGriff2-Jan-11 9:11
mveOriginalGriff2-Jan-11 9:11 
GeneralRe: A nice idea or not? (compensated) Pin
jschell3-Jan-11 9:54
jschell3-Jan-11 9:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.