Come posso disegnare un bordo alleggerito come questo con GDI/GDI +:? Come disegnare un bordo alleggerito (effetto bagliore esterno)?
Qualcuno mi può dare una linea di pensiero Grazie.
Come posso disegnare un bordo alleggerito come questo con GDI/GDI +:? Come disegnare un bordo alleggerito (effetto bagliore esterno)?
Qualcuno mi può dare una linea di pensiero Grazie.
Utilizzo di GDI +, si consiglia di utilizzare PathGradientBrush. Ti permette di riempire una regione con una serie di colori attorno al bordo che si fondono tutti con un colore centrale. Probabilmente hai solo bisogno di 1 colore del bordo in questo caso. Creare un GraphicsPath per un rettangolo arrotondato e utilizzare FillPath() per riempire con un PathGradientBrush:
GraphicsPath graphicsPath;
//rect - for a bounding rect
//radius - for how 'rounded' the glow will look
int diameter = radius * 2;
graphicsPath.AddArc(Rect(rect.X, rect.Y, diameter, diameter) 180.0f, 90.0f);
graphicsPath.AddArc(Rect(rect.X + rect.Width - diameter, rect.Y, diameter, diameter), 270.0f, 90.0f);
graphicsPath.AddArc(Rect(rect.X + rect.Width - diameter, rect.Y + rect.Height - diameter, diameter, diameter), 0.0f, 90.0f);
graphicsPath.AddArc(Rect(rect.X, rect.Y + rect.Height - diameter, diameter, diameter), 90.0f, 90.0f);
graphicsPath.CloseFigure();
PathGradientBrush brush(&graphicsPath);
brush.SetCenterColor(centerColor); //would be some shade of blue, following your example
int colCount = 1;
brush.SetSurroundColors(surroundColor, &colCount); //same as your center color, but with the alpha channel set to 0
//play with these numbers to get the glow effect you want
REAL blendFactors[] = {0.0, 0.1, 0.3, 1.0};
REAL blendPos[] = {0.0, 0.4, 0.6, 1.0};
//sets how transition toward the center is shaped
brush.SetBlend(blendFactors, blendPos, 4);
//sets the scaling on the center. you may want to have it elongated in the x-direction
brush.SetFocusScales(0.2f, 0.2f);
graphics.FillPath(&brush, &graphicsPath);
simile, ma non proprio lo stesso effetto che voglio ... e non riesco a controllare il bagliore accuatly ...... grazie anche – toki
Ciò richiede un LinearGradientBrush. O DrawImage(). –