最新赞助活动温馨提示:自愿赞助服务器费用,学生和没有工作的整站资源免费下载!
头像

Smobiler仿微信朋友圈的消息代码实例-微信开发

来源:http://erdangjiade.com/topic/139055.html 微信开发爱好者 2017-11-01 00:11浏览(43)

这篇文章主要介绍了.Net语言Smobiler开发平台如何仿微信朋友圈的消息样式?本文为大家揭晓答案

最前面的话:Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便

一、目标样式

我们要实现上图中的效果,需要如下的操作:

1.从工具栏上的”Smobiler Components”拖动一个MicroBlog控件到窗体界面上

2.用代码添加手机界面上显示的内容

Load事件代码:

VB:

 Private Sub TestMicroBlog_Load(sender As Object, e As EventArgs) Handles MyBase.Load
  Try
   Me.MicroBlog1.DefaultUserName = "伟斌"
   Me.MicroBlog1.DefaultUserID = "伟斌"

   contentArray(0) = "把青春献给身后那座"+ vbCrLf + "辉煌的城市" + vbCrLf + "为了这个美梦" + vbCrLf + "我们付出着代价"
   
   userarray(0) = "伟斌"

   picturearray(0) = 0

   InitialMicroBlogData()

  Catch ex As Exception
   MessageBox.Show(ex.Message, Sub() Me.Close())
  End Try
End Sub C#:
 private void TestMicroBlog_Load(object sender, EventArgs e)
 {
  try
  {
   this.MicroBlog1.DefaultUserName = "伟斌";
   this.MicroBlog1.DefaultUserID = "伟斌";

   contentArray[0] = "把青春献给身后那座" + System.Environment.NewLine + "辉煌的城市" + System.Environment.NewLine + "为了这个美梦"+ System.Environment.NewLine + "我们付出着代价";
   
   userarray[0] = "伟斌";

   picturearray[0] = "0";

   InitialMicroBlogData();
  }
  catch (Exception ex)
  {
   MessageBox.Show(ex.Message, (Object s, MessageBoxHandlerArgs args) => this.Close());
  }
 }

其他代码:
VB:

 Dim contentArray(4) As String
 Dim userarray(4) As String
 Dim picturearray(8) As String
 Dim voice(5) As String
 Private Sub InitialMicroBlogData(Optional count As Integer = 10, Optional ByVal insert As Boolean = False)
  Dim user As String = userarray(0)
  Dim picturerandomnum As Integer = 6
  Dim imageList As New List(Of String)
  imageList.Add(6)
  
  Dim item As New MicroBlogItem(user, user, contentArray(0), DateTime.Now.ToString)
  item.Pictures = imageList
  item.ILikes.Add(userarray(0), userarray(0))
  If insert = False Then
    Me.MicroBlog1.BlogItems.Add(item)
  Else
    Me.MicroBlog1.BlogItems.AddTop(item)
  End If
 Next
End Sub C#:
 string[] contentArray = new string[5];
 string[] userarray = new string[5];
 string[] picturearray new string[9];
 string[] voice = new string[6];
 private void InitialMicroBlogData(int count = 10, bool insert = false)
 {
  string user = userarray[0];
  List<string> imageList = new List<string>();
  imageList.Add("6");    
  MicroBlogItem item = new MicroBlogItem(user, user, contentArray[0], DateTime.Now.ToString());
  item.Pictures = imageList;
  item.ILikes.Add(userarray[0], userarray[0]);
  if (insert == false)
  {
    this.MicroBlog1.BlogItems.Add(item);
  }
  else
    this.MicroBlog1.BlogItems.AddTop(item);
  }
 }

二、手机效果显示

【相关推荐】

1. 特别推荐:“php程序员工具箱”V0.1版本下载

2. 微信公众号平台源码下载

3. 微信人脉王v3.4.5高级商业版 微信魔方源码

以上就是Smobiler仿微信朋友圈的消息代码实例的详细内容,更多请关注二当家的素材网其它相关文章!

标签: 微信
评论0
头像

友情提示:垃圾评论一律封号 加我微信:826096331拉你进VIP群学习群

1 2