| |

VerySource

 Forgot password?
 Register
Search
View: 1556|Reply: 11

In the call loop of DrawText, the rc vertical coordinate is also changed, but why is it always drawn at the same positio

[Copy link]

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

Post time: 2020-1-30 21:40:02
| Show all posts |Read mode
Which expert can explain to me

memDC.SelectObject (&DetailFont);
rc.SetRect (nLeft, yAxis, nRight, yAxis + yPix * 5);
yAxis = yAxis + yPix * 5;
memDC.DrawText ((LPCTSTR) csViewTemp,&rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE);

In other loops
memDC.SelectObject (&DetailFont);
rc.SetRect (nLeft, yAxis, nRight, yAxis + yPix * 5);
yAxis = yAxis + yPix * 5;
memDC.DrawText ((LPCTSTR) csViewTemp.Mid (0, 66),&rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
Reply

Use magic Report

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-3-8 09:30:01
| Show all posts
And the distance is sufficient

Should not be covered

But it turned out that the first

Only the second drawn string can appear
Reply

Use magic Report

0

Threads

9

Posts

8.00

Credits

Newbie

Rank: 1

Credits
8.00

 China

Post time: 2020-3-8 14:30:01
| Show all posts
Because there is such a setting: DT_LEFT | DT_VCENTER | DT_SINGLELINE

So it always shows in one place
Reply

Use magic Report

0

Threads

17

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-3-8 16:15:01
| Show all posts
Does yPix cycle from 0?
A little more code posts
Reply

Use magic Report

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 United States

 Author| Post time: 2020-3-8 21:30:02
| Show all posts
yPix is ​​the number of pixels of 1mm


DT_LEFT is horizontal from left
DT_VCENTER is centered vertically
DT_SINGLELINE is a single line
Reply

Use magic Report

0

Threads

17

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-3-10 12:00:01
| Show all posts
The piece of code you posted is not wrong
I want to see how your loop code is written
Reply

Use magic Report

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-3-13 03:30:01
| Show all posts
doubleByte = csViewTemp.GetAt (subIndex);
// Judge whether it is a Chinese character
if (IsDBCSLeadByte (doubleByte)! = 0)
{
   if (subIndex == 0)
   {
       subIndex = subIndex + 1;
   }
   else if (subIndex! = 65&&subIndex! = 66)
{
subIndex = subIndex + 1;
}
else if (subIndex == 66)
{
memDC.SelectObject (&DetailFont);
rc.SetRect (nLeft, yAxis, nRight, yAxis + yPix * 5);
yAxis = yAxis + yPix * 5;
memDC.DrawText ((LPCTSTR) csViewTemp.Mid (0, 66),&rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
csViewTemp.Delete (0, 66);
subIndex = 0;
}
else
{
memDC.SelectObject (&DetailFont);
rc.SetRect (nLeft, yAxis, nRight, yAxis + yPix * 5);
yAxis = yAxis + yPix * 5;
memDC.DrawText ((LPCTSTR) csViewTemp.Mid (0, 67),&rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
csViewTemp.Delete (0, 67);
subIndex = 0;
}
Ranch
}
else
{
if (subIndex == 0)
{
}
else if (subIndex == 66)
{
memDC.SelectObject (&DetailFont);
rc.SetRect (nLeft, yAxis, nRight, yAxis + yPix * 5);
yAxis = yAxis + yPix * 5;
memDC.DrawText ((LPCTSTR) csViewTemp.Mid (0, 67),&rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
csViewTemp.Delete (0, 67);
subIndex = 0;
}
}
if (csViewTemp.GetLength () <= 67)
{memDC.SelectObject (&DetailFont);
rc.SetRect (nLeft, yAxis, nRight, yAxis + yPix * 5);
yAxis = yAxis + yPix * 5;
memDC.DrawText ((LPCTSTR) csViewTemp,&rc, DT_LEFT | DT_VCENTER | DT_SINGLELINE);
subIndex = csViewTemp.GetLength ();
}
Reply

Use magic Report

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-3-13 09:15:01
| Show all posts
Too much
Formatting is too laborious

Let's make it up
Reply

Use magic Report

1

Threads

8

Posts

7.00

Credits

Newbie

Rank: 1

Credits
7.00

 China

 Author| Post time: 2020-3-21 16:30:01
| Show all posts
Why isn't there an admiration?
Reply

Use magic Report

0

Threads

17

Posts

10.00

Credits

Newbie

Rank: 1

Credits
10.00

 China

Post time: 2020-3-23 18:00:01
| Show all posts
Dizzy, or haven't seen you cycle?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list