您当前的位置: 首页 >  c#

寒冰屋

暂无认证

  • 8浏览

    0关注

    2286博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

C# WPF开源控件库HandyControl用法举例

寒冰屋 发布时间:2022-09-30 19:15:00 ,浏览量:8

目录

概述

MessageBox用法举例

Button用法举例

Lable用法举例

Slider用法举例

TextBox用法举例

组合框ComboBox用法举例

源码下载

 

概述

HandyControl是一款免费开源的WPF控件库,Github可以获取到源代码,相关的示例代码也在github上能获取到,但是没有详细的中文说明文档,对于新手而言使用起来还是会有一些困扰,网上也很难搜到相关的用法示例,所以本节就对它常用的一些控件举例说明下。

首先还是先在nuget上引用HC的库:

然后在前台XAML引用:

 xmlns:hc="https://handyorg.github.io/handycontrol"

在App.xaml中引用HC的皮肤和主题:


        
            
                
                
            
        
    
MessageBox用法举例

①对话框

MessageBox.Show("检测到有版本更新,是否更新?", "标题", MessageBoxButton.YesNo, MessageBoxImage.Question);

②提示框:

MessageBox.Show("当前选中了:" + listbox.SelectedItem, "标题", MessageBoxButton.OK, MessageBoxImage.Information);

③错误框:

MessageBox.Show("当前选中了:" + listbox.SelectedItem, "标题", MessageBoxButton.OK, MessageBoxImage.Error);

总共有9个枚举量可供选择,分别如下:​​​​​​​

//
    // 摘要:
    //     Specifies the icon that is displayed by a message box.
    public enum MessageBoxImage
    {
        //
        // 摘要:
        //     The message box contains no symbols.
        None = 0,
        //
        // 摘要:
        //     The message box contains a symbol consisting of white X in a circle with a red
        //     background.
        Error = 16,
        //
        // 摘要:
        //     The message box contains a symbol consisting of a white X in a circle with a
        //     red background.
        Hand = 16,
        //
        // 摘要:
        //     The message box contains a symbol consisting of white X in a circle with a red
        //     background.
        Stop = 16,
        //
        // 摘要:
        //     The message box contains a symbol consisting of a question mark in a circle.
        //     The question mark message icon is no longer recommended because it does not clearly
        //     represent a specific type of message and because the phrasing of a message as
        //     a question could apply to any message type. In addition, users can confuse the
        //     question mark symbol with a help information symbol. Therefore, do not use this
        //     question mark symbol in your message boxes. The system continues to support its
        //     inclusion only for backward compatibility.
        Question = 32,
        //
        // 摘要:
        //     The message box contains a symbol consisting of an exclamation point in a triangle
        //     with a yellow background.
        Exclamation = 48,
        //
        // 摘要:
        //     The message box contains a symbol consisting of an exclamation point in a triangle
        //     with a yellow background.
        Warning = 48,
        //
        // 摘要:
        //     The message box contains a symbol consisting of a lowercase letter i in a circle.
        Asterisk = 64,
        //
        // 摘要:
        //     The message box contains a symbol consisting of a lowercase letter i in a circle.
        Information = 64
    }
Button用法举例

①带图标的button:​​​​​​​


                        
                            
                                
                                    
                                    
                                
                                
                                
                            
                        
                    

②RepeatButton用法:​​​​​​​

③带有日历图表的button:​​​​​​​

 
 

④左旋转又旋转图表button:​​​​​​​


⑤带左右箭头图标的button:​​​​​​​


⑥ToggleButton  按钮​​​​​​​


Lable用法举例

Slider用法举例



TextBox用法举例

组合框ComboBox用法举例​​​​​​​

                    张三
                    李四
                    王五
                

还有很多基本控件,限于篇幅本节就讲到这里,要想深入学习了解还是得下载源代码去探索调试.

源码下载

链接:https://pan.baidu.com/s/1Rdx43-8Aa21gl_YPsh6ncg 

提取码:6666

本文参考链接:https://github.com/HandyOrg/HandyControl 

关注
打赏
1665926880
查看更多评论
立即登录/注册

微信扫码登录

0.3999s