溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

微信小程序怎么制作表白圖片

發(fā)布時間:2020-12-21 14:32:50 來源:億速云 閱讀:191 作者:小新 欄目:移動開發(fā)

小編給大家分享一下微信小程序怎么制作表白圖片,希望大家閱讀完這篇文章后大所收獲,下面讓我們一起去探討吧!

首先,要在電腦上安裝微軟的編譯軟件,我這里是使用的VS2017,安裝的時候如果沒有別的需要,直接選擇下載wpf的組件就好。否則,下載量大,安裝時間長。

安裝完之后,點擊文件,新建項目,選擇wpf應(yīng)用

微信小程序怎么制作表白圖片

然后是窗口設(shè)計,代碼如下:

<Window x:Name="closing" x:Class="BBdemo.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:lacal="clr-namespace:BBdemo"
        mc:Ignorable="d"
        Title="******窗口標(biāo)題(我的是大寶貝***)" Height="450" Width="800" Closing="closing_Closing">
    <Grid>
        <Grid.Background>
            <ImageBrush/>
        </Grid.Background>
        <Button Name="btn1" Content="好" HorizontalAlignment="Left" Margin="168,326,0,0"
VerticalAlignment="Top" Width="93" Height="42" Click="Button_Click"/>
        <Label Name="lab1" Content="小可愛**:" HorizontalAlignment="Left" Margin="1,4,0,0"
VerticalAlignment="Top" Height="59" Width="218" FontSize="36" FontStyle="Italic"/>
        <Label Name="lab2" Content="永遠做我的小寶貝好嗎&#xD;&#xA;&#x9;"
HorizontalAlignment="Left" Height="60" Margin="398,200,0,0" VerticalAlignment="Top"
Width="384" FontSize="36"/>
        <Button Name="btn3" Visibility="Hidden"  Content="退出" HorizontalAlignment="Left"
Height="42" Margin="326,326,0,0" VerticalAlignment="Top" Width="90" Click="Button_Click_1"/>
        <Image x:Name="biaobai" Margin="168,10,399,109" Source="biaobai.png" RenderTransformOrigin="0.362,0.515"/>
        <Button Name="btn2" Content="不好" HorizontalAlignment="Left" 
Margin="493,326,0,0" VerticalAlignment="Top" Width="93" Height="42" 
MouseEnter="Button_MouseEnter"/>
    </Grid>
</Window>

效果如下:

微信小程序怎么制作表白圖片 然后是代碼,鼠標(biāo)檢測那些:

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;using System.Windows;using System.Windows.Controls;using System.Windows.Data;using System.Windows.Documents;using System.Windows.Input;using System.Windows.Media;using System.Windows.Media.Imaging;using System.Windows.Navigation;using System.Windows.Shapes;
namespace BBdemo{    /// <summary>    /// MainWindow.xaml 的交互邏輯    /// </summary>    public partial class MainWindow : Window    {        public MainWindow()        {            InitializeComponent();        }        private void Button_MouseEnter(object sender, MouseEventArgs e)        {            Random rd = new Random();            Button btn = sender as Button;            double maxW = this.Width;            double maxH = this.Height;            double w = btn.Width;            double h = btn.Height;            double l = rd.Next(0, (int)(maxW - w));            double t = rd.Next(0, (int)(maxH - h));            btn.Margin = new Thickness(1, t, 0, 0);        }
        private void closing_Closing(object sender, System.ComponentModel.CancelEventArgs e)        {            MessageBox.Show("不許關(guān)!");            e.Cancel = true;        }        private void Button_Click(object sender, RoutedEventArgs e)        {            lab1.Visibility = System.Windows.Visibility.Hidden;            lab2.Content = "謝謝媳婦!";            btn3.Visibility = System.Windows.Visibility.Visible;            btn2.Visibility = System.Windows.Visibility.Hidden;            btn1.Visibility = System.Windows.Visibility.Hidden;        }
        private void Button_Click_1(object sender, RoutedEventArgs e)        {            System.Environment.Exit(0);        }    }}

好了,一個表白小程序就弄好了,生成解決方案之后,就可以在工程文件中找到.exe的程序,提取出來,發(fā)給對方即可。

tips:程序中的圖片,自己替換,在項目中添加現(xiàn)有項,選擇圖像格式,在選中你找到的圖片,點擊確認(rèn)即可。

看完了這篇文章,相信你對微信小程序怎么制作表白圖片有了一定的了解,想了解更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道,感謝各位的閱讀!

向AI問一下細節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI