Dear all,
I have below code. How can I do to show ultragrid data without background image or background image without ultragrid data??? But I find that it cannot show background image without ultragrid data. There are still ultragrid data shown. Is it possible to hide them with only showing background image??
if ( show ultragrid data....)
.....................
else if (System.IO.File.Exists(this.imagePath + imageName)) { Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance(); appearance1.BackColor = System.Drawing.Color.Transparent; appearance1.ImageBackground = System.Drawing.Image.FromFile(this.imagePath + imageName); this.ultraGrid1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.ultraGrid1.DisplayLayout.Bands[0].ColHeadersVisible = false; this.ultraGrid1.DisplayLayout.Appearance = appearance1; this.ultraGrid1.BringToFront(); }
Hi,
No, I'm afraid I still do not understand what you are asking.
It looks like you are trying to hide the grid and show a panel with the same background image. If that is what you want, then the code you have here seems like it should work, assuming that the grid and the panel are siblings. If the grid is inside the panel, then the BringToFront method on the panel will not place the panel in front of the grid.
But I'm afraid I still do not understand what you are trying to accomplish.
rchiu5hk said:I want to show background image only no matter whether there are rows or no rows in the grid.
According to this sentence, you want to show only a Background image when there is data in the grid and when there is no data in the grid. It sounds like you are saying that you don't want a grid, you just want to display an image. If that's the case, then I don't understand why you are even mentioning the grid. It does not make sense.
Dear Mike,
I am using below code. But still show ultragrid data. I want to show background image only no matter whether there are rows or no rows in the grid. Do you understand me??
else if (System.IO.File.Exists(this.imagePath + imageName)) { Infragistics.Win.Appearance appearance1 = new Infragistics.Win.Appearance(); appearance1.BackColor = System.Drawing.Color.Transparent; appearance1.ImageBackground = System.Drawing.Image.FromFile(this.imagePath + imageName); this.ultraGrid1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None; this.ultraGrid1.DisplayLayout.Bands[0].ColHeadersVisible = false; this.ultraGrid1.DisplayLayout.Appearance = appearance1; this.ultraGrid1.BringToFront(); this.panel2 = new System.Windows.Forms.Panel(); this.panel2.BackColor = System.Drawing.Color.Black; this.panel2.Location = new System.Drawing.Point(0, 0); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(940, 453); this.panel2.TabIndex = 3; this.panel2.BackgroundImage = System.Drawing.Image.FromFile(this.imagePath + imageName); this.panel2.BringToFront(); }
It sounds like you only want the background image to display when there are no rows in the grid. If that's the case, then you should set the ImageBavkground based on the grid.Rows.Count property. But that does not make a lot of sense to me, so I am pretty sure I still don't understand your question.
As shown below image, it is ultragrid with background image. I want it only show background image without data. Is it possible??
I do not understand your question.
If you want to show a grid without a background image, then do not set the ImageBackground property to an image.