Tab Panel Background

I am using syncfusion to create the tab pages.  I need to set the tab background to an Image (4x4 pixel .png file).  The property is TabPanelBackColor but it only allows you to select COLOR.

If this is not possible, I would like to set all naturual areas in the entire form to this background image.


thanks in advance.
ramrocketAsked:
Who is Participating?

[Webinar] Streamline your web hosting managementRegister Today

x
 
vo1dConnect With a Mentor Commented:
e.Graphics.DrawImage(Image.FromFile("C:\\background.png"),0,0, (sender as TabPage).Width, (sender as TabPage).Height);
0
 
vo1dCommented:
you could create a graphics object from the tabPage and draw the imagedata to it.
0
 
ramrocketAuthor Commented:
can you explain more.  I'm not familiar with the steps.
0
The new generation of project management tools

With monday.com’s project management tool, you can see what everyone on your team is working in a single glance. Its intuitive dashboards are customizable, so you can create systems that work for you.

 
vo1dCommented:
where do you want to paint the image? on the tabpage or on the page 'selectbutton'?
0
 
ramrocketAuthor Commented:
I want to paint the image as background of the entire form, background of the tabpage.
0
 
vo1dCommented:
should it look similar to this?
http://www.codeproject.com/cs/miscctrl/closabletabcontrolpage.asp
you could draw your image instead of the 'X'.
0
 
vo1dCommented:
then you can use the paint event of each tabpage to draw the image into it.
0
 
ramrocketAuthor Commented:
no, it shouldnt look like that.

the image needs to be painted on the grey filled background (not the background of each page title x Page 1)

so if I can draw the image to the entire form as its background, it think it will solve my problem.
0
 
vo1dCommented:
then use the tabpage paint event like that:
this.tabPage1.Paint += new System.Windows.Forms.PaintEventHandler(this.tabPage1_Paint);


private void tabPage1_Paint(object sender, PaintEventArgs e)
        {
            e.Graphics.DrawImage(image, 0, 0);
        }

0
 
ramrocketAuthor Commented:
sorry what is the instance of image?
0
 
vo1dCommented:
it's your image which you wanna paint.
0
 
ramrocketAuthor Commented:
vo, it didnt work.  
0
 
vo1dCommented:
could you please paste your code where your are setting up the eventhandler and the eventhandler itself?
0
 
ramrocketAuthor Commented:
private Image image = Image.FromFile("c:\\background.png");
..
this.tabPageAdv3.Paint += new PaintEventHandler(tabPageAdv3_Paint);

private void tabPageAdv3_Paint(object sender, PaintEventArgs e)
{
e.Graphics.DrawImage(image, 0, 0);
}

I also did it to the entire form and it didnt set the background.
0
 
vo1dCommented:
make a breakpoint on the line
e.Graphics.DrawImage(image, 0, 0);

is the method called?
do you have controls on the page?
0
 
ramrocketAuthor Commented:
yes, i stepped into it and the handler is called
0
 
vo1dCommented:
and is your page blanc or did you already put controls on it?
0
 
ramrocketAuthor Commented:
i placed controls on it already
0
 
vo1dCommented:
maybe you cant see the image because controls lie over the painted image?
0
 
vo1dCommented:
try this in your eventhandler and tell me, if you can see a blue rectangle:

e.Graphics.FillRectangle(Brushes.Blue, 0, 0, 50, 10);
0
 
ramrocketAuthor Commented:
Increasing point to 200

I dont see it even if :
e.Graphics.FillRectangle(Brushes.Blue, 0, 0, 1000, 1000);

I step into it but not blue rectangle
0
 
vo1dCommented:
are you looking at the correct tabpage?
i got it working but i used the normal tabpagecontrol.
could you remove all tabpage and left only one without any controls to see, if something is drawn?
0
 
ramrocketAuthor Commented:
vo1d, i moved the event handler to the tabpage and i can see the blue rectangle.

so, I comment out the fillrec instead and call the drawimage on my background image and still cant' get it to paint
0
 
vo1dCommented:
ok, maybe your image is to small.
can you use a bigger one please?
0
 
ramrocketAuthor Commented:
is there something wrong with this???

private Image imgFormBackGround = Image.FromFile("C:\\background.png");
0
 
vo1dCommented:
try this:

Bitmap bmp = new Bitmap("C:\\background.png");
e.Graphics.DrawImageUnscaled(bmp,0,0);
0
 
ramrocketAuthor Commented:
I can see the image at 0,0 but because it 4x4 pix, its hard to see.  

how do i make it fill the entire page background?
0
 
vo1dCommented:
but i just saw, that you dont have to do all the painting by yourself if you are using the normal tabpage.
you have to properties for that:
BackgroundImage and BackgroundImageLayout.
0
 
ramrocketAuthor Commented:
i have BackgroundImage but no BackgroundImageLayout.  is that a runtime property?
0
 
vo1dCommented:
no, its new in framework 2.0. it gives you the possibility to center ,stretch,tile  or zoom an image.
0
 
ramrocketAuthor Commented:
this works, thanks alot for your help
0
 
vo1dCommented:
your welcome ;)
0
All Courses

From novice to tech pro — start learning today.