thanks @Fenrir() that linked helped a lot and it was solved without knowing any wpf :)

these objects are found in database and they are dynamic so each time data will be fetched from database according to user input and create a graph datastructure (vertices and edges) and then draw this graph.

Hello

I was asked to show relations between data in a graph.
For example
object0 is related to object1 and object2
object1 is related to object 2
object2 is related to object0 and object1
object3 is related to object 1

then the graph will be as shown here Click Here

I searched for that and found this link which is the one I need but it is in 'WPF' or silverlight maybe which I don't know anything about it. I searched for a way to run the 'wpf' from the windows form project that I have but no good results.

I can use the 2 classes of the quickgraph demo (PocEdge.cs,PocVertex.cs) which I think that represents a graph datastructure and I can use a query to find objects related to each of the above objects and use the AddNewGraphEdge() to relate other objects to vertex.
but the problem is how can I draw the graph in the windows form project that I have.

If I am using the wrong way please correct it to me.
Thanks

I am using the google search engine.

I can add autocomplete terms and upload an xml file with the autocompletetion terms within the site itself.

I am trying to auto upload this xml file by a console application or a php file.Is there a way that I can auto-upload this xml file(or even the term by term) using c# or php or any language?

this is an image for clarification

http://postimage.org/image/6kldz1vnb/

I used to ask the question here and tagged also c# in order not to be reapeated. Is what I did correct or should I ask in the software development also?

perfect!!
I added a click event handler on the label2 also to be toggle the check when you press on the text also so it will act as the default checkbox does
Thanks a lot my friends for your help.

I like this site more than other websites that prevent you from asking after some easy questions :@

How can I be an effective user in this site?

nice job my friend there is still a small bug and it will be a very usefull class that can be used instead of hiding the default check box that microsoft should review.

The bug is that when I click on the checkbox its position will change upward by 2 pixels approximately instead of staying at the same position. I tried to solve it by myself but I failed.

I changed the this.label1.BackColor = System.Drawing.SystemColors.ControlText; to this.label1.BackColor = System.Drawing.Color.Transparent; and it worked fine but I am not seeing the Text property in the properties of the usercontrol below the solution explorer. and it should contain modifications for the size; i am trying to change the size to became the best.

Does because the user control doesn't have such a property so it won't appear in the properties since the events differ from that of a normal checkbox. Is there a way to add it there so I can change the text of this control directly?

I know and did it. It is changing in state from checked to unchecked, but the image is not showing well; it contains white colors and don't know why.

I used to override the the OnMouseDown also to prevent showing it as a button but the picture didn't appeared well(Image). I think I should stop using a transparent image and use a normal one.

Thanks very much for you guys.

@tinstaafl: it re-give the same default checkbox in the first link posted. There must be a way to access the default image with the check box and replace or hide it.

@TnTinMN: after working on your code to make it work another problem is noticed. you can't make a transparent button on the MouseEnter event :( :S.
so it will be noticed as a button and not as a checkbox
I can provide you with pictures it you want

this code gave this result

http://postimage.org/image/93aptbntr/

I want to hide any checkbox in the background(the yellow one and the default one shown in the 1st image link) and show only the image of mine because it is transperant layer.

I found somthing that can help if I accessed the default check box that is shown.

Brush brush = new SolidBrush(Color.FromArgb(alpha, red, green, blue))

where alpha is the opcacity of the colors bounded. it can be from 0 to 255.

Thanks a lot!!

thanks now it worked but I want to change the checkbox pic which is a png picture that is transperant.
there is a small checkbox that is the default is shown in the background because the new checkbox pic contain transperant layers?
I used this code on the onPaint()

protected override void OnPaint(PaintEventArgs pevent)
        {
            base.OnPaint(pevent); //needed
            Graphics G = pevent.Graphics;
            if (this.Checked)
                G.DrawImageUnscaled(Properties.Resources.CheckedBox, 0, 4);
            else
                G.DrawImageUnscaled(Properties.Resources.UnCheckedBox, 0, 4);
        }

how can I hide the default checkbox pic? I used the big size of the new checkbox to show how it is being seen.

this is how it appears:
http://postimage.org/image/4kb2cveed/

The main point is that I want to make a custom checkbox of my design.
I tried to make a new project and new class called CustomCheckBox which inherit from the default checkbox. It will add the CustomCheckBox and pointer in the toolbox under the solution name tab components.
I overrided the OnPaint() with this code:

class CustomCheckBox : CheckBox
    //class derived from the CheckBox class
    {
        public CustomCheckBox() { }

        protected override void OnPaint(PaintEventArgs pevent)
        {
            base.OnPaint(pevent);   //needed
            base.FlatStyle = FlatStyle.Flat; //needed
            if (this.Checked)
                G.DrawImageUnscaled(Properties.Resources.Checked,0,0);
            else
                G.DrawImageUnscaled(Properties.Resources.Unchecked, 0, 0);
        }
    }

I even tried to add a new user control which inherit from checkbox also. The 2 ways whic I tried will work normally if I add the checkbox on the runtime:

private void button1_Click(object sender, EventArgs e)
        {
            CustomCheckBox cb = new CustomCheckBox();
            cb.Text = "Check";
            cb.Size = new Size(100,20);
            cb.Location=new System.Drawing.Point(5,5);
            //panel1.Controls.Add(cb);
            this.Controls.Add(cb);
        }

If use the event Paint in the Default checkbox with this code it will work normally but I should edit each paint event of the checkboxes in the form:

public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void checkBox1_Paint(object sender, PaintEventArgs e)
        {
            if (checkBox1.Checked)
                e.Graphics.DrawImageUnscaled(Properties.Resources.CheckedBox, 0, 1);
            else
                e.Graphics.DrawImageUnscaled(Properties.Resources.UnCheckedBox, 0, 1);
        }
    }

My main goal is to add the CustomCheckBox from the tool box and be able to build and run the project normally.
I think this will clarify all points in the problem.
Thanks for your help @tinstaafl

I was trying this sample found in the website: Custom Checkbox
when I add the CustomCheckbox from the toolbox to the form directly and build the project it take lot of time to be build and cause the visual studio to not respond.

Do anybody have an idea about the causes??
thanks

it is causing visual studio to be not responding if you add the checkbox from the toolbox to the form and not from the command this.Controls.Add(checkbox)
do you have anyidea about it?