.Net语言 APP开发平台——Smobiler学习日志:快速实现应用中的图片、声音等文件上传功能
最前面的话:Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便
样式一
一、目标样式

我们要实现上图中的效果,需要如下的操作:
1.从工具栏上的“Smobiler Components”拖动一个ResourceUploader控件和一个ImageButton控件到窗体界面上

2.ImageButton的Click事件
VB:
Private Sub imageButton1_Click(sender As Object, e As EventArgs)Handles imageButton1.Click
resourceUploader1.Show()
End Sub
C#:
private void imageButton1_Click(object sender, EventArgs e)
{
resourceUploader1.Show();
}
3.修改ResourceUploader控件的属性
a.MaxSelectCount属性
设置资源单次上传的最大数量,默认设置为“9”,一次最多上传9张图片,如图1;
b.QualityMode属性
获取或设置相机组件上传质量的模式,默认设置为“Custom”,即表示压缩上传和原图上传都支持,如图2;
若将该属性设置为“Compressed”,则表示只能压缩上传;
若将该属性设置为“Original”,则表示只能原图上传;
![]() |
![]() |
| 图1 | 图2 |
c.Uploading事件
VB:
Dim imglist As List(Of String) = New List(Of String)
Private Sub resourceUploader1_Uploading(sender As Object, e As BarcodeData)Handles resourceUploader1.Uploading
Try
If e.IsError = False Then
e.SaveFile()
imglist.Add(e.ResourceID)
getImg()
End If
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
C#:
private List<string> imglist = new List<string>();
private void resourceUploader1_Uploading(object sender, BinaryData e)
{
try
{
if (e.IsError == false)
{
e.SaveFile();
imglist.Add(e.ResourceID);
getImg();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
注:调用ResourceUploader控件来获取图片
d.其他代码
VB:
Private Sub resourceuploader1_ImageCaptured(sender As Object, e As BarcodeData)Handles resourceuploader1.ImageCaptured
If imglist.Count > 0 & imglist.Count <= 9 Then
For i = 0 To imglist.Count Step 1
Select Case i
Case 1
img1.Visible = true
btndelimg1.Visible = true
img1.ResourceID = imglist(i - 1)
img1.Refresh()
Case 2
img2.Visible = true
btndelimg2.Visible = true
img2.ResourceID = imglist(i - 1)
img2.Refresh()
Case 3
img3.Visible = true
btndelimg3.Visible = true
img3.ResourceID = imglist(i - 1)
img3.Refresh()
Case 4
img4.Visible = true
btndelimg4.Visible = true
img4.ResourceID = imglist(i - 1)
img4.Refresh()
Case 5
img5.Visible = true
btndelimg5.Visible = true
img5.ResourceID = imglist(i - 1)
img5.Refresh()
Case 6
img6.Visible = true
btndelimg6.Visible = true
img6.ResourceID = imglist(i - 1)
img6.Refresh()
Case 7
img7.Visible = true
btndelimg7.Visible = true
img7.ResourceID = imglist(i - 1)
img7.Refresh()
Case 8
img8.Visible = true
btndelimg8.Visible = true
img8.ResourceID = imglist(i - 1)
img8.Refresh()
Case 9
img9.Visible = true
btndelimg9.Visible = true
img9.ResourceID = imglist(i - 1)
img9.Refresh()
End Select
Next
End If
End Sub
C#:
private void getImg()
{
if (imglist.Count > 0 & imglist.Count <= 9)
{
for (int i = 1; i <= imglist.Count; i++)
{
switch (i)
{
case 1:
img1.Visible = true;
btndelimg1.Visible = true;
img1.ResourceID = imglist[i - 1];
img1.Refresh();
break;
case 2:
img2.Visible = true;
btndelimg2.Visible = true;
img2.ResourceID = imglist[i - 1];
img2.Refresh();
break;
case 3:
img3.Visible = true;
btndelimg3.Visible = true;
img3.ResourceID = imglist[i - 1];
img3.Refresh();
break;
case 4:
img4.Visible = true;
btndelimg4.Visible = true;
img4.ResourceID = imglist[i - 1];
img4.Refresh();
break;
case 5:
img5.Visible = true;
btndelimg5.Visible = true;
img5.ResourceID = imglist[i - 1];
img5.Refresh();
break;
case 6:
img6.Visible = true;
btndelimg6.Visible = true;
img6.ResourceID = imglist[i - 1];
img6.Refresh();
break;
case 7:
img7.Visible = true;
btndelimg7.Visible = true;
img7.ResourceID = imglist[i - 1];
img7.Refresh();
break;
case 8:
img8.Visible = true;
btndelimg8.Visible = true;
img8.ResourceID = imglist[i - 1];
img8.Refresh();
break;
case 9:
img9.Visible = true;
btndelimg9.Visible = true;
img9.ResourceID = imglist[i - 1];
img9.Refresh();
break;
}
}
}
}
二、手机效果显示
![]() |
![]() |
![]() |
![]() |
.Net语言 APP开发平台——Smobiler学习日志:快速实现应用中的图片、声音等文件上传功能的更多相关文章
- .Net语言 APP开发平台——Smobiler学习日志:在应用中添加WeiXin组件
最前面的话:Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便 控件说明 WeiXin组件. 效果演示 1. 分享好友 2. 分享朋友圈 图1 图2 ...
- .Net语言 APP开发平台——Smobiler学习日志:手机应用的TextTabBar快速实现方式
参考页面: http://www.yuanjiaocheng.net/webapi/create-crud-api-1-put.html http://www.yuanjiaocheng.net/we ...
- .Net语言 APP开发平台——Smobiler学习日志:如何快速在手机上实现ContextMenu
最前面的话:Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便 样式一 一.目标样式 我们要实现上图中的效果,需要如下的操作: 1.从工具栏上的&qu ...
- .Net语言 APP开发平台——Smobiler学习日志:如何快速实现地图定位时的地点微调功能
Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便 样式一 一.目标样式 我们要实现上图中的效果,需要如下的操作: 二.地点微调代码 VB: Dim ...
- .Net语言 APP开发平台——Smobiler学习日志:如何实现快速跳转网页
Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便 样式一 一.跳转网页代码(Button的Click事件) Private Sub Button1_ ...
- .Net语言 APP开发平台——Smobiler学习日志:如何快速实现类似于微信的悬浮显示二维码效果
最前面的话:Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便 样式一 一.目标样式 我们要实现上图中的效果,需要如下的操作: 1.从工具栏上的&qu ...
- .Net语言 APP开发平台——Smobiler学习日志:如何快速实现快递信息流的效果
最前面的话:Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便 样式一 一.目标样式 我们要实现上图中的效果,需要如下的操作: 1.从工具栏上的&qu ...
- .Net语言 APP开发平台——Smobiler学习日志:如何实现离线声音文件上传
最前面的话:Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便 一.目标样式 我们要实现上图中的效果,需要如下的操作: 1.从工具栏上的"S ...
- .Net语言 APP开发平台——Smobiler学习日志:Poplist控件的正确打开方式以及如何快速实现
最前面的话:Smobiler是一个在VS环境中使用.Net语言来开发APP的开发平台,也许比Xamarin更方便 样式一 一.目标样式 我们要实现上图中的效果,需要如下的操作: 1.从工具栏上的&qu ...
随机推荐
- 基于Oracle安装Zabbix
软件版本 Oracle Enterprise Linux 7.1 64bit Oracle Enterprise Edition 12.1.0.2 64bit Zabbix 3.2.1 准备工作 上传 ...
- ASP.NET Core 1.0 使用 Dapper 操作 MySql(包含事务)
操作 MySql 数据库使用MySql.Data程序包(MySql 开发,其他第三方可能会有些问题). project.json 代码: { "version": "1. ...
- MyBatis基础入门--知识点总结
对原生态jdbc程序的问题总结 下面是一个传统的jdbc连接oracle数据库的标准代码: public static void main(String[] args) throws Exceptio ...
- .NET中AOP方便之神SheepAspect
SheepAspect 简介以及代码示列: SheepAspect是一个AOP框架为.NET平台,深受AspectJ.它静织目标组件作为一个编译后的任务(编译时把AOP代码植入). 多有特性时,可根据 ...
- C语言可以开发哪些项目?
C语言是我们大多数人的编程入门语言,对其也再熟悉不过了,不过很多初学者在学习的过程中难免会出现迷茫,比如:不知道C语言可以开发哪些项目,可以应用在哪些实际的开发中--,这些迷茫也导致了我们在学习的过程 ...
- Java 中获取类路径 classpath 的方法
System.out.println("++++++++++++++++++++++++"); String path = System.getProperty("jav ...
- Windows下Redis缓存服务器的使用 .NET StackExchange.Redis Redis Desktop Manager
Redis缓存服务器是一款key/value数据库,读110000次/s,写81000次/s,因为是内存操作所以速度飞快,常见用法是存用户token.短信验证码等 官网显示Redis本身并没有Wind ...
- ubuntu15.04 nginx1.6.5 配置虚拟主机
1 在/etc/hosts 添加host 2 在/etc/nginx/nginx.conf中查看http里的include ****** /*.conf的路径,在此路径下添加一个新的******. ...
- 我们公司的ASP.NET 笔试题,你觉得难度如何
本套试题共8个题,主要考察C#面向对象基础,SQL和ASP.NET MVC基础知识. 第1-3题会使用到一个枚举类,其定义如下: public enum QuestionType { Text = , ...
- (译)你应该知道的jQuery技巧
帮助提高你jQuery应用的简单小技巧. 回到顶部按钮 图片预加载 判断图片是否加载完 自动修补破损图像 Hover切换class类 禁用输入 停止正在加载的链接 toggle fade/slide ...





