import androidappActivity;
import androidgraphicsBitmap;
import androidgraphicsBitmapFactory;
import androidosBundle;
import androidviewView;
import androidviewViewOnClickListener;
import androidwidgetImageView;
public class MainAct extends Activity {
private ImageView img;
//路径
private String filepath = "/sdcard/samplejpg";
@Override
public void onCreate(Bundle savedInstanceState) {
superonCreate(savedInstanceState);
setContentView(Rlayoutmain);
img = (ImageView) findViewById(Ridimg);
File file = new File(filepath);
if (fileexists()) {
Bitmap bm = BitmapFactorydecodeFile(filepath);
//将显示到ImageView中
imgsetImageBitmap(bm);
}
}
}
请参考 //using SystemDrawing;
//using SystemDrawingImaging;
private void button1_Click(object sender, EventArgs e)
{
//用法
F(textBox1, @"D:\1jpg");
MessageBoxShow("ok");
}
/// <summary>
/// 保存控件
/// </summary>
/// <param name="c">控件</param>
/// <param name="f">文件名</param>
public static void F(Control c, string f)
{
Bitmap i = new Bitmap(cWidth, cHeight);
cDrawToBitmap(i, cClientRectangle);
iSave(f, ImageFormatJpeg);
}InputStream is = getResources()openRawResource(Rdrawableicon);
Bitmap mBitmap = BitmapFactorydecodeStream(is);
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)