您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ GetCharWidth函数代码示例

51自学网 2021-06-01 21:04:53
  C++
这篇教程C++ GetCharWidth函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中GetCharWidth函数的典型用法代码示例。如果您正苦于以下问题:C++ GetCharWidth函数的具体用法?C++ GetCharWidth怎么用?C++ GetCharWidth使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了GetCharWidth函数的28个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: str

wxSize wxListBox::DoGetBestClientSize() const{    // find the widest string    int wLine;    int wListbox = 0;    for (unsigned int i = 0; i < m_noItems; i++)    {        wxString str(GetString(i));        GetTextExtent(str, &wLine, NULL);        if ( wLine > wListbox )            wListbox = wLine;    }    // give it some reasonable default value if there are no strings in the    // list    if ( wListbox == 0 )        wListbox = 6*GetCharWidth();    // the listbox should be slightly larger than the widest string    wListbox += 3*GetCharWidth();    // add room for the scrollbar    wListbox += wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);    // don't make the listbox too tall (limit height to 10 items) but don't    // make it too small neither    int hListbox = SendMessage(GetHwnd(), LB_GETITEMHEIGHT, 0, 0)*                    wxMin(wxMax(m_noItems, 3), 10);    return wxSize(wListbox, hListbox);}
开发者ID:CodeTickler,项目名称:wxWidgets,代码行数:31,


示例2: StringToUTFCharList

void CText::DrawString(const std::string &text, std::vector<FontMetaChar>::iterator format,                       std::vector<FontMetaChar>::iterator end,                       float size, Math::Point pos, float width, int eol, Color color){    m_engine->SetState(ENG_RSTATE_TEXT);    float start = pos.x;    unsigned int fmtIndex = 0;    std::vector<UTF8Char> chars;    StringToUTFCharList(text, chars, format, end);    for (auto it = chars.begin(); it != chars.end(); ++it)    {        FontType font = FONT_COLOBOT;        if (format + fmtIndex != end)            font = static_cast<FontType>(*(format + fmtIndex) & FONT_MASK_FONT);        UTF8Char ch = *it;        float offset = pos.x - start;        float cw = GetCharWidth(ch, font, size, offset);        if (offset + cw > width)  // exceeds the maximum width?        {            ch = TranslateSpecialChar(CHAR_SKIP_RIGHT);            cw = GetCharWidth(ch, font, size, offset);            pos.x = start + width - cw;            color = Color(1.0f, 0.0f, 0.0f);            DrawCharAndAdjustPos(ch, font, size, pos, color);            break;        }        FontHighlight hl = static_cast<FontHighlight>(format[fmtIndex] & FONT_MASK_HIGHLIGHT);        if (hl != FONT_HIGHLIGHT_NONE)        {            Math::Point charSize;            charSize.x = GetCharWidth(ch, font, size, offset);            charSize.y = GetHeight(font, size);            DrawHighlight(hl, pos, charSize);        }        DrawCharAndAdjustPos(ch, font, size, pos, color);        // increment fmtIndex for each byte in multibyte character        if ( ch.c1 != 0 )            fmtIndex++;        if ( ch.c2 != 0 )            fmtIndex++;        if ( ch.c3 != 0 )            fmtIndex++;    }    if (eol != 0)    {        FontType font = FONT_COLOBOT;        UTF8Char ch = TranslateSpecialChar(eol);        color = Color(1.0f, 0.0f, 0.0f);        DrawCharAndAdjustPos(ch, font, size, pos, color);    }}
开发者ID:Tellus,项目名称:colobot,代码行数:60,


示例3: WindowSetCursor

void WindowSetCursor (PCONINFO con, int x, int y, bool IsKanji){    if (IsKanji)        ChangeCaretSize (con->hWnd, GetCCharWidth (), GetCharHeight ());    else        ChangeCaretSize (con->hWnd, GetCharWidth (), GetCharHeight ());    SetCaretPos (con->hWnd, x * GetCharWidth (), y * GetCharHeight ());}
开发者ID:channinglan,项目名称:MINIGUI_1.3.3,代码行数:8,


示例4: FPDFText_ProcessInterObj

int FPDFText_ProcessInterObj(const CPDF_TextObject* pPrevObj, const CPDF_TextObject* pObj){    if(FPDFText_IsSameTextObject(pPrevObj, pObj)) {        return -1;    }    CPDF_TextObjectItem item;    int nItem = pPrevObj->CountItems();    pPrevObj->GetItemInfo(nItem - 1, &item);    FX_WCHAR preChar = 0, curChar = 0;    CFX_WideString wstr = pPrevObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);    if(wstr.GetLength()) {        preChar = wstr.GetAt(0);    }    FX_FLOAT last_pos = item.m_OriginX;    int nLastWidth = GetCharWidth(item.m_CharCode, pPrevObj->GetFont());    FX_FLOAT last_width = nLastWidth * pPrevObj->GetFontSize() / 1000;    last_width = FXSYS_fabs(last_width);    pObj->GetItemInfo(0, &item);    wstr = pObj->GetFont()->UnicodeFromCharCode(item.m_CharCode);    if(wstr.GetLength()) {        curChar = wstr.GetAt(0);    }    int nThisWidth = GetCharWidth(item.m_CharCode, pObj->GetFont());    FX_FLOAT this_width = nThisWidth * pObj->GetFontSize() / 1000;    this_width = FXSYS_fabs(this_width);    FX_FLOAT threshold = last_width > this_width ? last_width / 4 : this_width / 4;    CFX_AffineMatrix prev_matrix, prev_reverse;    pPrevObj->GetTextMatrix(&prev_matrix);    prev_reverse.SetReverse(prev_matrix);    FX_FLOAT x = pObj->GetPosX(), y = pObj->GetPosY();    prev_reverse.Transform(x, y);    if (FXSYS_fabs(y) > threshold * 2) {        return 2;    }    threshold = (FX_FLOAT)(nLastWidth > nThisWidth ? nLastWidth : nThisWidth);    threshold = threshold > 400 ? (threshold < 700 ? threshold / 4 :  threshold / 5) : (threshold / 2);    threshold *= nLastWidth > nThisWidth ? FXSYS_fabs(pPrevObj->GetFontSize()) : FXSYS_fabs(pObj->GetFontSize());    threshold /= 1000;    if (FXSYS_fabs(last_pos + last_width - x) > threshold && curChar != L' ' && preChar != L' ')        if(curChar != L' ' && preChar != L' ') {            if((x - last_pos - last_width) > threshold || (last_pos - x - last_width) > threshold) {                return 1;            }            if(x < 0 && (last_pos - x - last_width) > threshold) {                return 1;            }            if((x - last_pos - last_width) > this_width || (x - last_pos - this_width) > last_width ) {                return 1;            }        }    if(last_pos + last_width > x + this_width && curChar == L' ') {        return 3;    }    return 0;}
开发者ID:151706061,项目名称:PDFium,代码行数:55,


示例5: GetNumCols

RECT CBitmapFont::CalculateRect(int id){	RECT rCell;	rCell.left	= (id % GetNumCols()) * GetCharWidth();	rCell.top	= (id / GetNumCols()) * GetCharHeight();	rCell.right		= rCell.left + GetCharWidth();	rCell.bottom	= rCell.top + GetCharHeight();	return rCell;}
开发者ID:jakneute,项目名称:Earthworm-Jim-Full-Sail-Game-Project,代码行数:11,


示例6: GetCharWidth

wxSize wxRadioBox::GetMaxButtonSize() const{    // We use GetCheckBox() because there is no dedicated GetRadioBox() method    // in wxRendererNative, but check and radio boxes are usually of the same    // size anyhow. We also add half a character of width to account for the    // extra space after the radio box itself.    const int radioWidth =        wxRendererNative::Get().GetCheckBoxSize(            reinterpret_cast<wxWindow*>(const_cast<wxRadioBox*>(this))).x        + GetCharWidth() / 2;    // calculate the max button size    int widthMax = 0,        heightMax = 0;    const unsigned int count = GetCount();    for ( unsigned int i = 0 ; i < count; i++ )    {        int width, height;        GetTextExtent(wxGetWindowText((*m_radioButtons)[i]), &width, &height);        // adjust the size to take into account the radio box itself        width += radioWidth;        height *= 3;        height /= 2;        if ( widthMax < width )            widthMax = width;        if ( heightMax < height )            heightMax = height;    }    return wxSize(widthMax, heightMax);}
开发者ID:CodeSmithyIDE,项目名称:wxWidgets,代码行数:33,


示例7: SetExtraStyle

PathProp::PathProp( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos,        const wxSize& size, long style ){    m_opList = NULL;    m_nSelected = 0;    m_pEnroutePoint = NULL;    m_bStartNow = false;    m_pPath = NULL;    m_pEnroutePoint = NULL;    m_bStartNow = false;#ifdef __WXOSX__    style |= wxSTAY_ON_TOP;#endif    SetExtraStyle( GetExtraStyle() | wxWS_EX_BLOCK_EVENTS );    wxDialog::Create( parent, id, caption, pos, size, style );    wxFont *qFont = OCPNGetFont(_("Dialog"), 0);    SetFont( *qFont );            CreateControls();    //  Make an estimate of the dialog size, without scrollbars showing    wxSize esize;    esize.x = GetCharWidth() * 110;    esize.y = GetCharHeight() * 40;    SetSize( esize );    Centre();}
开发者ID:ptulp,项目名称:ocpn_draw_pi,代码行数:30,


示例8: GetCharWidth

void AISTargetListDialog::RecalculateSize(){    if(g_bresponsive){        //  Make an estimate of the dialog size                wxSize esize;        esize.x = GetCharWidth() * 110;        esize.y = GetCharHeight() * 40;                wxSize dsize = gFrame->GetClientSize();        esize.y = wxMin(esize.y, dsize.y - (4 * GetCharHeight()));        esize.x = wxMin(esize.x, dsize.x - (2 * GetCharHeight()));        SetClientSize(esize);                wxSize fsize = GetSize();        fsize.y = wxMin(fsize.y, dsize.y - (2 * GetCharHeight()));        fsize.x = wxMin(fsize.x, dsize.x - (2 * GetCharHeight()));        SetSize(fsize);                if( m_pAuiManager ){            wxAuiPaneInfo &pane = m_pAuiManager->GetPane(_T("AISTargetList"));                    if(pane.IsOk()){                pane.FloatingSize(fsize.x, fsize.y);                wxPoint pos = gFrame->GetScreenPosition();                pane.FloatingPosition(pos.x + (dsize.x - fsize.x)/2, pos.y + (dsize.y - fsize.y)/2);            }                        m_pAuiManager->Update();        }            }    }
开发者ID:jieter,项目名称:OpenCPN,代码行数:34,


示例9: GetLabel

wxSize wxRadioButton::DoGetBestSize() const{    static int s_radioSize = 0;    if ( !s_radioSize )    {        wxScreenDC dc;        dc.SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));        s_radioSize = dc.GetCharHeight();    }    wxString str = GetLabel();    int wRadio, hRadio;    if ( !str.empty() )    {        GetTextExtent(GetLabelText(str), &wRadio, &hRadio);        wRadio += s_radioSize + GetCharWidth();        if ( hRadio < s_radioSize )            hRadio = s_radioSize;    }    else    {        wRadio = s_radioSize;        hRadio = s_radioSize;    }    wxSize best(wRadio, hRadio);    CacheBestSize(best);    return best;}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:33,


示例10: zGetCharWidth

BOOL far pascal zGetCharWidth( HDC pp1, UINT pp2, UINT pp3, LPINT pp4 ){    BOOL r;    SaveRegs();    /*    ** Log IN Parameters (No Create/Destroy Checking Yet!)    */    LogIn( (LPSTR)"APICALL:GetCharWidth HDC+UINT+UINT++",        pp1, pp2, pp3, (short)0 );    /*    ** Call the API!    */    RestoreRegs();    GrovelDS();    r = GetCharWidth(pp1,pp2,pp3,pp4);    UnGrovelDS();    SaveRegs();    /*    ** Log Return Code & OUT Parameters (No Create/Destroy Checking Yet!)    */    LogOut( (LPSTR)"APIRET:GetCharWidth BOOL++++ARRAYINT+",        r, (short)0, (short)0, (short)0, pp4, 1 + pp3 - pp2 );    RestoreRegs();    return( r );}
开发者ID:mingpen,项目名称:OpenNT,代码行数:28,


示例11: GetCount

wxSize wxChoice::DoGetBestSize() const{    // find the widest string    int wChoice = 0;    const unsigned int nItems = GetCount();    for ( unsigned int i = 0; i < nItems; i++ )    {        int wLine;        GetTextExtent(GetString(i), &wLine, NULL);        if ( wLine > wChoice )            wChoice = wLine;    }    // give it some reasonable default value if there are no strings in the    // list    if ( wChoice == 0 )        wChoice = 100;    // the combobox should be slightly larger than the widest string    wChoice += 5*GetCharWidth();    wxSize best(wChoice, EDIT_HEIGHT_FROM_CHAR_HEIGHT(GetCharHeight()));    CacheBestSize(best);    return best;}
开发者ID:czxxjtu,项目名称:wxPython-1,代码行数:25,


示例12: _InsertWidthArray

static void _InsertWidthArray(HDC hDC,                              int start,                              int end,                              CPDF_Array* pWidthArray) {  int size = end - start + 1;  int* widths = FX_Alloc(int, size);  GetCharWidth(hDC, start, end, widths);  int i;  for (i = 1; i < size; i++)    if (widths[i] != *widths) {      break;    }  if (i == size) {    int first = pWidthArray->GetInteger(pWidthArray->GetCount() - 1);    pWidthArray->AddInteger(first + size - 1);    pWidthArray->AddInteger(*widths);  } else {    CPDF_Array* pWidthArray1 = new CPDF_Array;    pWidthArray->Add(pWidthArray1);    for (i = 0; i < size; i++) {      pWidthArray1->AddInteger(widths[i]);    }  }  FX_Free(widths);}
开发者ID:primiano,项目名称:pdfium-merge,代码行数:25,


示例13: assert

int CText::Detect(const std::string &text, FontType font, float size, float offset){    assert(font != FONT_BUTTON);    float pos = 0.0f;    unsigned int index = 0;    while (index < text.length())    {        UTF8Char ch;        int len = StrUtils::Utf8CharSizeAt(text, index);        if (len >= 1)            ch.c1 = text[index];        if (len >= 2)            ch.c2 = text[index+1];        if (len >= 3)            ch.c3 = text[index+2];        index += len;        if (ch.c1 == '/n')            return index;        float width = GetCharWidth(ch, font, size, pos);        if (offset <= pos + width/2.0f)            return index;        pos += width;    }    return index;}
开发者ID:Tellus,项目名称:colobot,代码行数:32,


示例14: GetTextExtent

wxSize wxListBox::DoGetBestClientSize() const{    wxCoord width = 0,            height = 0;    size_t count = m_strings->GetCount();    for ( size_t n = 0; n < count; n++ )    {        wxCoord w,h;        GetTextExtent(this->GetString(n), &w, &h);        if ( w > width )            width = w;        if ( h > height )            height = h;    }    // if the listbox is empty, still give it some non zero (even if    // arbitrary) size - otherwise, leave small margin around the strings    if ( !width )        width = 100;    else        width += 3*GetCharWidth();    if ( !height )        height = GetCharHeight();    // we need the height of the entire listbox, not just of one line    height *= wxMax(count, 7);    return wxSize(width, height);}
开发者ID:project-renard-survey,项目名称:chandler,代码行数:32,


示例15: GetCharWidth

wxSize wxRadioBox::GetTotalButtonSize( const wxSize& rSizeBtn ) const{    int    nCx1;    int    nCy1;    int    nHeight;    int    nWidth;    int    nWidthLabel = 0;    nCx1 = GetCharWidth();    nCy1 = GetCharHeight();    nHeight = GetRowCount() * rSizeBtn.y + (2 * nCy1);    nWidth  = GetColumnCount() * (rSizeBtn.x + nCx1) + nCx1;    //    // And also wide enough for its label    //    wxString sStr = wxGetWindowText(GetHwnd());    if (!sStr.empty())    {        GetTextExtent( sStr                      ,&nWidthLabel                      ,NULL                     );        nWidthLabel += 2*nCx1;    }    if (nWidthLabel > nWidth)        nWidth = nWidthLabel;    wxSize total( nWidth, nHeight );    return total;} // end of wxRadioBox::GetTotalButtonSize
开发者ID:LuaDist,项目名称:wxwidgets,代码行数:31,


示例16: while

float CText::GetStringWidth(const std::string &text,                            std::vector<FontMetaChar>::iterator format,                            std::vector<FontMetaChar>::iterator end, float size){    float width = 0.0f;    unsigned int index = 0;    unsigned int fmtIndex = 0;    while (index < text.length())    {        FontType font = FONT_COLOBOT;        if (format + fmtIndex != end)            font = static_cast<FontType>(*(format + fmtIndex) & FONT_MASK_FONT);        UTF8Char ch;        int len = StrUtils::Utf8CharSizeAt(text, index);        if (len >= 1)            ch.c1 = text[index];        if (len >= 2)            ch.c2 = text[index+1];        if (len >= 3)            ch.c3 = text[index+2];        width += GetCharWidth(ch, font, size, width);        index += len;        fmtIndex++;    }    return width;}
开发者ID:Tellus,项目名称:colobot,代码行数:31,


示例17: dc

wxSize wxDateTimePickerCtrl::DoGetBestSize() const{    wxClientDC dc(const_cast<wxDateTimePickerCtrl *>(this));    // Use the same native format as the underlying native control.#if wxUSE_INTL    wxString s = wxDateTime::Now().Format(wxLocale::GetInfo(MSWGetFormat()));#else // !wxUSE_INTL    wxString s("XXX-YYY-ZZZZ");#endif // wxUSE_INTL/!wxUSE_INTL    // the best size for the control is bigger than just the string    // representation of the current value because the control must accommodate    // any date and while the widths of all digits are usually about the same,    // the width of the month string varies a lot, so try to account for it    s += wxT("WW");    int x, y;    dc.GetTextExtent(s, &x, &y);    // account for the drop-down arrow or spin arrows    x += wxSystemSettings::GetMetric(wxSYS_HSCROLL_ARROW_X);    // and for the checkbox if we have it    if ( MSWAllowsNone() )        x += 3*GetCharWidth();    wxSize best(x, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y));    CacheBestSize(best);    return best;}
开发者ID:chromylei,项目名称:third_party,代码行数:31,


示例18: RenderLine

		void RenderLine(uint8 *pStart, float xOff, float vLineTop, float vLineBottom, int nCursor, int nSelStart, int nSelEnd, View *pcView, bool bSelected)		{						Color32_s sCursCol(40,40,40);			Color32_s sCursLineCol(255,235,186);						if( ! bSelected )			{				sCursCol = lighten_color(sCursCol);				sCursLineCol = lighten_color(sCursLineCol);			}					float vCharWidth = GetCharWidth();			float vCharHeight = GetCharHeight();						uint8 *pEnd = GetBuffer() + GetBufferLength();			static char zLine[(3 * BYTES_PER_LINE) + 1];			uint8 *p = pStart;			for( int x = 0; x < 3 * BYTES_PER_LINE; x+=3 )			{				if( p < pEnd )				{					zLine[x] = get_nibble_char(*p, true);					zLine[x + 1] = get_nibble_char(*p, false);					p++;				} else {					zLine[x] = ' ';					zLine[x + 1] = ' ';				}				zLine[x + 2] = ' ';			}								Rect cRect(xOff + GetX() + 2, vLineTop, xOff + GetX() + GetWidth() - 2, vLineBottom);						pcView->SetFgColor(Color32_s(0,0,0));										if( nSelStart < 0 )			{								if( nCursor >= 0 )					pcView->FillRect(cRect, sCursLineCol);								pcView->DrawText(cRect, zLine);				if( nCursor >= 0 )				{					float vCursorX = cRect.left + (3 * vCharWidth * nCursor);					if( m_bSecondChar )						vCursorX += vCharWidth;					pcView->SetFgColor(sCursCol);					pcView->DrawLine(Point(vCursorX, vLineTop), Point(vCursorX, vLineBottom));					vCursorX++;					pcView->DrawLine(Point(vCursorX, vLineTop), Point(vCursorX, vLineBottom));				}			}			else			{				IPoint cSel1((int)(nSelStart * 3 * vCharWidth), (int)vCharHeight);				IPoint cSel2((int)((nSelEnd * 3 * vCharWidth) + (vCharWidth * 2)), (int)vCharHeight);				pcView->DrawSelectedText(cRect, zLine, cSel1, cSel2, SEL_CHAR);			}		}
开发者ID:PyroOS,项目名称:Pyro,代码行数:60,


示例19: toupper

void CBitmapFont::DrawString(const char* szText, int nPosX, int nPosY){	CSGD_TextureManager* pTM = CSGD_TextureManager::GetInstance();	//	iterate through the string 1 character at a time	int length = (int)strlen(szText);	for (int i=0; i < length; i++)	{		//	get ascii value of character		char ch = szText[i];		//	make sure character is uppercase		ch = toupper(ch);		//	calculate the id on the bitmap using the start char		int id = ch - GetStartChar();		//	Make a rect based on an ID		RECT rLetter = CalculateRect(id);		//	Draw it to the screen		pTM->Draw(GetFontImageID(), nPosX + (i*GetCharWidth()), nPosY, 1.0f, 1.0f, &rLetter);	}}
开发者ID:jakneute,项目名称:Earthworm-Jim-Full-Sail-Game-Project,代码行数:25,


示例20: StringToUTFCharList

void CText::DrawString(const std::string &text, std::vector<FontMetaChar>::iterator format,                       std::vector<FontMetaChar>::iterator end,                       float size, Math::Point pos, float width, int eol, Color color){    m_engine->SetState(ENG_RSTATE_TEXT);    float start = pos.x;    unsigned int fmtIndex = 0;    std::vector<UTF8Char> chars;    StringToUTFCharList(text, chars);    for (auto it = chars.begin(); it != chars.end(); ++it)    {        FontType font = FONT_COLOBOT;        if (format + fmtIndex != end)            font = static_cast<FontType>(*(format + fmtIndex) & FONT_MASK_FONT);        // TODO: if (font == FONT_BUTTON)        if (font == FONT_BUTTON) continue;        UTF8Char ch = *it;        float offset = pos.x - start;        float cw = GetCharWidth(ch, font, size, offset);        if (offset + cw > width)  // exceeds the maximum width?        {            // TODO: special end-of-line char            break;        }        FontHighlight hl = static_cast<FontHighlight>(format[fmtIndex] & FONT_MASK_HIGHLIGHT);        if (hl != FONT_HIGHLIGHT_NONE)        {            Math::Point charSize;            charSize.x = GetCharWidth(ch, font, size, offset);            charSize.y = GetHeight(font, size);            DrawHighlight(hl, pos, charSize);        }        DrawCharAndAdjustPos(ch, font, size, pos, color);        fmtIndex++;    }    // TODO: eol}
开发者ID:xiendev,项目名称:colobot,代码行数:47,


示例21: HandleMouseLeftUpWhenCaptured

void HandleMouseLeftUpWhenCaptured (PCONINFO con, int x, int y, WPARAM wParam){    x /= GetCharWidth ();    y /= GetCharHeight ();    TextCopy (con, con->m_origx, con->m_origy, x, y);    con->m_oldx = x;    con->m_oldy = y;}
开发者ID:channinglan,项目名称:MINIGUI_1.3.3,代码行数:10,


示例22: wxSize

wxSize wxChoice::DoGetBestSize() const{    // We use the base window size for the height (which is wrong as it doesn't    // take the font into account -- TODO) and add some margins to the width    // computed by the base class method to account for the arrow.    const int lbHeight = wxWindow::DoGetBestSize().y;    return wxSize(wxChoiceBase::DoGetBestSize().x + 2*lbHeight + GetCharWidth(),                  lbHeight);}
开发者ID:chromylei,项目名称:third_party,代码行数:10,


示例23: return

BOOL C_Font::AddFont(long ,LOGFONT *){#if 0	FONTLIST *newfont,*cur;	HDC hdc;	newfont=new FONTLIST;	newfont->Spacing_=Spacing_;	newfont->Font_=CreateFontIndirect(reqs);	if(newfont->Font_ == NULL)	{		delete newfont;		return(FALSE);	}	memcpy(&newfont->logfont,reqs,sizeof(LOGFONT));	newfont->ID_=ID;	Handler_->GetDC(&hdc);	SelectObject(hdc,newfont->Font_);	GetTextMetrics(hdc,&newfont->Metrics_);	newfont->Widths_=new INT[newfont->Metrics_.tmLastChar+1];	if(!GetCharWidth(hdc,0,newfont->Metrics_.tmLastChar,&newfont->Widths_[0]))	{		VOID *lpMsgBuf;		FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,					  NULL,GetLastError(),MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(LPTSTR) &lpMsgBuf,0,NULL );		// Display the string.		MessageBox( NULL, (char *)lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION );		// Free the buffer.		LocalFree( lpMsgBuf );	}	Handler_->ReleaseDC(hdc);	newfont->Next=NULL;	if(Root_ == NULL)	{		Root_=newfont;	}	else	{		cur=Root_;		while(cur->Next)			cur=cur->Next;		cur->Next=newfont;	}	return(TRUE);#endif	return(FALSE);}
开发者ID:JagHond,项目名称:freefalcon-central,代码行数:55,


示例24: MAKELPARAM

wxTextCtrlHitTestResultwxTextCtrl::HitTest(const wxPoint& pt, long *posOut) const{    // first get the position from Windows    // for the plain ones, we are limited to 16 bit positions which are    // combined in a single 32 bit value    LPARAM lParam = MAKELPARAM(pt.x, pt.y);    LRESULT pos = ::SendMessage(GetBuddyHwnd(), EM_CHARFROMPOS, 0, lParam);    if ( pos == -1 )    {        // this seems to indicate an error...        return wxTE_HT_UNKNOWN;    }    // for plain EDIT controls the higher word contains something else    pos = LOWORD(pos);    // next determine where it is relatively to our point: EM_CHARFROMPOS    // always returns the closest character but we need to be more precise, so    // double check that we really are where it pretends    POINTL ptReal;    LRESULT lRc = ::SendMessage(GetBuddyHwnd(), EM_POSFROMCHAR, pos, 0);    if ( lRc == -1 )    {        // this is apparently returned when pos corresponds to the last        // position        ptReal.x =        ptReal.y = 0;    }    else    {        ptReal.x = LOWORD(lRc);        ptReal.y = HIWORD(lRc);    }    wxTextCtrlHitTestResult rc;    if ( pt.y > ptReal.y + GetCharHeight() )        rc = wxTE_HT_BELOW;    else if ( pt.x > ptReal.x + GetCharWidth() )        rc = wxTE_HT_BEYOND;    else        rc = wxTE_HT_ON_TEXT;    if ( posOut )        *posOut = pos;    return rc;}
开发者ID:ACanadianKernel,项目名称:pcsx2,代码行数:54,


示例25: GetCharWidth

wxRect wxStaticBox::GetBorderGeometry() const{    // FIXME should use the renderer here    wxRect rect;    rect.width =    rect.x = GetCharWidth() / 2 + 1;    rect.y = GetCharHeight() + 1;    rect.height = rect.y / 2;    return rect;}
开发者ID:CustomCardsOnline,项目名称:wxWidgets,代码行数:11,


示例26: GetClientSize

void SjLogListCtrl::SizeChanged(){	wxSize size = GetClientSize();	int    charW = GetCharWidth(); // Returns the average character width for this window.	int    w1 = charW*10;	int    w2 = charW*10;	SetColumnWidth(0, size.x-w1-w2);	SetColumnWidth(1, w1);	SetColumnWidth(2, w2);}
开发者ID:conradstorz,项目名称:silverjuke,代码行数:11,


示例27: GetCharWidth

		uint8 *GetCursorAt(const Point &cPos)		{			int x = (int)(cPos.x / GetCharWidth());			int y = (int)(cPos.y / GetCharHeight()) + GetScrollLine();			if( x < 0 || x >= BYTES_PER_LINE )				return NULL;			uint8 *pCursor = GetBuffer() + (y * BYTES_PER_LINE) + x;			if( pCursor >= GetBuffer() + GetBufferLength() )				return NULL;			return pCursor;		}
开发者ID:PyroOS,项目名称:Pyro,代码行数:11,


示例28: dc

wxSize wxDatePickerCtrl::DoGetBestSize() const{    wxClientDC dc(const_cast<wxDatePickerCtrl *>(this));    // we can't use FormatDate() here as the CRT doesn't always use the same    // format as the date picker control    wxString s;    for ( int len = 100; ; len *= 2 )    {        if ( ::GetDateFormat               (                    LOCALE_USER_DEFAULT,    // the control should use the same                    DATE_SHORTDATE,         // the format used by the control                    NULL,                   // use current date (we don't care)                    NULL,                   // no custom format                    wxStringBuffer(s, len), // output buffer                    len                     // and its length               ) )        {            // success            break;        }        const DWORD rc = ::GetLastError();        if ( rc != ERROR_INSUFFICIENT_BUFFER )        {            wxLogApiError(wxT("GetDateFormat"), rc);            // fall back on wxDateTime, what else to do?            s = wxDateTime::Today().FormatDate();            break;        }    }    // the best size for the control is bigger than just the string    // representation of todays date because the control must accommodate any    // date and while the widths of all digits are usually about the same, the    // width of the month string varies a lot, so try to account for it    s += wxT("WW");    int x, y;    dc.GetTextExtent(s, &x, &y);    // account for the drop-down arrow or spin arrows    x += wxSystemSettings::GetMetric(wxSYS_HSCROLL_ARROW_X);    // and for the checkbox if we have it    if ( HasFlag(wxDP_ALLOWNONE) )        x += 3*GetCharWidth();    wxSize best(x, EDIT_HEIGHT_FROM_CHAR_HEIGHT(y));    CacheBestSize(best);    return best;}
开发者ID:erwincoumans,项目名称:wxWidgets,代码行数:54,



注:本文中的GetCharWidth函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


C++ GetCharacterMovement函数代码示例
C++ GetCharHeight函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。