• DevExpress WinForms中文帮助文档:表单控件


    点击获取DevExpress完整版下载

    DevExpress WinForms拥有180+组件和UI库,能为Windows Forms平台创建具有影响力的业务解决方案。DevExpress WinForms能完美构建流畅、美观且易于使用的应用程序,无论是Office风格的界面,还是分析处理大批量的业务数据,它都能轻松胜任!

    XtraUserControl 类替代标准的System.Windows.Forms.UserControl 组件,它提供了创建包含控件和组件的独立模块的功能,这些模块可以在整个应用程序中重复使用。

    C#

    //Create an XtraUserControl that represents a login form
    public class LoginUserControl : XtraUserControl {
    public LoginUserControl() {
    LayoutControl lc = new LayoutControl();
    lc.Dock = DockStyle.Fill;
    TextEdit teLogin = new TextEdit();
    TextEdit tePassword = new TextEdit();
    CheckEdit ceKeep = new CheckEdit() { Text = "Keep me signed in" };
    lc.AddItem(String.Empty, teLogin).TextVisible = false;
    lc.AddItem(String.Empty, tePassword).TextVisible = false;
    lc.AddItem(String.Empty, ceKeep);
    this.Controls.Add(lc);
    this.Dock = DockStyle.Fill;
    }
    }
    
    //Show an XtraUserControl-based login form inside a dialog
    private void simpleButton1_Click(object sender, EventArgs e) {
    LoginUserControl myControl = new LoginUserControl();
    DevExpress.XtraEditors.XtraDialog.Show(myControl, "Sign in", MessageBoxButtons.OKCancel);
    }
    
    

    VB.NET

    'create an XtraUserControl that represents a login form
    Public Class LoginUserControl
    Inherits XtraUserControl
    
    Public Sub New()
    Dim lc As New LayoutControl()
    lc.Dock = DockStyle.Fill
    Dim teLogin As New TextEdit()
    Dim tePassword As New TextEdit()
    Dim ceKeep As New CheckEdit() With {.Text = "Keep me signed in"}
    lc.AddItem(String.Empty, teLogin).TextVisible = False
    lc.AddItem(String.Empty, tePassword).TextVisible = False
    lc.AddItem(String.Empty, ceKeep)
    Me.Controls.Add(lc)
    Me.Dock = DockStyle.Fill
    End Sub
    End Class
    
    'show an XtraUserControl-based login form inside a dialog
    Private Sub simpleButton1_Click(ByVal sender As Object, ByVal e As EventArgs)
    Dim myControl As New LoginUserControl()
    DevExpress.XtraEditors.XtraDialog.Show(myControl, "Sign in", MessageBoxButtons.OKCancel)
    End Sub
    

    要在设计时添加XtraUserControls,请右键单击您的项目,然后选择 "Add DevExpress Item" 选项,这将调用Template Gallery,该库允许您添加空白XtraUserControls和DevExpress表单以及基于模板的表单。

    与标准WinForms UserControl相比,XtraUserControl具有以下优点:

    • 最终用户可以在悬停时滚动XtraUserControl内容,而无需首先关注它;
    • 与布局和数据布局控件组件通信来传递正确的控件大小;
    • 允许您直接从承载此容器的表单(可视继承)中为XtraUserControl(或其子)内部的控件使用智能标记和Designer对话框;
    • 支持DevExpress皮肤,并确保整个应用程序的外观一致性。

    上DevExpress中文网,获取第一手最新产品资讯!

    DevExpress技术交流群3:700924826      欢迎一起进群讨论

  • 相关阅读:
    vue3.0基本使用
    node 版本升级
    Steam游戏《Northgard(北境之地)》修改器制作
    万能WEB弹出框,js随意适配
    数据湖了解
    操作系统(一)
    无题
    基于林业害虫识别系统的缺陷分析
    美化Android下拉刷新
    软件测试
  • 原文地址:https://www.cnblogs.com/AABBbaby/p/14343360.html
Copyright © 2020-2023  润新知