-
Notifications
You must be signed in to change notification settings - Fork 1
/
MyImageSlider.cs
98 lines (81 loc) · 2.73 KB
/
MyImageSlider.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using DevExpress.Utils;
using DevExpress.XtraEditors.Controls;
using DevExpress.XtraEditors.CustomEditor;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
namespace WindowsFormsApplication202 {
class MyImageSlider : ImageSlider, IAnyControlEdit {
public MyImageSlider( ) {
this.Size = new Size(200, 100);
this.LayoutMode = DevExpress.Utils.Drawing.ImageLayoutMode.MiddleCenter;
}
protected override void OnLeave(EventArgs e) {
base.OnLeave(e);
UpdateEditValue();
}
private void UpdateEditValue() {
if (EditValueChanged != null)
EditValueChanged(this, EventArgs.Empty);
}
public bool AllowBitmapCache {
get { return true; }
}
public bool AllowBorder {
get { return false; }
}
public bool AllowClick(System.Drawing.Point point) {
return true;
}
public System.Drawing.Size CalcSize(System.Drawing.Graphics g) {
return this.Size;
}
public void Draw(DevExpress.Utils.Drawing.GraphicsCache cache, AnyControlEditViewInfo viewInfo) {
throw new NotImplementedException();
}
Image fEditValue = null;
public object EditValue {
get {
return fEditValue;
}
set {
Image itemValue = value as Image;
if (itemValue != null) {
fEditValue = itemValue;
this.Images.Clear();
this.Images.Add(fEditValue);
this.CurrentImageIndex = 0;
if (ImageList != null) {
}
}
}
}
public event EventHandler EditValueChanged;
public string GetDisplayText(object EditValue) {
return EditValue == null ? string.Empty : EditValue.ToString();
}
public bool IsNeededKey(System.Windows.Forms.KeyEventArgs e) {
return false;
}
public void SetupAsDrawControl() {
}
public void SetupAsEditControl() {
throw new NotImplementedException();
}
public bool SupportsDraw {
get { return false; }
}
private void InitializeComponent() {
((System.ComponentModel.ISupportInitialize)(this)).BeginInit();
this.SuspendLayout();
//
// MyImageSlider
//
this.CurrentImageIndex = -1;
((System.ComponentModel.ISupportInitialize)(this)).EndInit();
this.ResumeLayout(false);
}
}
}