Abegrundete Ecken beim Rechteck
-
Hallo Leute, mach seit ca 1 jahr c++ und benötige mal hilfe
void CLineTest1View::OnDraw(CDC* pDC)
{
long i,x,y;
long color;
/////////////////////viereck mit rahmen
pDC->MoveTo(100,100);
pDC->LineTo(100,150);
pDC->LineTo(250,150);
pDC->LineTo(250,100);
pDC->LineTo(100,100);
pDC->MoveTo(107,107);
pDC->LineTo(243,107);
pDC->MoveTo(107,107+36);
pDC->LineTo(243,107+36);
pDC->MoveTo(107,107);
pDC->LineTo(107,107+36);
pDC->MoveTo(243,107+36);
pDC->LineTo(243,107);/* for (i=0; i<255; i++)//der strich
{
long color;color = (i<<16) + (i<<8) + i;
pDC->SetPixel(100+i,100+i, color);}
*///////////////////////////////oben unten vom rahmen färben
color = 0x901010;long sizex = 150;
long sizey = 7;for (y=0; y<sizey; y++)
{
int proz = ((y * 100) / sizey); // 0..100%
proz = 100 - ((proz - 50) / 1); // 75 ... 125%for (x=0; x<sizex; x++)
{
long color2;
long r,g,b;b = (color & 0xff0000) >> 16;
g = (color & 0x00ff00) >> 8;
r = (color & 0x0000ff);r = (r * proz) / 100;
g = (g * proz) / 100;
b = (b * proz) / 100;color2 = (b << 16) + (g <<
+ r;
pDC->SetPixel(100+x,100+y, color2);
pDC->SetPixel(100+x,143+y, color2);
pDC->SetPixel(100+x,100+y, color2);
}
}
/////////////////////////////rechts links vom rahmen färbenlong i2,x2,y2;
long color3;
color3 = 0x901010;long sizex2 = 7;
long sizey2 = 50;for (y=0; y<sizey2; y++)
{
int proz2 = ((y * 100) / sizey2); // 0..100%
proz2 = 100 - ((proz2 - 50) / 1); // 75 ... 125%for (x=0; x<sizex2; x++)
{
long color4;
long r,g,b;b = (color3 & 0xff0000) >> 16;
g = (color3 & 0x00ff00) >> 8;
r = (color3 & 0x0000ff);r = (r * proz2) / 100;
g = (g * proz2) / 100;
b = (b * proz2) / 100;color4 = (b << 16) + (g <<
+ r;
pDC->SetPixel(100+x,100+y, color4);
pDC->SetPixel(243+x,100+y, color4);
}
}
////////////////////////////////mitte vom viereck färbenlong i5,x5,y5;
long color5;
color5 = 0x991010;long sizex5 = 136;
long sizey5 = 36;for (y=0; y<sizey5; y++)
{
int proz5 = ((y * 100) / sizey5); // 0..100%
proz5 = 100 + ((proz5 - 40) / 1); // 75 ... 125%long r,g,b;
for (x=0; x<sizex5; x++)
{
long color6;b = (color5 & 0xff0000) >> 16;
g = (color5 & 0x00ff00) >> 8;
r = (color5 & 0x0000ff);r = (r * proz5) / 100;
g = (g * proz5) / 100;
b = (b * proz5) / 100;color6 = (b << 16) + (g <<
+ r;
pDC->SetPixel(107+x,107+y, color6);
}
}soweit ist alles gut nur würd ich gerne die ecken von den Rechtecken abrunden die Farbei ist erstmal egal
hoffe mir kann jmd weiterhelfen
-
Hallo,
CDC::RoundRect
Herzliche Grüsse
Walter
-
weicher schrieb:
Hallo,
CDC::RoundRect
Herzliche Grüsse
Walterhallo, danke für die antwort hab sowas aähnliches schon einmal gesehn
Copy
BOOL RoundRect(
int x1,
int y1,
int x2,
int y2,
int x3,
int y3
);
BOOL RoundRect(
LPCRECT lpRect,
POINT point
);kann ich dass dann einfach in den code dazuschreiben oder muss ich eine neue funktion erstellen
sry aber ich hab davor nur mit cmd gearbeitet noch nie mit grafik
-
Hallo,
versuch mal folgendes:
void CLineTest1View::OnDraw(CDC* pDC) { // x1 y1 x2 y2 CRect rect (50, 50, 200, 200); // x3 y3 pDC->RoundRect (rect, CPoint (10, 10); }
oder:
void ClineTest1View::OnDraw (CDC* pDC) { // x1 y1 x2 y2 x3 y3 pDC->RoundRect (50, 50, 200, 200, 10, 10); }
Ich habe es selber nicht ausprobiert.
Herzliche Grüsse
Walter
-
weicher schrieb:
Hallo,
versuch mal folgendes:
void CLineTest1View::OnDraw(CDC* pDC) { // x1 y1 x2 y2 CRect rect (50, 50, 200, 200); // x3 y3 pDC->RoundRect (rect, CPoint (10, 10); }
oder:
void ClineTest1View::OnDraw (CDC* pDC) { // x1 y1 x2 y2 x3 y3 pDC->RoundRect (50, 50, 200, 200, 10, 10); }
Ich habe es selber nicht ausprobiert.
Herzliche Grüsse
Walterok habs feritg dane für die hilfe