質問

http://fc04.deviantart.net/fs71/f/2011/277/7/6/problem_by_tekuconcept-d4btjlx.png

As shown in the image above, I want to be able to draw a contrast in the string. I have read this link: about the same thing (technically)(http://stackoverflow.com/questions/1192543/drawing-a-contrasted-string-on-an-image/1192560#1192560) and there I found this link: talking about how to create an XOR pen/brush. I tried the GDI when drawing to a panel but when it came to initialization, I got an "...imbalanced stack detected...". Is there a way I can create this effect(without going near applying glows/outlines).

I was thinking I could draw one color to a bitmap as well as the other the same way. Merging them, I do not currently know how to go about, and I'm not sure what affect it would have on computer performance.

(For any one curious as to what I'm doing... I'm creating a collection of custom designed controls based off the current professional GUI styles): fc09 . deviantart . net/fs71/f/2011/277/0/9/controls_by_tekuconcept-d4btji9.png

役に立ちましたか?

解決

Draw the text twice using different clipping regions and different colors.

他のヒント

My current implementation of such a progress bar uses two bitmaps which represent two halves of the progress bar.

1) Draw a bitmap that is as wide as your current progress value.
2) Fill it with the progress bar colour.
3) Write the text in the appropriate place, as if it were in the middle of the control. It will probably cut off the right.
4) Draw a bitmap that is as wide as the rest of the progress bar.
5) Fill it with the background colour.
6) Write the text in the same place, so that it sits off the left of the image.
7) Merge the two.

It's a bit of a hack, but it works.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top