En iyi yanıtlayıcılar
Nesne seçimi

Soru
-
Yanıtlar
-
İşini görecek bir kontrol yazdım.İncele formunda kullan kafanı kurcalayan bir şey olursa yaz.
public class TextBoxLabel : Control { public TextBoxLabel() { SetBounds(0, 0, 200, 25); Initialize(); } private Label label; private TextBox textbox; private System.Drawing.Font font = null; public void Initialize() { label = new Label(); textbox = new TextBox(); textbox.Size = new System.Drawing.Size(125, 16); label.Size = new System.Drawing.Size(60, 16); textbox.Location = new System.Drawing.Point(5, 2); label.Location = new System.Drawing.Point(132,2); label.Text = "Seçili"; textbox.GotFocus += textbox_GotFocus; textbox.LostFocus += textbox_LostFocus; this.Controls.AddRange(new Control[] { label,textbox }); } void textbox_LostFocus(object sender, EventArgs e) { font = new System.Drawing.Font("Istediğin font ailesi", 20f); label.Font = font; } void textbox_GotFocus(object sender, EventArgs e) { font = new System.Drawing.Font("Istediğin font ailesi", 20f); label.Font = font; } }
sssa
- Yanıt Olarak İşaretleyen csharpp 30 Ekim 2016 Pazar 15:08
-
using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using DevExpress.XtraEditors; using DevExpress.XtraEditors.Drawing; using DevExpress.XtraEditors.Mask; using DevExpress.XtraEditors.Registrator; using DevExpress.XtraEditors.Repository; using DevExpress.XtraEditors.ViewInfo; using DevExpress.XtraLayout; using kgSoft_Pro.Helpers; namespace kgSoft_Pro.WindowsUI.Controllers { [UserRepositoryItem("RegisterkgTextEdit")] public class RepositoryItemkgTextEdit : RepositoryItemTextEdit { static RepositoryItemkgTextEdit() { RegisterkgTextEdit(); } public const string CustomEditName = "kgTextEdit"; public RepositoryItemkgTextEdit() { } public override string EditorTypeName => CustomEditName; public static void RegisterkgTextEdit() { Image img = null; EditorRegistrationInfo.Default.Editors.Add(new EditorClassInfo(CustomEditName, typeof(kgTextEdit), typeof(RepositoryItemkgTextEdit), typeof(kgTextEditViewInfo), new kgTextEditPainter(), true, img)); } public override void Assign(RepositoryItem item) { BeginUpdate(); try { base.Assign(item); RepositoryItemkgTextEdit source = item as RepositoryItemkgTextEdit; if (source == null) return; // } finally { EndUpdate(); } } } [ToolboxItem(true)] public sealed class kgTextEdit : TextEdit { public LabelControl labelControl { get; set; } public SimpleLabelItem styleLabel { get; set; } static kgTextEdit() { RepositoryItemkgTextEdit.RegisterkgTextEdit(); } public kgTextEdit() { EnterMoveNextControl = true; } protected override void OnLostFocus(EventArgs e) { if (labelControl != null) { labelControl.Font = new Font("Tahoma", 8); BackColor = Color.White; ForeColor = Color.Black; } else if (styleLabel != null) { styleLabel.AppearanceItemCaption.Font = new Font("Tahoma", 8); BackColor = Color.White; ForeColor = Color.Black; } base.OnLostFocus(e); } protected override void OnGotFocus(EventArgs e) { if (labelControl != null) { labelControl.Font = new Font("Tahoma", 10, FontStyle.Bold); BackColor = propertySettings.oku.aktifHucreRenk; ForeColor = propertySettings.oku.aktifHucreYaziRenk; } else if (styleLabel != null) { styleLabel.AppearanceItemCaption.Font = new Font("Tahoma", 10, FontStyle.Bold); BackColor = propertySettings.oku.aktifHucreRenk; ForeColor = propertySettings.oku.aktifHucreYaziRenk; } base.OnGotFocus(e); } [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public new RepositoryItemkgTextEdit Properties => base.Properties as RepositoryItemkgTextEdit; public override string EditorTypeName => RepositoryItemkgTextEdit.CustomEditName; } public class kgTextEditViewInfo : TextEditViewInfo { public kgTextEditViewInfo(RepositoryItem item) : base(item) { } } public class kgTextEditPainter : TextEditPainter { public kgTextEditPainter() { } } }
Devexpress textedit için bir örnek
kdrgny@outlook.com
Tüm Yanıtlar
-
İşini görecek bir kontrol yazdım.İncele formunda kullan kafanı kurcalayan bir şey olursa yaz.
public class TextBoxLabel : Control { public TextBoxLabel() { SetBounds(0, 0, 200, 25); Initialize(); } private Label label; private TextBox textbox; private System.Drawing.Font font = null; public void Initialize() { label = new Label(); textbox = new TextBox(); textbox.Size = new System.Drawing.Size(125, 16); label.Size = new System.Drawing.Size(60, 16); textbox.Location = new System.Drawing.Point(5, 2); label.Location = new System.Drawing.Point(132,2); label.Text = "Seçili"; textbox.GotFocus += textbox_GotFocus; textbox.LostFocus += textbox_LostFocus; this.Controls.AddRange(new Control[] { label,textbox }); } void textbox_LostFocus(object sender, EventArgs e) { font = new System.Drawing.Font("Istediğin font ailesi", 20f); label.Font = font; } void textbox_GotFocus(object sender, EventArgs e) { font = new System.Drawing.Font("Istediğin font ailesi", 20f); label.Font = font; } }
sssa
- Yanıt Olarak İşaretleyen csharpp 30 Ekim 2016 Pazar 15:08
-
-
-
using System; using System.ComponentModel; using System.Drawing; using System.Windows.Forms; using DevExpress.XtraEditors; using DevExpress.XtraEditors.Drawing; using DevExpress.XtraEditors.Mask; using DevExpress.XtraEditors.Registrator; using DevExpress.XtraEditors.Repository; using DevExpress.XtraEditors.ViewInfo; using DevExpress.XtraLayout; using kgSoft_Pro.Helpers; namespace kgSoft_Pro.WindowsUI.Controllers { [UserRepositoryItem("RegisterkgTextEdit")] public class RepositoryItemkgTextEdit : RepositoryItemTextEdit { static RepositoryItemkgTextEdit() { RegisterkgTextEdit(); } public const string CustomEditName = "kgTextEdit"; public RepositoryItemkgTextEdit() { } public override string EditorTypeName => CustomEditName; public static void RegisterkgTextEdit() { Image img = null; EditorRegistrationInfo.Default.Editors.Add(new EditorClassInfo(CustomEditName, typeof(kgTextEdit), typeof(RepositoryItemkgTextEdit), typeof(kgTextEditViewInfo), new kgTextEditPainter(), true, img)); } public override void Assign(RepositoryItem item) { BeginUpdate(); try { base.Assign(item); RepositoryItemkgTextEdit source = item as RepositoryItemkgTextEdit; if (source == null) return; // } finally { EndUpdate(); } } } [ToolboxItem(true)] public sealed class kgTextEdit : TextEdit { public LabelControl labelControl { get; set; } public SimpleLabelItem styleLabel { get; set; } static kgTextEdit() { RepositoryItemkgTextEdit.RegisterkgTextEdit(); } public kgTextEdit() { EnterMoveNextControl = true; } protected override void OnLostFocus(EventArgs e) { if (labelControl != null) { labelControl.Font = new Font("Tahoma", 8); BackColor = Color.White; ForeColor = Color.Black; } else if (styleLabel != null) { styleLabel.AppearanceItemCaption.Font = new Font("Tahoma", 8); BackColor = Color.White; ForeColor = Color.Black; } base.OnLostFocus(e); } protected override void OnGotFocus(EventArgs e) { if (labelControl != null) { labelControl.Font = new Font("Tahoma", 10, FontStyle.Bold); BackColor = propertySettings.oku.aktifHucreRenk; ForeColor = propertySettings.oku.aktifHucreYaziRenk; } else if (styleLabel != null) { styleLabel.AppearanceItemCaption.Font = new Font("Tahoma", 10, FontStyle.Bold); BackColor = propertySettings.oku.aktifHucreRenk; ForeColor = propertySettings.oku.aktifHucreYaziRenk; } base.OnGotFocus(e); } [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public new RepositoryItemkgTextEdit Properties => base.Properties as RepositoryItemkgTextEdit; public override string EditorTypeName => RepositoryItemkgTextEdit.CustomEditName; } public class kgTextEditViewInfo : TextEditViewInfo { public kgTextEditViewInfo(RepositoryItem item) : base(item) { } } public class kgTextEditPainter : TextEditPainter { public kgTextEditPainter() { } } }
Devexpress textedit için bir örnek
kdrgny@outlook.com
-