static int drawcb(Ihandle *h, int lin, int col,int x1, int x2, int y1, int y2) { if (lin < 5 || lin > 12 || col < 2 || col > 8) return IUP_IGNORE; cdForeground(CD_RED); cdLine(x1, y1, x2, y2); cdLine(x1, y2, x2, y1); { char s[50]; sprintf(s, "%d:%d", lin, col); cdTextAlignment(CD_CENTER); cdText((x1+x2)/2, (y1+y2)/2, s); } return IUP_DEFAULT; }
void draw_wd(void) { char* text; double x, y; double rect[8]; cdBackground(CD_WHITE); cdClear(); cdLineStyle(CD_CONTINUOUS); cdLineWidth(1); // wdVectorTextDirection(0, 0, 1, 1); cdTextAlignment(CD_NORTH_WEST); // text = "Vector Text"; text = "Vector Text\nSecond Line\nThird Line"; x = 0.25; y = 0.40; cdForeground(CD_BLACK); wdLine(0, 0, 1, 1); wdLine(0, 1, 1, 0); cdForeground(CD_GREEN); cdMarkType(CD_STAR); wdMark(x, y); cdForeground(CD_BLUE); wdVectorCharSize(0.1); wdVectorText(x, y, text); cdForeground(CD_RED); wdGetVectorTextBounds(text, x, y, rect); cdBegin(CD_CLOSED_LINES); wdVertex(rect[0], rect[1]); wdVertex(rect[2], rect[3]); wdVertex(rect[4], rect[5]); wdVertex(rect[6], rect[7]); cdEnd(); }