I have an Ultragrid which display things with backcolor depending on situation...
When I try to print, in the print preview, I got this (which is the same I got if I do print)...
So, question is simple : What should I do in order to get the same result as what I see when "consulting" the grid as normal...
Hi Nicloas,
It looks like you intended to post an image with your post, but I don't see the image. To attach an image file, go to the Options tab while posting and just attach the image as a file.
Ok
In the screenshot "composition", First picture is the grid being used in my application... with a Style and the
color treatment...
private void EtatGrid_InitializeRow(object sender, Infragistics.Win.UltraWinGrid.InitializeRowEventArgs e) { if(e.Row.Cells["Process"].Value.ToString() != "OK") { e.Row.Appearance.AlphaLevel = 200; e.Row.Appearance.BackColorAlpha = Infragistics.Win.Alpha.Opaque; e.Row.Appearance.BackColor = Color.Red; } }
Second image is what I get when exporting for printing... As you can see, the red lines persists but not the backcolor...
Any logical explanations ?
thanks
nicolas etienne said:well, If I remove the Alphalevel, the cell is not longer colored with the color.. (well the background is not colored as expected).
Sorry... what does that mean, exactly? Is the row colored or not? Or are you saying it's red instead of pink?
Does removing the AlphaLevel fix the printing issue?
There's nothing wrong with this code, but I don't know if the printer can support alpha blending. If you just want the rows to be pink, why don't you set the BackColor to pink instead of Red? That will be a lot more efficient than using AlphaBlending to mix red with the BackColor.
Well, if I only do this :
if(e.Row.Cells["Process"].Value.ToString() != "OK") { e.Row.Appearance.BackColor = Color.Pink; }
I get the picture attached... not really pink isn't it ?
Well, that's odd. Why it is it blue?
There must be some other settings involved here, like maybe that row is selected and the selection is using an overlay color that is mixing with the pink. That shouldn't affect printing, though, since the printed grid won't have any selected rows.
the blue is because of the selection
but other rows are not pink as they should due to the code you told me to test.
I haven't done lot of customisation in the grid... really no color set up or anything like that.
Maybe it's coming from the style I'm using ? I'm using Nautilus Style... (through the UltraFormManager component).
So, there is no explanation to my problem ?
If you are using an isl file (like nautilus), then that will certainly have an effect. There might be some other alpha-blending already taking place on the row, so maybe that's why the color is not working.
It's really hard to say since there are so many factors involved. If you could create a small sample project that demonstrates the printing issue, I'm sure I could debug it and tell you exactly what's going on and how to fix it. But without a sample, all I can really do is take wild stabs in the dark.
You did follow me :)
FitWidthToPages made the trick...
So glad I did find answers to my questions.
Thanks a lot Mike...
Thanks from Toulouse, France.. ;)
Hi,
I'm not sure I follow you. The size of the PrintPreview dialog has no effect on the actual printout.
If you want the grid to print on a single page (width), you can do this:
private void ultraGrid1_InitializePrint(object sender, CancelablePrintEventArgs e) { e.DefaultLogicalPageLayoutInfo.FitWidthToPages = 1; } private void ultraGrid1_InitializePrintPreview(object sender, CancelablePrintPreviewEventArgs e) { e.DefaultLogicalPageLayoutInfo.FitWidthToPages = 1; }
You actually only have to do this in one of these two events, but which one you use depends on how you are printing, so I listed them both. Doing it both probably won't hurt, anyway.
It seems to be ok but for the nautilus style.
Ok thanks for your answer...
Just one last question: What property should I "play" with in order to have the printing of the grid fit a page..
My question is simple : If I change the size of the windows, the printPreview change what's on the page to be printed (the more width I have the more
pages are required to print the grid..)
Any clues ?
Thanks
I'm using the Nautilus style...
But would I have to do the same action for every ISL file a provide to my client ?
this isl file a right from your distribution of version 13.2.
So, do I have to "fix" on all ISL or is it only for the Nautilus style ?
Okay, the color is being overriden by a setting in the isl file. The isl is applying a background image to the Row with a solid white block image. I'm not sure why - it seems kind've odd, but the image is covering up the backcolor.When you alphablend, you are seeing the color through the image.
So the simplest solution would be to modify the isl and remove the image.
Open up the isl in AppStylist.
Go to the Grid canvas.
Mouse over any cell in the grid and press 2 - this will take you to the GridRow UIRole.
In the Background section, drop down the Image and select No image.
Then save the isl (you might want to save it as a copy so you don't overwrite the original) and use the new isl. Then you can set the color of a row without messing around with the alpha blending and the printing works fine.