Draw a horizantal line after each item in listbox in WPF

If you want to create a ListBox with its items separated by horizontal line so i am describing here how can you do it?. In the following example code i am using Line Shape as a separator in the Listbox. Continue reading “Draw a horizantal line after each item in listbox in WPF”

How to add misc propety in Button custom control in vb.net

you can use custom control to add additional property in the button through making custom control.
in this article i will add some misc properties in the button custom control and also will show how to use this control in your project.   Continue reading “How to add misc propety in Button custom control in vb.net”

Drag and drop a tree node from one node another node in c#

This article demonstrate how we can add drag and drop functionality in one Treeview or between two or more Treeview controls. The following example shows how we can how we can drag and drop one treenode to other node of the treeview control.

below example contains two treeview named treeView1 and treeView2. you need to set the AllowDrop property of both TreeView1 and TreeView2 to True in the Properties window. In this example we are using common drag and drop events.

  public Form1()

            TreeNode ParentNode1;
            TreeNode ParentNode2;

            TreeNode ParentNode3;

            ParentNode1 = treeView1.Nodes.Add("Fruits");

            ParentNode3 = treeView1.Nodes.Add("Colors");

            ParentNode2 = treeView2.Nodes.Add("Store");

            this.treeView1.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeView_ItemDrag);
           this.treeView2.ItemDrag += new System.Windows.Forms.ItemDragEventHandler(this.treeView_ItemDrag);
            this.treeView1.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView_DragEnter);
            this.treeView2.DragEnter += new System.Windows.Forms.DragEventHandler(this.treeView_DragEnter);
            this.treeView1.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop);
            this.treeView2.DragDrop += new System.Windows.Forms.DragEventHandler(this.treeView_DragDrop);

        private void treeView_ItemDrag(object sender, System.Windows.Forms.ItemDragEventArgs e)
            DoDragDrop(e.Item, DragDropEffects.Move);
        private void treeView_DragEnter(object sender, System.Windows.Forms.DragEventArgs e)
            e.Effect = DragDropEffects.Move;

        private void treeView_DragDrop(object sender, System.Windows.Forms.DragEventArgs e)
            TreeNode NewNode;

            if (e.Data.GetDataPresent("System.Windows.Forms.TreeNode", false))
                Point pt = ((TreeView)sender).PointToClient(new Point(e.X, e.Y));
                TreeNode DestinationNode = ((TreeView)sender).GetNodeAt(pt);
                NewNode = (TreeNode)e.Data.GetData("System.Windows.Forms.TreeNode");
                //if (DestinationNode.TreeView != NewNode.TreeView)
                    //Remove Original Node
               // }

Write text inside shapes using Border control in wpf

We know that WPF Shapes (such as ellipse,rectangle etc) are not container control, so we can put some text directly inside them or we will have to work extra for doing that but we can do this with the help of Border control very easily. Continue reading “Write text inside shapes using Border control in wpf”

How to fill a shape with an image in WPF

If you want to fill a shape with an image, suppose you have an ellipse on your form and you want to fill this ellipse with an image then you can use ImageBrush class that enable us to paint an area with an image. An ImageBrush paints an area with an ImageSource property. Continue reading “How to fill a shape with an image in WPF”

How to create Splash screen in your windows application in .net

A splash screen is an image or screen that appears while your application or program is loading. It may also be used to describe an short introduction page of application that can contains version number, application title etc. Continue reading “How to create Splash screen in your windows application in .net”