当前位置:首页站长学院后端开发微信小程序开发–如何制作表白图片?
企业营销,就选知企PROSAAS

微信小程序开发–如何制作表白图片?

      大家可能都会在抖音上刷过,那种表白小程序,但在我看来表白还是亲口说出来比较好,这类小程序只适合在平常的一些小节日给对方一个惊喜。话不多说,现在进入正题:

        首先,要在电脑上安装微软的编译软件,我这里是使用的VS2017,安装的时候如果没有别的需要,直接选择下载wpf的组件就好。否则,下载量大,安装时间长。

        安装完之后,点击文件,新建项目,选择wpf应用

微信小程序开发--如何制作表白图片?

然后是窗口设计,代码如下:

<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="******窗口标题(我的是大宝贝***)" 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="永远做我的小宝贝好吗
	"
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>

效果如下:

微信小程序开发--如何制作表白图片? 然后是代码,鼠标检测那些:

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("不许关!");            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的程序,提取出来,发给对方即可。

tips:程序中的图片,自己替换,在项目中添加现有项,选择图像格式,在选中你找到的图片,点击确认即可。

相关文章:

微信小程序开发图片压缩功能

微信小程序怎么开发之微信小程序开发高清图文教程

以上就是微信小程序开发–如何制作表白图片?的详细内容,更多请关注知企PROSAAS其它相关文章!

温馨提示:

文章标题:微信小程序开发–如何制作表白图片?

文章链接:https://ceshi.prosaas.cn/17191.html

更新时间:2018年08月06日

声明: 本站大部分内容均收集于网络!若内容若侵犯到您的权益,请发送邮件至:973664285@qq.com我们将第一时间处理! 资源所需价格并非资源售卖价格,是收集、整理、编辑详情以及本站运营的适当补贴,并且本站不提供任何免费技术支持。 所有资源仅限于参考和学习,版权归原作者所有,更多请阅读知企PROSAAS协议

给TA打赏
共{{data.count}}人
人已打赏
后端开发

利用微信小程序中Canvas API来合成海报生成组件封装

2018-8-6 15:48:24

后端开发

微信小程序API调用wx.request实现数据请求实例讲解

2018-8-7 9:49:52

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索