कैसे मैं GDI/GDI + के साथ इस तरह एक हल्का सीमा आकर्षित कर सकते हैं: एक हल्की सीमा (बाहरी चमक प्रभाव) कैसे आकर्षित करें?
किसी को भी मुझे सोचा था की एक ट्रेन दे सकते हैं धन्यवाद।
कैसे मैं GDI/GDI + के साथ इस तरह एक हल्का सीमा आकर्षित कर सकते हैं: एक हल्की सीमा (बाहरी चमक प्रभाव) कैसे आकर्षित करें?
किसी को भी मुझे सोचा था की एक ट्रेन दे सकते हैं धन्यवाद।
जीडीआई + का उपयोग करके, मैं आपको पथग्रेडेंटब्रश का उपयोग करने की सलाह दूंगा। यह आपको किनारे के चारों ओर रंगों की श्रृंखला के साथ एक क्षेत्र भरने की अनुमति देता है जो सभी केंद्र रंग की तरफ मिश्रण करते हैं। आपको शायद इस मामले में केवल 1 एज रंग की आवश्यकता है। एक गोलाकार आयत के लिए एक GraphicsPath बनाएँ और FillPath का उपयोग करें() एक 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);
समान, लेकिन मैं वही प्रभाव नहीं चाहता ... और मैं चमक को नियंत्रित नहीं कर सकता ...... धन्यवाद – toki
इसके लिए एक रैखिक ग्रेडिएंट ब्रश की आवश्यकता है। या DrawImage()। –