亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? justify2.c

?? widows編程例題程序13-18章
?? C
?? 第 1 頁 / 共 2 頁
字號:
/*-----------------------------------------
   JUSTIFY2.C -- Justified Type Program #2
                 (c) Charles Petzold, 1998
  -----------------------------------------*/

#include <windows.h>
#include "resource.h"

#define OUTWIDTH 6       // Width of formatted output in inches
#define LASTCHAR 127     // Last character code used in text

LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;

TCHAR szAppName[] = TEXT ("Justify2") ;

int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                    PSTR szCmdLine, int iCmdShow)
{
     HWND     hwnd ;
     MSG      msg ;
     WNDCLASS wndclass ;
     
     wndclass.style         = CS_HREDRAW | CS_VREDRAW ;
     wndclass.lpfnWndProc   = WndProc ;
     wndclass.cbClsExtra    = 0 ;
     wndclass.cbWndExtra    = 0 ;
     wndclass.hInstance     = hInstance ;
     wndclass.hIcon         = LoadIcon (NULL, IDI_APPLICATION) ;
     wndclass.hCursor       = LoadCursor (NULL, IDC_ARROW) ;
     wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
     wndclass.lpszMenuName  = szAppName ;
     wndclass.lpszClassName = szAppName ;
     
     if (!RegisterClass (&wndclass))
     {
          MessageBox (NULL, TEXT ("This program requires Windows NT!"),
               szAppName, MB_ICONERROR) ;
          return 0 ;
     }
     
     hwnd = CreateWindow (szAppName, TEXT ("Justified Type #2"),
                          WS_OVERLAPPEDWINDOW,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          CW_USEDEFAULT, CW_USEDEFAULT,
                          NULL, NULL, hInstance, NULL) ;
     
     ShowWindow (hwnd, iCmdShow) ;
     UpdateWindow (hwnd) ;
     
     while (GetMessage (&msg, NULL, 0, 0))
     {
          TranslateMessage (&msg) ;
          DispatchMessage (&msg) ;
     }
     return msg.wParam ;
}

void DrawRuler (HDC hdc, RECT * prc)
{
     static int iRuleSize [16] = { 360, 72, 144, 72, 216, 72, 144, 72,
                                   288, 72, 144, 72, 216, 72, 144, 72 } ;
     int        i, j ;
     POINT      ptClient ;
     
     SaveDC (hdc) ;
     
          // Set Logical Twips mapping mode
     
     SetMapMode (hdc, MM_ANISOTROPIC) ;
     SetWindowExtEx (hdc, 1440, 1440, NULL) ;
     SetViewportExtEx (hdc, GetDeviceCaps (hdc, LOGPIXELSX),
                            GetDeviceCaps (hdc, LOGPIXELSY), NULL) ;
     
          // Move the origin to a half inch from upper left
     
     SetWindowOrgEx (hdc, -720, -720, NULL) ;
     
          // Find the right margin (quarter inch from right)
     
     ptClient.x = prc->right ;
     ptClient.y = prc->bottom ;
     DPtoLP (hdc, &ptClient, 1) ;
     ptClient.x -= 360 ;
     
          // Draw the rulers
     
     MoveToEx (hdc, 0,               -360, NULL) ;
     LineTo   (hdc, OUTWIDTH * 1440, -360) ;
     MoveToEx (hdc, -360,               0, NULL) ;
     LineTo   (hdc, -360,      ptClient.y) ;
     
     for (i = 0, j = 0 ; i <= ptClient.x && i <= OUTWIDTH * 1440 ;
                         i += 1440 / 16, j++)
     {
          MoveToEx (hdc, i, -360, NULL) ;
          LineTo   (hdc, i, -360 - iRuleSize [j % 16]) ;
     }
     
     for (i = 0, j = 0 ; i <= ptClient.y ; i += 1440 / 16, j++)
     {
          MoveToEx (hdc, -360, i, NULL) ;
          LineTo   (hdc, -360 - iRuleSize [j % 16], i) ;
     }
     
     RestoreDC (hdc, -1) ;
}

/*----------------------------------------------------------------------
   GetCharDesignWidths:  Gets character widths for font as large as the
                         original design size
  ----------------------------------------------------------------------*/

UINT GetCharDesignWidths (HDC hdc, UINT uFirst, UINT uLast, int * piWidths)
{
     HFONT             hFont, hFontDesign ;
     LOGFONT           lf ;
     OUTLINETEXTMETRIC otm ;

     hFont = GetCurrentObject (hdc, OBJ_FONT) ;
     GetObject (hFont, sizeof (LOGFONT), &lf) ;

          // Get outline text metrics (we'll only be using a field that is
          //   independent of the DC the font is selected into)

     otm.otmSize = sizeof (OUTLINETEXTMETRIC) ;
     GetOutlineTextMetrics (hdc, sizeof (OUTLINETEXTMETRIC), &otm) ;

          // Create a new font based on the design size

     lf.lfHeight = - (int) otm.otmEMSquare ;
     lf.lfWidth  = 0 ;
     hFontDesign = CreateFontIndirect (&lf) ;

          // Select the font into the DC and get the character widths

     SaveDC (hdc) ;
     SetMapMode (hdc, MM_TEXT) ;
     SelectObject (hdc, hFontDesign) ;

     GetCharWidth (hdc, uFirst, uLast, piWidths) ;
     SelectObject (hdc, hFont) ;
     RestoreDC (hdc, -1) ;

          // Clean up

     DeleteObject (hFontDesign) ;

     return otm.otmEMSquare ;
}

/*---------------------------------------------------------------------
   GetScaledWidths:  Gets floating point character widths for selected
                     font size
  ---------------------------------------------------------------------*/

void GetScaledWidths (HDC hdc, double * pdWidths)
{
     double  dScale ;
     HFONT   hFont ;
     int     aiDesignWidths [LASTCHAR + 1] ;
     int     i ;
     LOGFONT lf ;
     UINT    uEMSquare ;

          // Call function above

     uEMSquare = GetCharDesignWidths (hdc, 0, LASTCHAR, aiDesignWidths) ;

          // Get LOGFONT for current font in device context

     hFont = GetCurrentObject (hdc, OBJ_FONT) ;
     GetObject (hFont, sizeof (LOGFONT), &lf) ;

          // Scale the widths and store as floating point values

     dScale = (double) -lf.lfHeight / (double) uEMSquare ;

     for (i = 0 ; i <= LASTCHAR ; i++)
          pdWidths[i] = dScale * aiDesignWidths[i] ;
}

/*--------------------------------------------------------------
   GetTextExtentFloat:  Calculates text width in floating point
  --------------------------------------------------------------*/

double GetTextExtentFloat (double * pdWidths, PTSTR psText, int iCount)
{
     double dWidth = 0 ;
     int    i ;

     for (i = 0 ; i < iCount ; i++)
          dWidth += pdWidths [psText[i]] ;

     return dWidth ;
}

/*------------------------------------------------------------------
   Justify:  Based on design units for screen/printer compatibility
  ------------------------------------------------------------------*/

void Justify (HDC hdc, PTSTR pText, RECT * prc, int iAlign)
{
     double dWidth, adWidths[LASTCHAR + 1] ;
     int    xStart, yStart, cSpaceChars ;
     PTSTR  pBegin, pEnd ;
     SIZE   size ;

          // Fill the adWidths array with floating point character widths

     GetScaledWidths (hdc, adWidths) ;

     yStart = prc->top ;
     do                            // for each text line
     {
          cSpaceChars = 0 ;        // initialize number of spaces in line

          while (*pText == ' ')    // skip over leading spaces
               pText++ ;

          pBegin = pText ;         // set pointer to char at beginning of line
          
          do                       // until the line is known
          {
               pEnd = pText ;      // set pointer to char at end of line

                    // skip to next space 
               
               while (*pText != '\0' && *pText++ != ' ') ;

               if (*pText == '\0')
                    break ;

                    // after each space encountered, calculate extents

               cSpaceChars++ ;
               dWidth = GetTextExtentFloat (adWidths, pBegin, 
                                                      pText - pBegin - 1) ;
          }
          while (dWidth < (double) (prc->right - prc->left)) ;
          
          cSpaceChars-- ;               // discount last space at end of line
          
          while (*(pEnd - 1) == ' ')    // eliminate trailing spaces
          {
               pEnd-- ;
               cSpaceChars-- ;
          }

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲免费观看高清完整版在线观看 | 亚洲制服欧美中文字幕中文字幕| 激情综合色播五月| 欧美精品一区二区在线观看| 韩国av一区二区三区| 久久久午夜电影| 风间由美一区二区三区在线观看| 欧美激情自拍偷拍| 91亚洲精华国产精华精华液| 亚洲一区二区三区四区的| 911精品国产一区二区在线| 蜜臀久久久久久久| 国产婷婷色一区二区三区在线| 北岛玲一区二区三区四区| 一区二区三区四区精品在线视频| 欧美日韩精品欧美日韩精品| 日韩激情在线观看| 国产日韩亚洲欧美综合| 色综合久久综合| 日韩精品1区2区3区| 久久久久久久久久电影| 91在线视频网址| 视频在线在亚洲| 欧美国产精品劲爆| 欧美伦理电影网| 国产a久久麻豆| 亚洲成在人线在线播放| 久久久精品2019中文字幕之3| 色综合色狠狠天天综合色| 免费黄网站欧美| 亚洲特级片在线| 日韩精品一区二区三区中文不卡| 成人国产亚洲欧美成人综合网| 亚洲一区影音先锋| 国产亚洲欧洲997久久综合| 欧美色爱综合网| 国产不卡视频在线播放| 免费欧美在线视频| 一区二区三区欧美日| 久久久久久久久岛国免费| 欧美日韩国产成人在线免费| 国产不卡在线播放| 毛片不卡一区二区| 一区二区激情视频| 国产女同性恋一区二区| 91麻豆精品国产自产在线观看一区| av在线不卡网| 国产一区视频导航| 日韩精品一级中文字幕精品视频免费观看| 国产色婷婷亚洲99精品小说| 欧美高清视频www夜色资源网| gogogo免费视频观看亚洲一| 久久99热99| 午夜精品久久久久久久99水蜜桃| 中文字幕av一区二区三区免费看| 欧美一区二区三区在线| 欧美亚洲高清一区| 91久久精品一区二区| 成人美女视频在线观看18| 精品一区二区三区在线播放| 亚洲观看高清完整版在线观看| 国产精品久久久久久户外露出| 欧美mv日韩mv亚洲| 91精品国产综合久久香蕉麻豆| 欧美无砖砖区免费| 色综合久久88色综合天天| 成人免费毛片片v| 国产一区福利在线| 精品一区二区三区视频| 精品一区二区在线免费观看| 日本aⅴ免费视频一区二区三区| 性久久久久久久久久久久| 一区二区三区中文在线观看| 1024亚洲合集| 亚洲色图.com| 亚洲欧美日韩在线不卡| 中文字幕一区二区三区四区不卡 | 丁香天五香天堂综合| 激情文学综合插| 韩国av一区二区| 国产剧情一区二区| 国产麻豆精品在线观看| 国内精品伊人久久久久av影院 | 欧美日韩精品一区二区天天拍小说| 91影院在线观看| 在线观看视频一区| 欧美三区免费完整视频在线观看| 欧美这里有精品| 欧美日本免费一区二区三区| 欧美精品在线一区二区三区| 91麻豆精品国产| www国产精品av| 欧美国产丝袜视频| 亚洲精品第1页| 亚洲成人动漫一区| 欧美日韩一区久久| 欧美电影一区二区| 精品久久久久久无| 中文字幕制服丝袜成人av| 亚洲欧美色一区| 亚洲午夜电影网| 麻豆久久久久久| 国产东北露脸精品视频| 成a人片亚洲日本久久| 91麻豆国产福利在线观看| 欧美欧美午夜aⅴ在线观看| 精品毛片乱码1区2区3区| 中文字幕av一区 二区| 一区二区成人在线| 蜜臀av一区二区在线观看| 国产凹凸在线观看一区二区| 色综合久久久久久久久| 91精品久久久久久久久99蜜臂| 精品动漫一区二区三区在线观看| 国产精品久久看| 午夜亚洲国产au精品一区二区| 久久成人免费网| 99re视频这里只有精品| 7777精品伊人久久久大香线蕉的| 久久久久99精品国产片| 一区二区欧美视频| 国产乱码精品一区二区三区av| 一本大道综合伊人精品热热| 日韩三区在线观看| 亚洲三级在线免费| 极品少妇一区二区| 欧美亚洲综合网| 久久精品免费在线观看| 亚洲国产裸拍裸体视频在线观看乱了| 久久国产精品第一页| 91在线观看免费视频| 精品国产乱码久久久久久浪潮| 亚洲女性喷水在线观看一区| 久久国产精品72免费观看| 91一区二区在线| 国产三级欧美三级日产三级99| 亚洲与欧洲av电影| 成人免费视频视频在线观看免费| 欧美福利一区二区| 亚洲欧美色综合| 国产精品一区三区| 欧美日韩亚洲另类| 国产精品国产自产拍在线| 国产综合久久久久影院| 欧美肥胖老妇做爰| 亚洲成人av中文| 一本一道波多野结衣一区二区 | 欧美性xxxxxx少妇| 国产精品免费免费| 国产精品12区| 精品久久久久久久久久久院品网 | 久久综合久久99| 日韩av在线免费观看不卡| 91麻豆国产自产在线观看| 国产精品久久久久久久久果冻传媒 | 欧美va日韩va| 五月天丁香久久| 91福利国产精品| 亚洲欧美日韩国产综合| 国产91丝袜在线播放| 精品日韩在线一区| 蜜臀av亚洲一区中文字幕| 欧美日本国产视频| 亚洲一区影音先锋| 欧美主播一区二区三区| 亚洲欧美另类小说视频| 色噜噜久久综合| 亚洲精品精品亚洲| 91玉足脚交白嫩脚丫在线播放| 国产精品久久看| 成人sese在线| 国产精品乱子久久久久| 成人手机电影网| 亚洲欧洲一区二区在线播放| 波多野结衣中文一区| 亚洲免费观看在线观看| 在线看一区二区| 午夜影院久久久| 制服丝袜亚洲色图| 奇米亚洲午夜久久精品| 欧美xxxxxxxxx| 国产美女av一区二区三区| 中文字幕的久久| 欧美在线视频全部完| 日韩电影在线观看一区| 日韩精品影音先锋| www.一区二区| 午夜av一区二区三区| 欧美va亚洲va国产综合| caoporen国产精品视频| 亚洲国产aⅴ成人精品无吗| 日韩一级大片在线| 成人午夜视频福利| 色婷婷综合久久| 亚洲福利一二三区| 精品人伦一区二区色婷婷| 国产成人自拍网| 亚洲va中文字幕| 欧美精品一区二区三区视频| 成人福利视频网站|