-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.cs
77 lines (68 loc) · 3.44 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Developer Express Code Central Example:
// How to place controls in a LayoutControl's tabbed group header
//
// By default, it is not possible to place any control within a tabbed group
// header, because the LayoutControl's layout can be widely customized (groups can
// be moved and hidden, their direction can be changed). However, you can emulate
// controls by custom drawing them. This example demonstrates how to draw a
// CheckBox and ProgressBar in headers.
//
// You can find sample updates and versions for different programming languages here:
// http://www.devexpress.com/example=E2811
using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraEditors.Repository;
using System.ComponentModel;
using DevExpress.XtraLayout;
using System.Diagnostics;
namespace WindowsApplication1 {
public partial class Form1 : Form {
public Form1()
{
InitializeComponent();
InplaceEditorInfo checkInfo = new InplaceEditorInfo(new RepositoryItemCheckEdit(), new Size(20, 20), true);
checkInfo.MouseDown += checkInfo_MouseDown;
RepositoryItemButtonEdit riBE = new RepositoryItemButtonEdit();
InplaceEditorInfo buttonInfo = new InplaceEditorInfo(riBE, new Size(30, 20), null);
riBE.TextEditStyle = DevExpress.XtraEditors.Controls.TextEditStyles.HideTextEditor;
riBE.Buttons[0].Kind = DevExpress.XtraEditors.Controls.ButtonPredefines.Glyph;
riBE.Buttons[0].Caption = "Test";
riBE.AutoHeight = false;
buttonInfo.MouseDown += buttonInfo_MouseDown;
buttonInfo.RightIndent = 25;
RepositoryItemHyperLinkEdit riHE = new RepositoryItemHyperLinkEdit();
InplaceEditorInfo hyperLinkInfo = new InplaceEditorInfo(riHE, new Size(120, 20), "http://devexpress.com/");
hyperLinkInfo.RightIndent = 60;
riHE.BorderStyle = DevExpress.XtraEditors.Controls.BorderStyles.NoBorder;
hyperLinkInfo.MouseDown += new EventHandler(hyperLinkInfo_MouseDown);
myLayoutControl1.TabGroupItems.Add(tabbedControlGroup1, new InplaceEditorInfo[] { checkInfo, buttonInfo, hyperLinkInfo });
InplaceEditorInfo progressBarInfo = new InplaceEditorInfo(new RepositoryItemProgressBar(), new Size(40, 20), 10);
progressBarInfo.MouseDown += progressBarInfo_MouseDown;
checkInfo = new InplaceEditorInfo(new RepositoryItemCheckEdit(), new Size(20, 20), true);
checkInfo.MouseDown += checkInfo_MouseDown;
checkInfo.RightIndent = 40;
myLayoutControl1.TabGroupItems.Add(tabbedControlGroup2, new InplaceEditorInfo[] { progressBarInfo, checkInfo });
}
void hyperLinkInfo_MouseDown(object sender, EventArgs e)
{
InplaceEditorInfo info = sender as InplaceEditorInfo;
Process.Start(info.EditValue.ToString());
}
void buttonInfo_MouseDown(object sender, EventArgs e)
{
MessageBox.Show("Test");
}
Random r = new Random();
void progressBarInfo_MouseDown(object sender, EventArgs e)
{
InplaceEditorInfo info = sender as InplaceEditorInfo;
info.EditValue = 10 + r.Next(80);
}
void checkInfo_MouseDown(object sender, EventArgs e)
{
InplaceEditorInfo info = sender as InplaceEditorInfo;
info.EditValue = true.Equals(info.EditValue) ? false : true;
}
}
}