public Byte[] getphoto(string photopath) //參數(shù)圖片地址,主要用到的類有FileStream
創(chuàng)新互聯(lián)是一家專注于成都網(wǎng)站建設(shè)、成都做網(wǎng)站與策劃設(shè)計,玉田網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專注于網(wǎng)站建設(shè)十余年,網(wǎng)設(shè)計領(lǐng)域的專業(yè)建站公司;建站業(yè)務(wù)涵蓋:玉田等地區(qū)。玉田做網(wǎng)站價格咨詢:13518219792
{
string str = photopath;
FileStream file = new FileStream(str, FileMode.Open, FileAccess.Read);
Byte[] bytBLOBData = new Byte[file.Length];
file.Read(bytBLOBData, 0, bytBLOBData.Length);
file.Close();
return bytBLOBData;
}//這是定義函數(shù)..
這問題有點籠統(tǒng),軟糖來說說把:
圖像處理由System.Drawing命名空間負責。
主要是Bitmap類和Graphics類。
Bitmap表示一個位圖,可以是BMP,JPG,PNG等文件。
裝載位圖
Dim?位圖?As?Bitmap?=?Bitmap.FromFile("C:\Image1.PNG")
Graphics表示一張畫紙,能夠進行繪制操作。
它可以被窗體、控件、位圖調(diào)用CreateGraphics()方法來創(chuàng)建。
然后調(diào)用Graphics.Draw開頭的一系列函數(shù)來繪制圖像和圖形,F(xiàn)ill開頭的填充圖形。
創(chuàng)建畫紙并繪制位圖
Dim?畫紙?As?Graphics?=?Me.CreateGraphics()
畫紙.DrawImage(位圖,?100,?100,?256,?256)
可以將上面三行放到Form1_Load中測試,把路徑改一下,
還可以把Me改為能在上面繪圖的控件的名稱。
更多內(nèi)容請看MSDN的System.Drawing命名空間。
如滿意,請采納,謝謝。
你好 ,試下下面代碼,希望對你有用
//這是直接根據(jù)路徑名稱加載
private voidmenuAddShp_Click(object sender, EventArgs e)
{
IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactory();
IWorkspace pWorkspace = pWorkspaceFactory.OpenFromFile(@"D:\GIS-Data",0);
IFeatureWorkspace pFeatureWorkspace =pWorkspace as IFeatureWorkspace;
IFeatureClass pFC =pFeatureWorkspace.OpenFeatureClass("continent.shp");
IFeatureLayer pFLayer = new FeatureLayerClass();
pFLayer.FeatureClass = pFC;
pFLayer.Name = pFC.AliasName;
ILayerpLayer = pFLayer as ILayer;
IMappMap = axMapControl1.Map;
pMap.AddLayer(pLayer);
axMapControl1.ActiveView.Refresh();
}
//這段是利用對話框添加
從工具箱往窗體上添加一個OpenFileDialog控件。
private voidmenuAddShp_Click(object sender, EventArgs e)
{
IWorkspaceFactorypWorkspaceFactory = new ShapefileWorkspaceFactory();
openFileDialog1.Filter = "shapefile文件(*.shp)|*.shp";
openFileDialog1.InitialDirectory = @"D:\GIS-Data";
openFileDialog1.Multiselect = false;
DialogResultpDialogResult = openFileDialog1.ShowDialog();
if(pDialogResult != DialogResult.OK)
return;
stringpPath = openFileDialog1.FileName;
stringpFolder = Path.GetDirectoryName(pPath);
stringpFileName = Path.GetFileName(pPath);
IWorkspacepWorkspace = pWorkspaceFactory.OpenFromFile(pFolder,0);
IFeatureWorkspacepFeatureWorkspace = pWorkspace as IFeatureWorkspace;
IFeatureClasspFC = pFeatureWorkspace.OpenFeatureClass(pFileName);
IFeatureLayerpFLayer = new FeatureLayerClass();
pFLayer.FeatureClass = pFC;
pFLayer.Name = pFC.AliasName;
ILayerpLayer = pFLayer as ILayer;
IMap pMap =axMapControl1.Map;
pMap.AddLayer(pLayer);
axMapControl1.ActiveView.Refresh();
}
很簡單的方法,貌似沒有。這個需要自己寫很多代碼:
用一個ListView控件。
判斷滾動條當前所顯示的圖片集合,獲取它們的物理路徑。
用Bitmap.FromImage方法把這些圖片讀出來,
然后獲取縮略圖,
把縮略圖用Graphics.DrawImage()繪制出來。
我可以提供Bitmap如何獲取縮略圖的方法:
'''?summary必須創(chuàng)建一個委托并將對此委托的引用作為獲取縮略圖?callback?參數(shù)傳遞,但不使用此委托。/summary
Public?Function?ThumbnailCallback()?As?Boolean
Return?False
End?Function
'''?summary返回Image,表示圖像指定?寬?和?高?的縮略圖。/summary
Public?Function?獲取縮略圖(位圖?As?Bitmap,?寬?As?Integer,?高?As?Integer)?As?Image
Dim?myCallback?As?New?Image.GetThumbnailImageAbort(ThumbnailCallback)
Return?位圖.GetThumbnailImage(寬,?高,?myCallback,?IntPtr.Zero)
End?Function
新建一個文件,寫入下面的代碼:
!doctype?html
html
head
meta?name="viewport"?content="initial-scale=1.0,?user-scalable=no"?/
meta?http-equiv="Content-Type"?content="text/html;?charset=gbk"?/
titleBaidu?Map?V1.2/title
script?type="text/javascript"?src=";services=true"
!--?add?baidu?map?api?--
/script
/head
body
div?id="container"?style="width:?600px;?height:?400px;"
/div
/body
/html
script?type="text/javascript"
var?map?=?new?BMap.Map("container");???????????? ????//?new?Map
var?point?=?new?BMap.Point(116.397128,?39.916527);??????//?Location,?(經(jīng)度,?緯度)
map.centerAndZoom(point,?15);??????????????????? ????//?show?Map
//?添加縮放功能
map.enableScrollWheelZoom();
map.enableKeyboard();
/script
保存到程序exe同一目錄下,文件名:map.html
然后BUTTON點擊事件:
WebBrowser1.Navigate(Application.StartupPath??"\map.html")
這樣就可以了
ps:經(jīng)緯度可以到百度地圖官網(wǎng)去獲取
或者到: ?去生成代碼
可以直接顯示的。你看下面的示例,使用vb.net畫的齒輪:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
b = New Bitmap(PictureBox1.Width, PictureBox1.Height)
g = Graphics.FromImage(b)
'g.RotateTransform(90)
g.Clear(Color.White)
g.TranslateTransform(PictureBox1.Width / 2, PictureBox1.Height / 2)
g.ScaleTransform(1, -1)
'g.SmoothingMode = Drawing2D.SmoothingMode.AntiAlias
g.SmoothingMode = Drawing2D.SmoothingMode.HighQuality
DrawCL(g, New PointF(Val(TextBox1.Text), Val(TextBox2.Text)), Val(TextBox3.Text), Val(TextBox4.Text), Val(TextBox5.Text), Val(TextBox6.Text), Val(TextBox7.Text), Val(TextBox8.Text), Val(TextBox9.Text))
DrawCL(g, New PointF(Val(TextBox18.Text), Val(TextBox17.Text)), Val(TextBox16.Text), Val(TextBox15.Text), Val(TextBox14.Text), Val(TextBox13.Text), Val(TextBox12.Text), Val(TextBox11.Text), Val(TextBox10.Text))
PictureBox1.Image = b
End Sub