自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(67)
  • 问答 (1)
  • 收藏
  • 关注

原创 C#笔记(20)新建文件夹/删除文件夹

1.新建if (!Directory.Exists("")) { Directory.CreateDirectory(""); }2.删除public static bool DelectDir(string strPath) { try {

2017-12-22 14:37:57 405

原创 C#笔记(19)HTTP实现下载

//url是下载地址,path是文件保存地址public static string HttpDownload(string url, string path) { // 设置参数 HttpWebRequest request = WebRequest.Create(url) as HttpWebRequest;

2017-12-22 10:35:02 358

原创 C#笔记(18)MessageBox.Show自定义按钮文字

public class MessageBoxEx { public static DialogResult Show(string text, string caption, MessageBoxButtons buttons, string[] buttonTitles) { MessageForm frm = ne

2017-12-15 21:21:52 11239 2

原创 C#笔记(17)程序只运行一个实例

Program类的Main()方法里Boolean runone;System.Threading.Mutex run = new System.Threading.Mutex(true, "single_test", out runone);if (runone){ //程序内容}else{ System.Environment.Exit(0);//退出程序}

2017-12-12 18:22:59 197

原创 Android笔记(28)MVVM架构过程

1.加依赖包apply plugin: 'com.android.application'android { compileSdkVersion 25 buildToolsVersion "26.0.1" defaultConfig { applicationId "com.example.myapplication" minSdkVersio

2017-12-11 18:26:53 253

转载 Android笔记(27)图片绕轴旋转

Y轴旋转为例 1.在res/anim文件夹中新建raceanswer_anim动画<?xml version="1.0" encoding= "UTF-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false" > <alpha

2017-11-06 17:06:36 826

转载 Android笔记(26)finish本界面和上一级界面

1.对于简单的两个Activity,在B界面finish掉A界面: 先在A中将自己赋给test_apublic class A_activity extends Activity { public static A_activity test_a = null; @Override protected void onCreate(Bundle savedInstanceSta

2017-10-26 17:32:29 780

原创 C#笔记(16)检查本机是否联网

using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Runtime.InteropServices;namespace LocalApp.ConsoleApp.Core{ public class Net { [DllIm

2017-10-12 14:01:27 174

原创 C#笔记(15)DPI屏幕适配

app.manifest<application xmlns="urn:schemas-microsoft-com:asm.v3"> <windowsSettings> <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</dpiAware> </windowsSett

2017-09-28 22:23:17 2331

原创 C#笔记(14)打包.NET程序

1.下载NSIS软件 2.打开向导,设置基本操作 3.将dotNetFx40_Full_x86_x64.exe(没有请下载)文件放在生成安装包的同级目录下 4.写代码 (1).在Section区写Section -.NETCall GetNetFrameworkVersionPop $R1 ${If} $R1 < '4.0.30319' SetDetailsPrint texto

2017-09-21 13:15:51 272

原创 C#笔记(13)解决:任务栏图标不消失

private void Window_Closed(object sender, EventArgs e){ myNotifyIcon.Dispose();}

2017-09-18 17:07:22 1313

原创 C#笔记(12)任务栏加图标,点击图标后显示

给窗口加notifyIcon控件 属性里选图标 并添加MouseClick事件 开始写代码: private void notifyIcon1_MouseClick(object sender, MouseEventArgs e) { this.TopMost = true;//将目前窗口强制置顶 this.TopM

2017-09-16 22:21:49 656

原创 C#笔记(11)去标题栏后,窗口移动

在窗口中添加以下事件 MouseDown MouseMove MouseUp 开始写代码: private bool move = false; private int xpos; private int ypos; private void Form_MouseDown(object sender, MouseEventArgs

2017-09-16 22:18:21 211

原创 C#笔记(10)窗口靠边隐藏

给窗口添加以下事件 MouseEnter//鼠标获得焦点 MouseLeave//鼠标失去焦点 MouseHover//鼠标停留 然后写代码: public Timer hoverTimer; hoverTimer = new Timer(); hoverTimer.Interval = 3000;//定时周期3秒 hoverTi

2017-09-16 22:14:55 1320 1

原创 C#笔记(9)Socket长连接

新建类SocketIO.csclass SocketIO { public static Socket client; public static Thread thread; public static IPAddress ip = new IPAddress(new byte[] {IP号, IP号, IP号, IP号 });

2017-09-16 22:08:00 3406

原创 C#笔记(8)使应用具有管理员权限

1.在Visual Studio 中–解决方案资源管理器–右键项目名称–属性,找到“安全性”选项,勾选“启用ClickOnce安全设置” 2.在“解决方案资源管理器”中,找到app.manifest文件 将<requestedExecutionLevel level="asInvoker" uiAccess="false" />替换为<requestedExecutionLevel level=

2017-09-16 22:01:23 242

原创 C#笔记(7)定时器重复任务

public System.Windows.Forms.Timer t = new System.Windows.Forms.Timer();t.Interval = 1000;//定时周期1秒t.Tick += new EventHandler(timerFun1);//到1秒了做的事件t.Enabled = true; //是否不断重复定时器操作t.Start();//开启定时器voi

2017-09-02 20:38:53 1344

原创 C#笔记(6)去掉菜单栏和窗口透明度

FormBorderStyle = FormBorderStyle.None;//去掉菜单栏(在窗口构造函数的初始化后写)this.Opacity = 0.5;//透明度

2017-09-02 20:36:18 589

原创 C#笔记(5)textbox的hint属性

新建类 public static class Win32Utility { [DllImport("user32.dll", CharSet = CharSet.Auto)] private static extern Int32 SendMessage(IntPtr hWnd, int msg, int wParam, [Mar

2017-09-02 20:27:36 3679

原创 C#笔记(4)保存数据到文件,从文件读取数据

1.保存StreamWriter sw = File.CreateText("data.bin");sw.WriteLine("第一行");sw.WriteLine("第二行");sw.Flush();//刷新sw.Close();//关闭2.读取StreamReader sr = File.OpenText("data.bin");String firstLine = sr.ReadLi

2017-09-02 20:22:24 2164

原创 C#笔记(3)获取json数据并解析

1.创一个Bean类,放解析后的数据。class LoginBean{ public String retCode { get; set; }//返回结果:成功0001,失败0000 public String errCode { get; set; }//错误编码,见 附录(未定),返回结果为0000时不可空 public String errMsg { get; set

2017-09-02 20:16:32 998

原创 C#笔记(2)md5加密

class Md5 { public static String getMd5(String str) { if (str == null) { return null; } MD5 md5Hash = MD5.Create();

2017-09-02 20:07:26 212

原创 C#笔记(1)寻找程序入口并新建窗口

1.新建一个类,名字叫Form1.cs,类型是Windows 窗口 然后资源管理器里就有一个Form1.cs的类了,下属三个小类Form1.cs,Form1.cs(设计),Form1.Designer.cs,他们分别是写逻辑代码的地方,拖控件的地方,管理控件资源的地方2.然后找到Program.cs类,写以下代码static void Main(){ Application.Enable

2017-09-02 20:05:04 2164

原创 Android笔记(25)动态设置drawable中属性

GradientDrawable background = (GradientDrawable) TextView.getBackground();drawable.setColor(0xff1296db);drawable.setStroke(2, 0xff000000);

2017-07-26 00:00:13 590

原创 Android笔记(24)Service重复任务

1.在Manifest里面声明服务<service android:enabled="true" android:name=".MyService"/>2.新建MyService类import android.app.Service;import android.content.Intent;import android.os.Handler;import android.os.IBinder

2017-07-24 18:37:02 734

转载 Android笔记(23)TagView标签

1.在build.gradle文件中添加依赖:compile 'co.lujun:androidtagview:1.0.3'2.在布局中使用AndroidTagView,可以使用自定义属性。<co.lujun.androidtagview.TagContainerLayout android:id="@+id/tagcontainerLayout" android:layout_wi

2017-07-24 12:56:39 1127

原创 Android笔记(22)Wheelview选择器

新建WheelView类import android.content.Context;import android.graphics.Canvas;import android.graphics.LinearGradient;import android.graphics.Paint;import android.graphics.Shader;import android.util.At

2017-07-21 21:29:16 456

原创 Android笔记(21)网络加载圆形图片

新建CircleTransform类public class CircleTransform implements Transformation { public Bitmap transform(Bitmap source) { int size = Math.min(source.getWidth(), source.getHeight()); int x

2017-07-21 21:14:25 236

原创 Android笔记(20)RatingBar改变颜色

android:progressBackgroundTint="#e2e2e2"//未选中星星的边框颜色android:progressTint="#ffc600"//选中星星的颜色android:secondaryProgressTint="#ffc600" //选中星星的边框颜色

2017-07-19 18:28:26 1080

原创 Android笔记(19)跳到拨打电话界面

startActivity(new Intent(Intent.ACTION_DIAL, Uri.fromParts("tel", "110"/*电话号码*/, null)));

2017-07-19 17:55:47 249

转载 Android笔记(18)再按一次退出程序

private long exitTime = 0;@Overridepublic boolean onKeyDown(int keyCode, KeyEvent event) { if(keyCode == KeyEvent.KEYCODE_BACK && event.getAction() == KeyEvent.ACTION_DOWN){ if((System.

2017-07-19 17:53:25 194

原创 Android笔记(17)弹出对话框

new AlertDialog.Builder(this) .setTitle("标题") .setMessage("内容") .setNegativeButton("按钮1",null)//取消按钮一般都是null

2017-07-19 17:25:00 192

原创 Android笔记(16)retrofit上传图片

1.接口 @Multipart @POST("WorkerApi/User/uploadPersonPic") Call<UploadBean> uploadPersonPic(@Part("worker_id") RequestBody worker_id, @Part MultipartBody.Part image);2.Modelpublic Call<UploadBe

2017-07-19 09:09:48 397

原创 Android笔记(15)将bitmap存为文件

private File saveFile(Bitmap bm,String path, String fileName){ File dirFile = new File(path); if(!dirFile.exists()){ dirFile.mkdir(); } File myCaptureFile =

2017-07-19 09:04:22 2260

转载 Android笔记(14)打开相机和图库并裁剪

直接Anctivityimport java.io.ByteArrayOutputStream; import java.io.File; import android.app.Activity; import android.content.Intent; import android.graphics.Bitmap; import android.net.Uri; impo

2017-07-18 17:14:51 468

转载 Android笔记(13)图片匀速旋转效果

当我们更新的时候,需要把更新小图标旋转起来,不废话,先爆照 1.写动画的配置文件 version_image_rotate.xml(更多属性见文章尾)<?xml version="1.0" encoding="utf-8"?> <!-- android:duration="@android:integer/config_mediumAnimTime" --> <set xmlns:andr

2017-07-17 18:00:58 303

原创 Android笔记(12)利用高德地图定位

高德官网说明:http://lbs.amap.com/api/android-location-sdk/guide/android-location/getlocation1.先获得一个key:http://lbs.amap.com/dev/key/app(文章尾部附获取SHA1方法)2.请在application标签中声明service组件,每个app拥有自己单独的定位service。<servi

2017-07-17 17:00:17 527

原创 Android笔记(11)“正在加载”动画

1.在styles.xml文件中,如下:<style name="MyDialogStyle"> <item name="android:windowBackground">@android:color/transparent</item><!--背景透明--> <item name="android:windowFrame">@null</item><!--边框

2017-07-16 20:08:59 620

原创 Android笔记(10)MD5加密

public static String getmd5(String string) { if (TextUtils.isEmpty(string)) { return ""; } MessageDigest md5 = null; try { md5 = MessageDigest.ge

2017-07-16 18:29:37 232

原创 Android笔记(9)渐变背景

1.新建xml文件<?xml version="1.0" encoding="UTF-8"?><shape xmlns:android="http://schemas.android.com/apk/res/android"> <gradient android:angle="-90" android:centerX="50%" an

2017-07-16 12:21:14 211

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除