标题:哪位大神帮我看看哪里出问题了
取消只看楼主
yu965634383
Rank: 3Rank: 3
等 级:论坛游侠
帖 子:119
专家分:195
注 册:2017-9-1
结帖率:100%
 问题点数:0 回复次数:0 
哪位大神帮我看看哪里出问题了
# include <stdio.h>
# include <conio.h>
# include <windows.h>
# include <stdlib.h>
# include <string.h>
# include <time.h>

# define ROW 5            //行
# define COLUMN 30        //列

void Goto (int column , int row)
{
    HANDLE hOut = GetStdHandle (STD_OUTPUT_HANDLE);
    COORD xy = {0 , 0};
    xy.X = column;
    xy.Y = row;
    SetConsoleCursorPosition (hOut , xy);
}

SMALL_RECT DrawPane (void)
{
    Goto (COLUMN , ROW);
    printf ("╔");
    for (int i = 0; i < 12; i++)
    {
        printf ("═");
    }
    printf ("╗");
    for (int i = 1; i <= 16; i++)
    {
        Goto (COLUMN , ROW + i);
        printf ("║");
    }
    for (int i = 1; i <= 16; i++)
    {
        Goto (COLUMN + 26 , ROW + i);
        printf ("║");
    }
    Goto (COLUMN , ROW + 16);
    printf ("╚");
    for (int i = 0; i < 12; i++)
    {
        printf ("═");
    }
    printf ("╝");
    SMALL_RECT cr = {COLUMN , ROW , COLUMN + 26 , ROW + 16};
    return cr;
}

wchar_t * ChangeMultiByteToWideChar (char * Str)//char 类型转换为 wchar_t数据类型。
{
    int n;
    wchar_t * Wstr;
    n = MultiByteToWideChar (CP_ACP , 0 , Str , -1 , NULL , 0);
    Wstr = (wchar_t *) malloc (sizeof (wchar_t) * n);
    MultiByteToWideChar (CP_ACP , 0 , Str , -1 , Wstr , n);
    return Wstr;//每次调用都必须将Wstr释放
}

void Menu (void)
{

//    SMALL_RECT cr = DrawPane ();
    HANDLE hOut = GetStdHandle (STD_OUTPUT_HANDLE);
    COORD BufferSize = {80 , 250};
    COORD BufferCoord = {COLUMN+2 , ROW+1 };
//    COORD BufferCoord = {1 , 1};
    COORD BufferTem = BufferCoord;
    CHAR_INFO region , regionarray[80*250];
    region.Attributes = BACKGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY;
    char str[] = "菜单目录";
    PWCHAR Wstr = ChangeMultiByteToWideChar (str);
    for (int i = 0; i < wcslen (Wstr); i++)
    {
        region.Char.UnicodeChar = Wstr[i];
        regionarray[80*COLUMN+9+(ROW+i)] = region;
    //    regionarray[80*1+(1+i)] = region;
    }
    SMALL_RECT cr1 = {COLUMN  , ROW , COLUMN + wcslen (Wstr)-1 , ROW};
//    SMALL_RECT cr1 = {1  , 1 , wcslen (Wstr) , 1};
    WriteConsoleOutput (hOut , regionarray , BufferSize , BufferCoord , &cr1);
    free (Wstr);
}

int main (void)
{
//    DrawPane ();
    Menu ();

    return 0;
}

为什么不显示文字呢,到底哪里出问题了,
搜索更多相关主题的帖子: include ROW void int printf 
2017-10-05 18:36



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-481129-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.379742 second(s), 9 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved