How to use DotNetBar

Source: Internet
Author: User

How to use DotNetBar

2012-03-22 00:03:22  | Category: various controls | report | Font Size Subscribe

Here's what I've been doing since last year with DotNetBar this vs on the beautify control after some of the use of experience and use of skills, I now almost every time the use of this control, will follow the following techniques to arrange my arrangement of these controls, ah, style, etc. Hope to give you some of the role, but also welcome to write their own tips, so that our WinForm program more beautiful ~ ~

Several modifications to the place
1, Ribbontitle, start to leave empty, and later with code modification
2, the upper left corner of the dot function removed
3, the upper left corner to write: System Status: China Unicom
4.
Down to solve a problem, is about the DataGrid, the title, all the names are to be discharged, do not change line

Several issues to be aware of when using Ribboncontrol:
1, first set the text of the form to null
2. Then set the ControlBox of the form to false
3. Then set the FormBorderStyle of the form to sizable
4, the last step, in the Ribboncontrol title bar to write the window title, note is not the text but Ribboncontrol1.titletext = "Non-coal Mine Emergency Rescue Command system – Basic database"
5, if you like, I am accustomed to the form of startposition set to Centerscreen

Several tips for using bar as a Statesbar
1, this bar is the bar in the DotNetBar series, not the other: "
2. To set the style to OFFICE2007
3, set the Roundcorders to False will look good, I tried, the round angle is not comfortable
4. Set Bartype to StatusBar

Tips for using Grouppanel:
1. Set the BackColor to Transparent
2. Set the textlinealignment in style to center (PS: It's a bit ugly before it's too close to the top)
3, the internal label is generally used vs comes with the standard label can, do not need to use the Ribbon LabelX, I think it will certainly involve painting problems lead to performance degradation, and I think

Using Panelex
1, general to set padding for 1,1,1,1 otherwise, when the interior space dimension Dock Fill, will be the panel of the Border block, the effect is not good to see
2, if Panelex on the inside of Ribboncontrol, generally set location for 3, 0, while in the right side of the drag, drag to an exact position, then the size of the width plus 4, so the effect is very good

Modifications to the Table class window
1. Remove the menu under the origin
2, remove the system: Unicom, the right side of the Quickitem
3. Adjust the location of Datagridviewx to 3, 3, and increase the width to the right by 2
4. Leave each Panelx text blank

Several points of beautifying datagridviewx
1, modify the Alternatingrowsdefaultcellstyle BackColor
2, modify the Columnheadersheight

Several small details of establishing Ribboncontrol
1, establish a form, the text of the form is set to NULL, set the ControlBox to False, the startposition is set to Centerscreen;
2, drag over a ribboncontrol, processing a ribooncotrol, such as to remove the original point under the option, remove Quickitem and so on, and then drag and drop position, this time I generally have two ways to deal with Ribboncontrol, One is to use Ribboncontrol as the entire form, then the anchor is set to the up and left right four sides, the other is the use of Ribboncontrol around a top navigation bar, so that you do not need to set up anchor, Remove unnecessary ribbontabitem2 and ribbontamitem1 on the redundant ribbonbar1,ribbontabitem1 words do not have to be removed, you can set it in the program and TitleText content
3, a bar come over, a few settings, the dock for Bottom,roundcorner for False,bartype for StatusBar, and then drag the lower edge of the Ribboncontrol down, placed next to Ribbonbar
4, if you put a panelx here, there are two situations

1) Only one panelx, the situation is simple, the Direct dock for fill is good (found that this does not work, the panel will not become larger as the Ribbonpanel, so this method over)
Workaround: If so, now find a way to put Panelx in location=3,0, and then in Ribboncontrol's SizeChanged method
Use these two sentences to change:
Me.PanelEx1.Height = me.ribboncontrol1.height–60
Me.PanelEx1.Width = me.ribboncontrol1.width–6
The effect is perfect.

2) If it is about two panelx, the situation is a little more complicated, but also pay attention to adjust anchor can
Note: Here is a problem, that is, if the Ribboncontrol is to use anchor to align the lower side of the position, then you can not come up to maximize the form, then, anchor for the bottom, the lower side can not be aligned
July 6, 2009
1.ANCHOR is not reliable, so after the form sizechanged, to use width and height to limit the width and height of the control, to achieve beautiful unity!
The 2.RIBBONCONTROL dock is set to none, then the anchor is set to up or down (or the dock is set to top, set the anchor bottom, but it turns out that this method is not possible)
3. Tips, on any one of the controls, right-click, you can quickly select the top-level control containing itself

PS: Here, by the way, write about C1chart's tips for using
1, BackColor set to Transparent
2, the general will put this in a panel, the dock is fill, and the Panel's dock is fill, this is a bit around, but in order to beautiful

////

The version I'm discussing here is the cracked version of DotNetBar 6.7.0.1 for VS2005, other versions I don't have time to find it, and it's also because it's very similar.

, see here, if there are any friends can not download, add me QQ bar, if you can provide a group, I will write here, and then use the group space to organize the control, convenient for you I

It's www.vscodes.com/soft/show.asp?id=2879&showasp=1&details.html.

The method of adding in VS2005 is similar to IRISSKIN2, but I repeat here:

First copy the control to your program Bin/debug, then to the program, the first reference, and then the toolbar a new option, and then right-click on the "Select" menu, click on the dialog box, the DLL added in, so that you can add the control to the first box, The next step is to drag the control to the interface, in the code with the above description of the code, you can use it. With dozens of spaces, you can dress up your program as a office2007. Very cool!

Here are a few of the logs used:

1 ————————————————— –

DotNetBar Supertooltip controls tips for using

DotNetBar is a top-notch. NET third-party presentation tier space. Made to the window can be said to be very very very very cool! The Supertooltip control can be used primarily to implement a prompt box. In the sample it provides, the prompt box that is displayed when the mouse is moved to the tree node is implemented in the tree view.

A tree view was used in one of my projects, and I decided to beautify it with DotNetBar after the project was completed. In the process of modifying and debugging My Code with reference to the Code of sample, I found that the code for sample was not just for use, but to be modified later.

According to the Code of sample, assuming that our form Form1 has a control TreeView TreeView1, then the way to implement the prompt for TreeView1 is as follows: (I don't use the window editor, just change the code again)

1 Add Devcomponents.dotnetbar to the project's reference. Create a new class Nodesupertooltipprovider and copy the code for this class in sample. Note that if the tree node in your program is not using the. NET self-contained component TreeNode, but rather a custom type inherited from TreeNode, the TreeNode in all of the following code is changed to your custom type, and many places have to join the coercion type conversion.

Using System;
Using System.ComponentModel;
Using System.Drawing;
Using System.Windows.Forms;

Namespace Supertooltip
{
<summary>
Wrapper so supertooltips can is displayed for node objects.
</summary>
public class Nodesupertooltipprovider:component, DevComponents.DotNetBar.ISuperTooltipInfoProvider
{
Private TreeNode M_node=null;

<summary>
Creates new instance of the object.
</summary>
<param name= "Node" >node to provide tooltip information for</param>
Public Nodesupertooltipprovider (TreeNode node)
{
M_node=node;
}

<summary>
Call the This method to show the ToolTip for given node.
</summary>
public void Show ()
{
if (this. Displaytooltip!=null)
Displaytooltip (This,new EventArgs ());
}

<summary>
Call the This method to hide the ToolTip for given node.
</summary>
public void Hide ()
{
if (this. Hidetooltip!=null)
This. Hidetooltip (This,new EventArgs ());
}

#region Isupertooltipinfoprovider Members

<summary>
Returns screen coordinates of object.
</summary>
Public System.Drawing.Rectangle Componentrectangle
{
Get
{
Rectangle R=m_node.bounds;
R.location=m_node.treeview.pointtoscreen (r.location);
return R;
}
}

public event EventHandler Displaytooltip;
public event EventHandler Hidetooltip;

#endregion
}
}

2 Adding controls in Form1:

Private DevComponents.DotNetBar.SuperTooltip superTooltip1;
Private System.Windows.Forms.Timer Tooltipdisplaydelay;

One is Supertooltip and the other is the. NET itself with a timer that controls when the cue box is displayed.

3 Form1 in the InitializeComponent () function, add:

this.components = new System.ComponentModel.Container ();
THIS.SUPERTOOLTIP1 = new DevComponents.DotNetBar.SuperTooltip ();
This.tooltipdisplaydelay = new System.Windows.Forms.Timer (this.components);

The components need to be initialized because the timer is initialized. But I'm not allowed to get rid of it.

//
SuperTooltip1
//
This.superTooltip1.DefaultFont = new System.Drawing.Font ("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte) (0));
//
Tooltipdisplaydelay
//
This.tooltipDisplayDelay.Interval = 1000;

4 Write a function that generates a cue box for all nodes:

Private Supertooltip_refresh ()
{
//Load supertooltip information for each node ...
TreeNode Node=treeview1.nodes[0];
while (node!=null)
{
  //creates wrapper-provide Supertooltip control access to the node OBJECT
   nodesupertooltipprovider sp=new Nodesupertooltipprovider (node);
   node. TAG=SP;
  //Assign the wrapper to Supertooltip control together with information
  //About Display on the Super Tooltip for this node.
   Supertooltip1.setsupertooltip (sp,new DevComponents.DotNetBar.SuperTooltipInfo ([Header_text], "", [Additional_text],null,null,devcomponents.dotnetbar.etooltipcolor.lemon)];
  //must expand node to get to the nodes via Nextvisiblenode
   node. Expand ();
   Node=node. Nextvisiblenode;
}
}

where [Header_text] and [Additional_text] Add the string that you want to appear in the Prompt box. [Header_text] will be bold. In addition, the last parameter of the supertooltipinfo is used to change the color.

Originally the code in the sample is written in the Form1 Load event function inside, but generally used in the tree view of the program will do various operations on the node, such as add, delete, modify and so on. The Hint box I designed shows the text of the node, the text of its child nodes, and the text of its parent node. At first I wrote the code in FORM1 's Load event function according to sample code, and the contents of its parent's ToolTip did not change when I deleted a node. The reason for this is that the code that generates each node's cue box calls the Load event function only when the FORM1 is generated, and does not regenerate when the tree view is changed. So, I write this code separately in a function,
It is called in the Load event function of Form1, and it is also called after I have manipulated the tree and node to refresh all of the prompt boxes.

5 Form1 Load event function, each add, modify, delete Node button, MenuItem and other objects of the Click event function of the last add code:

This.supertooltip_refresh ();

6 Define a TreeNode private property:

Private TreeNode m_lastmouseovernode = null;

7 TreeView1 of the MouseMove event function:

TreeNode nodeat=treeview1.getnodeat (E.X,E.Y);
if (Nodeat!=m_lastmouseovernode)
{
Hidenodetooltip ();
if (nodeat!=null)
{
M_lastmouseovernode=nodeat;
Delayed Display
Tooltipdisplaydelay.start ();
}
}

8 TreeView1 of the MouseDown event function:

Hide tooltip If any are visible ...
Hidenodetooltip ();

9 TreeView1 of the MouseLeave event function:

Hide tooltip when mouse leaves tree control
Hidenodetooltip ();
Tooltipdisplaydelay.stop ();

The Tick event function of Tooltipdisplaydelay:

Tooltipdisplaydelay.stop ();
if (m_lastmouseovernode!=null)
Shownodetooltip (M_lastmouseovernode);

Shownodetooltip and Hidenodetooltip functions:

private void Shownodetooltip (TreeNode node)
{
if (node==null)
Return
Nodesupertooltipprovider Sp=node. Tag as Nodesupertooltipprovider;
Sp. Show ();
M_lastmouseovernode=node;
}

private void Hidenodetooltip ()
{
if (m_lastmouseovernode!=null)
{
Nodesupertooltipprovider Sp=m_lastmouseovernode.tag as Nodesupertooltipprovider;
Sp. Hide ();
M_lastmouseovernode=null;
}
}

More than 6-11 steps, is the sample code in the unchanged move, but there is a major problem when running, that is, when I add a node, when my mouse moved to the new node, there will be a null exception. After debugging, I found that the exception occurred on the local variable SP in the Shownodetooltip and Hidenodetooltip functions. The code for initializing the SP is as follows:

Shownodetooltip ()
Nodesupertooltipprovider Sp=node. Tag as Nodesupertooltipprovider;

Hidenodetooltip ()
Nodesupertooltipprovider Sp=m_lastmouseovernode.tag as Nodesupertooltipprovider;

And there's this code snippet in front:
Creates wrapper to provide Supertooltip control access to the Node object
Nodesupertooltipprovider sp=new Nodesupertooltipprovider (node);
Node. TAG=SP;

As you can see, the Supertooltip control is the ability to assign a Nodesupertooltipprovider instance to a node's tag to implement the Cue box. Therefore, if we do not assign a value to the tag of the new node, a null exception will occur.

In fact, there is no such exception if the previous Supertooltip_refresh () is called whenever a node is added. However, not every program needs to have such a function to refresh the prompt box, perhaps some of the contents of the Program prompt box is fixed.

There are two ways to fix this bug in this program:

The first is that if your node is a custom class that inherits from TreeNode, the following procedure is added to all constructors of the class:

This. Tag = new Nodesupertooltipprovider (this);

The second is that if your node is using the TreeNode component, you should add the click event at the end of all the button and MenuItem objects that are adding nodes:

[Node_name]. Tag = new Nodesupertooltipprovider ([Node_name]); [Node_name] is the identifier of the new node in the function.

At this point, the function of the cue box in our tree view is implemented.

2 、——————————————————————

DotNetBar Introduction

has recently used DotNetBar to write a simple way to use it, and the specifics need to be studied. I hope it will be useful to those who use it first.
1, Bar is a menu bar, you can right-click Add button and ComboBox and so many, we can try each one.
2, bubblebar is a toolbar, right-click on the button (you can add or subtract tab but not see what effect), Then we can realize the wave selection effect of the apple system.
3, balloontip , balloon. Drag him onto any of the controls, and the balloon appears when the mouse hovers over it.
4, Contextmenubar, which is the menu that comes out when the mouse is right-clicked. The
5, Colorpickerbutton control, is used to make color choices.
6, ComboBoxEx, see the name will know
7, Listviewex and Grouppanel, look at the name will know what is. Good looking a lot of
8, Ribbonbar, or button,office2007 style, you can right-click Add.
9, ExplorerBar, similar to WinXP to the left of the navigation menu, in Vista Big line of the today, feel not very beautiful
10, Itempanel, and expandablesplitter combine to do navigation bar, set Expandedcontrol properties, mouse over effect
11, Expandablepanel, drop-down controls, click Back to Indent
12, maskedtextboxadv , TextBox, Add a button to clear the
13, TabControl, this is a bit more useful.
Write this point first, there is no specific application, I hope that the first use of people do not know what is to check.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.