<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
        當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

        WPF圖片按鈕的實(shí)現(xiàn)方法

        來(lái)源:懂視網(wǎng) 責(zé)編:小OO 時(shí)間:2020-11-27 22:35:19
        文檔

        WPF圖片按鈕的實(shí)現(xiàn)方法

        本文實(shí)例為大家分享了WPF圖片按鈕的實(shí)現(xiàn)代碼,供大家參考,具體內(nèi)容如下:直接代碼。public class ImageButton : System.Windows.Controls.Button { /// <;summary>;/// 圖片 /// <;/summary>;public static readonly DependencyProperty ImageProperty = DependencyProperty.Register("Image".typeof(ImageSource).typeof(ImageButton).new PropertyMetadata(null));/// <;summary>;/summary>。樣式代碼;
        推薦度:
        導(dǎo)讀本文實(shí)例為大家分享了WPF圖片按鈕的實(shí)現(xiàn)代碼,供大家參考,具體內(nèi)容如下:直接代碼。public class ImageButton : System.Windows.Controls.Button { /// <;summary>;/// 圖片 /// <;/summary>;public static readonly DependencyProperty ImageProperty = DependencyProperty.Register("Image".typeof(ImageSource).typeof(ImageButton).new PropertyMetadata(null));/// <;summary>;/summary>。樣式代碼;

        本文實(shí)例為大家分享了WPF圖片按鈕的實(shí)現(xiàn)代碼,供大家參考,具體內(nèi)容如下

        直接代碼

        public class ImageButton : System.Windows.Controls.Button
         {
        
         /// <summary>
         /// 圖片
         /// </summary>
         public static readonly DependencyProperty ImageProperty = DependencyProperty.Register("Image", typeof(ImageSource), typeof(ImageButton),
         new PropertyMetadata(null));
        
         /// <summary>
         /// 圖片的寬度
         /// </summary>
         public static readonly DependencyProperty ImageWidthProperty = DependencyProperty.Register("ImageWidth", typeof(double), typeof(ImageButton),
         new PropertyMetadata(double.NaN));
        
         /// <summary>
         /// 圖片的高度
         /// </summary>
         public static readonly DependencyProperty ImageHeightProperty = DependencyProperty.Register("ImageHeight", typeof(double), typeof(ImageButton),
         new PropertyMetadata(double.NaN));
        
         /// <summary>
         /// 構(gòu)造函數(shù)
         /// </summary>
         static ImageButton()
         {
         DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageButton), 
         new System.Windows.FrameworkPropertyMetadata(typeof(ImageButton)));
         }
        
         /// <summary>
         /// 設(shè)置圖片
         /// </summary>
         public ImageSource Image
         {
         get
         {
         return GetValue(ImageProperty) as ImageSource;
         }
         set
         {
         SetValue(ImageProperty, value);
         }
         }
        
         /// <summary>
         /// 圖片寬度(屬性)
         /// </summary>
         public double ImageWidth
         {
         get
         {
         return (double)GetValue(ImageWidthProperty);
         }
         set
         {
         SetValue(ImageWidthProperty, value);
         }
         }
        
         /// <summary>
         /// 圖片高度(屬性)
         /// </summary>
         public double ImageHeight
         {
         get
         {
         return (double)GetValue(ImageHeightProperty);
         }
         set
         {
         SetValue(ImageHeightProperty, value);
         }
         }
        
         }
        
        

        樣式代碼

        <Style TargetType="{x:Type xi:ImageButton}">
         <Setter Property="Template">
         <Setter.Value>
         <ControlTemplate TargetType="{x:Type xi:ImageButton}">
         <Grid>
         <Grid.RowDefinitions>
         <RowDefinition Height="*"/>
         <RowDefinition Height="Auto"/>
         </Grid.RowDefinitions>
         <Border x:Name="border" Grid.RowSpan="2" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="{TemplateBinding Background}" 
         SnapsToDevicePixels="true" CornerRadius="3,3,3,3"/>
         <Image Grid.Row="0" Source="{TemplateBinding Image}"
         Width="{TemplateBinding ImageWidth}"
         Height="{TemplateBinding ImageHeight}"
         VerticalAlignment="{TemplateBinding VerticalAlignment}"/>
         <ContentPresenter Grid.Row="1" HorizontalAlignment="Center" Margin="{TemplateBinding Padding}" 
         VerticalAlignment="Center" RecognizesAccessKey="True" />
         </Grid>
         <ControlTemplate.Triggers>
         <Trigger Property="IsPressed" Value="True">
         <Setter Property="Foreground" Value="#999999"/>
         </Trigger>
         </ControlTemplate.Triggers>
        
         </ControlTemplate>
         </Setter.Value>
         </Setter>
         </Style>
        

        調(diào)用實(shí)例

        代碼如下: <xi:ImageButton Image="../Image/設(shè)置.png" Content="新增會(huì)員" ImageHeight="52" ImageWidth="52" Width="72" Height="72" Margin="30,10,10,10"/>

        效果展示

        聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        WPF圖片按鈕的實(shí)現(xiàn)方法

        本文實(shí)例為大家分享了WPF圖片按鈕的實(shí)現(xiàn)代碼,供大家參考,具體內(nèi)容如下:直接代碼。public class ImageButton : System.Windows.Controls.Button { /// <;summary>;/// 圖片 /// <;/summary>;public static readonly DependencyProperty ImageProperty = DependencyProperty.Register("Image".typeof(ImageSource).typeof(ImageButton).new PropertyMetadata(null));/// <;summary>;/summary>。樣式代碼;
        推薦度:
        標(biāo)簽: 圖片 的方法 按鈕
        • 熱門焦點(diǎn)

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 亚洲成a人片毛片在线| 亚洲欧洲一区二区| 亚洲国产成人精品无码区二本 | GOGOGO免费观看国语| 亚洲精品综合久久| 久久久久久久久久免免费精品 | 永久久久免费浮力影院| 亚洲中文字幕久久精品无码VA | 亚洲国产成人久久笫一页| 四虎成人精品国产永久免费无码| 2048亚洲精品国产| 在线毛片片免费观看| 亚洲嫩模在线观看| 2020久久精品国产免费| 亚洲AV无码片一区二区三区| 亚洲成A∨人片天堂网无码| 二个人看的www免费视频| 亚洲精选在线观看| 最近免费中文字幕视频高清在线看| 亚洲人成电影网站色| 免费中文字幕不卡视频| 国产精品免费大片| 国产婷婷综合丁香亚洲欧洲| 国产又粗又长又硬免费视频| 成人A片产无码免费视频在线观看| 亚洲视频国产视频| 国产jizzjizz免费视频| 久久国产精品成人免费| 亚洲日韩av无码中文| 久久国产成人亚洲精品影院| 1000部禁片黄的免费看| 自拍偷自拍亚洲精品偷一| 亚洲欧洲日产国码av系列天堂| 性短视频在线观看免费不卡流畅| 在线观看免费亚洲| 久久精品国产亚洲AV无码偷窥| 青青草国产免费久久久下载| 久久国产精品一区免费下载| 国产成人精品日本亚洲语音| 亚洲第一成年男人的天堂| 在线观看免费亚洲|