Change line colour in Excel 2007 chart series - c#

First of all, I've looked at EVERY other post here, about this (I think) and none of them solves it.
I have a graph in excel, where I would like to change the colour of the line. It seems like, everything in the series line settings, is out of reach. If I cannot set the colour, I would like to set the fill to none, so the line is invisible, only showing the markers, which I can manipulate.
However, fill is also in the colour settings.
I have tried recording a macro aswell, but it shows nothing, other than series select.
Other posts here, suggest setting border on the series, but there is no border object to my knowledge.
Does anyone have any tricks that might solve this?

So, over on the MSDN forums, Andrei Smolin managed to solve it for me.
It was indeed Series.Border that fixed it.
The big problem was, that Border does not show up, as an object on series. Not even in VBA.
It seems to be fixed in Excel 2010, but this is the behaviour i'm experiencing in 2007 SP3.
So, the solution was to simply type:
MSExcel.Series Series1 = (MSExcel.Series)Chart.SeriesCollection(1);
Series1.Border.Color = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(79, 129, 189));
which compiled fine, and worked at runtime.
For reference sake, this is the MSDN thread:
http://social.msdn.microsoft.com/Forums/en-US/vsto/thread/2816660e-a18e-47f4-b121-02a71cb2c262

In addition to Nicolai's answer, there is an easier way to pass color value to Border.Color, for example:
Series1.Border.Color = (int) XlRgbColor.rgbRed;

For Excel 2007, the following:
series5.Interior.Color = Color.FromArgb(80, 208, 146).ToArgb();
works for me.

Related

How to get back Visual Studio's old way of alerting of suggestions by darkening code instead of by 3 dots?

Visual Studio used to alert us of unused variables by darkening them. Now (version 16.10.2) it fills the code with three dots everywhere, which look a little like code and are more confusing.
Is there a way to get the old way back?
There is a color control for the ellipses called "Suggestion Ellipses...". You could set the foreground color of it to the same color as your editors background to get a sense that its turned off. You'll still see it when you select the item though like so:
Version 16.10.3 now
It looks like they changed it back.
So if you still have it - update VS.

UWP: difference between RichEditBox and RichTextBlock in displaying some fonts

I have a project in UWP where I need to display the same text in a RichEditBox and in a RichTextBlock.
For some fonts (e.g. Courier), this is pretty ok and no big problems, but for other fonts (like Arial) the difference is pretty substantial.
Please note that I use exactly the same code, the only difference is just the Font.
Please find an MVCE that reproduces the issue here: https://github.com/vfailla/UWPRichEditBox
How can I setup the two elements to display the text in Arial in the very same visual way?
For some fonts (e.g. Courier), this is pretty ok and no big problems, but for other fonts (like Arial) the difference is pretty substantial. Please note that I use exactly the same code, the only difference is just the Font.
First of all, you will need to set the same CharacterSpacing of these two different controls:
m_richEditBox.CharacterSpacing = 100;
m_richTextBlock.CharacterSpacing = 100;
Then, you will need to set the same FontStretch of two controls, but here comes the issue:After a few tests I found textStretch doesn't work for RichEditBox/TextBox. And by default, the text inside look more like FontStretch.Condensed. So as a temporary workaround, you can set your RichTextBlock.FontStretch to FontStretch.Condensed:
m_richTextBlock.FontStretch = FontStretch.Condensed;
I'll consult through internal channel to report this issue, and I'll update this thread once I got any response.

Chart X Axis wrong labels

I have a chart and a datagridview, both of them are databound to a dictionary, for example:
freqChart.Series[0].Points.DataBindXY(symCount.Keys, symCount.Values);
And on the screenshot below you can see the difference in X-Axis label/key names. Datagridview shows it correctly, while chart flips char if it's punctuation char. What's the problem? How do I fix it?
Screenshot (Chart and DataGridView):
My comment was wrong; in fact this is a funny effect you get when you have a RightToLeft turned on.
There are several values but this one is enough to reproduce:
freqChart.RightToLeft = RightToLeft.Yes
Either this is what you want, then you can turn it on for the DGV as well; or it isn't then simply turn it off..
freqChart.RightToLeft = RightToLeft.No
As you can see it is a Control.Property so it will work on all controls. Also to be noted: The RightToLeft property is an ambient property, so it propagates to child controls.
Why it acts so strangly I can't say, though. The docs basically talk about alignment, not punctuation. If you are interested you may want to read up on it in wikipedia

XtrReports, xrPictureBox how to align Image to right ? Winform Devexpress

Am using Devexpress Winforms 12.2 version. I designed XtraReport with Logo on right side. When image is small automatically it align to left. I need to set pull right. Their is no option to set alignment in property. How to write programmatically code in BeforePrint event of xrPictureBox ?
I tried this one but didn't work xrPictureBox1.Image = ContentAlignment.MiddleRight; showing error cannot implicitly convert type ContentAlignment to Drawing.Image
Thanks in Advance.
You'd better search their support channel, there are several threads on this subject, like XTraReport - XRPictureBox alignment and XRPictureBox - Provide the capability to specify image alignment. From the last one looks like they finally provided out of the box solution XRPictureBox.ImageAlignment Property, but you need to upgrade to v15.1. If you can't, check if some of the suggested workarounds in the links work for you.

trackbar appearance with backcolor

How to make a trackbar like this picture? If its unachiveable with the trackbar, what other methods are there to achieve something similar?
I would have a sql populate the values too.. any suggestion on how to approach this?
An example would be for PH reading we have a set of values to be maximum and minimum, the slider would be the current value of the object. The green zone is the first warning values, the yellow is the danger values.
I found two links by which you can customize TrackBar in C# visual studio. It is not the exact solution to your question but I believe if you play around with this u can find out what you want.
Code Project .com
ViBlend
Regards

Categories