Click here to Skip to main content
15,903,362 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionRe: Volume Control through program.... Pin
ashwath200512-Sep-05 4:29
ashwath200512-Sep-05 4:29 
AnswerRe: Volume Control through program.... Pin
David Crow12-Sep-05 4:39
David Crow12-Sep-05 4:39 
GeneralRe: Volume Control through program.... Pin
ashwath200512-Sep-05 18:33
ashwath200512-Sep-05 18:33 
GeneralRe: Volume Control through program.... Pin
David Crow19-Sep-05 7:25
David Crow19-Sep-05 7:25 
Questionpassing reference to vector in dll function Pin
Anonymous12-Sep-05 1:15
Anonymous12-Sep-05 1:15 
AnswerRe: passing reference to vector in dll function Pin
ab8lam12-Sep-05 1:49
ab8lam12-Sep-05 1:49 
AnswerRe: passing reference to vector in dll function Pin
Nemanja Trifunovic12-Sep-05 2:17
Nemanja Trifunovic12-Sep-05 2:17 
QuestionGraphics.MeasureString word wrap problem Pin
Kramer_198212-Sep-05 1:13
Kramer_198212-Sep-05 1:13 
How do you measure a string with word wrap? I want to pass a text to the program, a Rectangle which to contain it in a given Bitmap, a starting font size, and I need the program to decrease the fontSize until the text fits the Rectangle. After the fontSize has been computed, the text will be drawn to the Bitmap using DrawString(...). However, I can't get MeasureString to compute the text limits. This is the code I use :

{
mFont = new Font(mFontFamily, mFontSize, UnitPixel);
DebugAssert(mFont != NULL);

FLOAT fontSize = mFontSize;
StringFormat *stringFormat = StringFormat::GenericTypographic()->Clone();
stringFormat->SetFormatFlags(0);
graphics.SetTextRenderingHint(TextRenderingHintAntiAlias);
RectF *textRectangle = new RectF(0, 0, 0, 0);
int codePointFitted;
int lines;
graphics.MeasureString(mTextString, mTextString.length(), mFont, layoutRectangle, stringFormat, textRectangle, &codePointFitted, &lines);

while (((textRectangle->Width > mMaxTextWidth) || (textRectangle->Height > mMaxTextHeight)) && (!(fontSize < 0)))
{
fontSize = fontSize - 1.0f;
mFont = new Font(mFontFamily, fontSize, UnitPixel);
DebugAssert(mFont != NULL);
graphics.MeasureString(mTextString, mTextString.length(), mFont, layoutRectangle, stringFormat, textRectangle);
}
if (fontSize < 5.0f)
fontSize = 5.0f;

mFont = new Font(mFontFamily, fontSize, UnitPixel);
DebugAssert(mFont != NULL);
delete stringFormat;
}


If I don't use a StringFormat the returned limits are 0.0, if I use it, it computes the limits exactly as those of the layoutRectangle. fontSize starts at about 120, and the limits of the layoutRectangle are (Width 180; Height 160), and the Text is long enough not to enter those limits. "HELLO WORLD" is long enough. Any help is appreciated Smile | :) .
QuestionOutlined Font in Direct3D ? Pin
Danoo12-Sep-05 1:10
Danoo12-Sep-05 1:10 
QuestionSystem Menu in MFC -Plz Help Pin
parims12-Sep-05 0:45
parims12-Sep-05 0:45 
AnswerRe: System Menu in MFC -Plz Help Pin
toxcct12-Sep-05 0:50
toxcct12-Sep-05 0:50 
Questionwhat does the MapViewOfFile do exactly?? Pin
Anonymous12-Sep-05 0:42
Anonymous12-Sep-05 0:42 
AnswerRe: what does the MapViewOfFile do exactly?? Pin
Niklas L12-Sep-05 3:06
Niklas L12-Sep-05 3:06 
GeneralRe: what does the MapViewOfFile do exactly?? Pin
namaskaaram12-Sep-05 4:02
namaskaaram12-Sep-05 4:02 
GeneralRe: what does the MapViewOfFile do exactly?? Pin
Niklas L12-Sep-05 4:24
Niklas L12-Sep-05 4:24 
GeneralRe: what does the MapViewOfFile do exactly?? Pin
Chintoo72312-Sep-05 6:01
Chintoo72312-Sep-05 6:01 
GeneralRe: what does the MapViewOfFile do exactly?? Pin
namaskaaram12-Sep-05 17:11
namaskaaram12-Sep-05 17:11 
QuestionCreate child process Pin
whofmans12-Sep-05 0:29
whofmans12-Sep-05 0:29 
AnswerRe: Create child process Pin
David Crow12-Sep-05 3:13
David Crow12-Sep-05 3:13 
QuestionProblems with .NET double data type Pin
sirtimid12-Sep-05 0:11
sirtimid12-Sep-05 0:11 
AnswerRe: Problems with .NET double data type Pin
toxcct12-Sep-05 0:18
toxcct12-Sep-05 0:18 
GeneralRe: Problems with .NET double data type Pin
sirtimid12-Sep-05 0:42
sirtimid12-Sep-05 0:42 
GeneralRe: Problems with .NET double data type Pin
toxcct12-Sep-05 1:44
toxcct12-Sep-05 1:44 
GeneralRe: Problems with .NET double data type Pin
sirtimid12-Sep-05 21:54
sirtimid12-Sep-05 21:54 
GeneralRe: Problems with .NET double data type Pin
Maximilien12-Sep-05 3:04
Maximilien12-Sep-05 3:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.