Skip to content

Commit

Permalink
增加使用示例截图
Browse files Browse the repository at this point in the history
  • Loading branch information
Mattuy committed Dec 11, 2018
1 parent 45c72a6 commit eff857e
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 260 deletions.
31 changes: 11 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

&emsp;&emsp;你可以为每一****设定字符格式,字符格式由Windows的一些<a href="#constant">常量</a>定义。

<font color="red">&emsp;&emsp;这不是一个设计严谨的库,使用需谨慎。</font>
&emsp;&emsp;最初只是为了在某个高级语言中控制控制台输出而写这些函数,<font color="red">**这不是一个设计严谨的库,使用需谨慎。**</font>

## 开发环境
&emsp;&emsp;Windows,Visual Studio 2017
Expand All @@ -28,7 +28,7 @@

## 使用方法
* ### C++
将代码目录里的conctrl.h,编译得到的conctrl.dll和conctrl.lib放在相同目录,在你的代码中添加:
将代码目录里的conctrl.h,编译得到的conctrl.dll和conctrl.lib放在VS项目目录,在你的代码中添加:
> `#include "conctrl.h"`
> `#pragma comment(lib, "conctrl.lib")`
Expand All @@ -41,8 +41,6 @@

&emsp;&emsp;分隔线是需要占用空间的,由于制表符是双字节字符,因此分隔线长度必须是2的倍数。同时注意,水平分割线的**高度**是1个字符,而**垂直分隔线的宽度是2个字符**

&emsp;&emsp;构建这个库的初衷是为了方便某些高级语言操作控制台,因此没有导出类而是封装了一系列C函数,并将它们的参数都设定为简单的数值型和字符串,避免在高级语言中额外定义数据类型,方便使用。

<big> &emsp;&emsp;**你不应该直接操作ConsoleWindow、Pannel、和Spliter类对象**,而应仅将它们的指针作为参数传递。</big>

&emsp;&emsp;此库通过调用Windows API实现,因此仅适用于Windows系统。
Expand Down Expand Up @@ -125,17 +123,18 @@
#include <string.h>
#include <Windows.h>
#include "conctrl.h"
#pragma comment(lib, "conctrl.lib")
int main() {
ConsoleWindow* window = CreateConsoleWindow(80, 40);
Pannel* messagePannel = CreatePannel(window, 0, 0, 78, 25);
Pannel* writePannel = CreatePannel(window, 0, 26, 80, 40);
Spliter* spliter = CreateSpliter(window, 0, 25, 80, false, FOREGROUND_GREEN);
AddPannelText(messagePannel, "输入任意内容,回车发送", true, true, 7);
ConsoleWindow* window = CreateConsoleWindow(100, 30);
Pannel* messagePannel = CreatePannel(window, 0, 0, 100, 20);
Pannel* writePannel = CreatePannel(window, 0, 21, 100, 9);
Spliter* spliter = CreateSpliter(window, 0, 20, 100, false, FOREGROUND_GREEN);
AddPannelLine(messagePannel, "请在下方输入任意内容,回车发送", false, false, 7);
FocusOnPannel(writePannel, 0, 0);
while (true) {
char str[1024];
gets_s(str, 1023);
AddPannelText(messagePannel, str, false, false, FOREGROUND_RED | FOREGROUND_GREEN);
char text[1024];
gets_s(text, 1023);
AddPannelLine(messagePannel, text, false, false, FOREGROUND_RED | FOREGROUND_GREEN);
ClearPannel(writePannel);
FocusOnPannel(writePannel, 0, 0);
}
Expand Down Expand Up @@ -174,14 +173,6 @@ conctrl
#define BACKGROUND_GREEN 0x0020 // background color contains green.
#define BACKGROUND_RED 0x0040 // background color contains red.
#define BACKGROUND_INTENSITY 0x0080 // background color is intensified.
#define COMMON_LVB_LEADING_BYTE 0x0100 // Leading Byte of DBCS
#define COMMON_LVB_TRAILING_BYTE 0x0200 // Trailing Byte of DBCS
#define COMMON_LVB_GRID_HORIZONTAL 0x0400 // DBCS: Grid attribute: top horizontal.
#define COMMON_LVB_GRID_LVERTICAL 0x0800 // DBCS: Grid attribute: left vertical.
#define COMMON_LVB_GRID_RVERTICAL 0x1000 // DBCS: Grid attribute: right vertical.
#define COMMON_LVB_REVERSE_VIDEO 0x4000 // DBCS: Reverse fore/back ground attribute.
#define COMMON_LVB_UNDERSCORE 0x8000 // DBCS: Underscore.
#define COMMON_LVB_SBCSDBCS 0x0300 // SBCS or DBCS flag.
```
## 项目地址
Expand Down
Binary file added test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
114 changes: 0 additions & 114 deletions test_x64/conctrl.cpp

This file was deleted.

Binary file removed test_x64/conctrl.dll
Binary file not shown.
106 changes: 0 additions & 106 deletions test_x64/conctrl.h

This file was deleted.

Binary file removed test_x64/conctrl.lib
Binary file not shown.
20 changes: 0 additions & 20 deletions test_x64/main.cpp

This file was deleted.

0 comments on commit eff857e

Please sign in to comment.