重庆分公司,新征程启航
为企业提供网站建设、域名注册、服务器等服务
这篇文章给大家分享的是有关Smobiler如何模仿微信朋友圈的消息样式的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。
我们提供的服务有:成都做网站、网站制作、成都外贸网站建设、微信公众号开发、网站优化、网站认证、甘肃ssl等。为千余家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的甘肃网站制作公司一、目标样式
我们要实现上图中的效果,需要如下的操作:
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]; ListimageList = new List (); 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); } }
二、手机效果显示
感谢各位的阅读!关于“Smobiler如何模仿微信朋友圈的消息样式”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!