點(diǎn)擊“開始”-“Excel選項(xiàng)”,在“基本設(shè)置”選項(xiàng)卡中勾選右側(cè)的“在功能區(qū)上顯示‘開發(fā)工具’”,使其顯示出來。
宜興網(wǎng)站制作公司哪家好,找創(chuàng)新互聯(lián)公司!從網(wǎng)頁設(shè)計(jì)、網(wǎng)站建設(shè)、微信開發(fā)、APP開發(fā)、成都響應(yīng)式網(wǎng)站建設(shè)公司等網(wǎng)站項(xiàng)目制作,到程序開發(fā),運(yùn)營維護(hù)。創(chuàng)新互聯(lián)公司從2013年創(chuàng)立到現(xiàn)在10年的時(shí)間,我們擁有了豐富的建站經(jīng)驗(yàn)和運(yùn)維經(jīng)驗(yàn),來保證我們的工作的順利進(jìn)行。專注于網(wǎng)站建設(shè)就選創(chuàng)新互聯(lián)公司。
切換到“開發(fā)工具”功能區(qū),點(diǎn)擊插入”下拉列表框,在彈出的列表中選擇“復(fù)選框(ActiveX控件)”。
然后在文檔區(qū)域拖動(dòng)以繪制一個(gè)復(fù)選框。 并在該復(fù)選框上右鍵單擊,在彈出的菜單中選擇“屬性”以打開“屬性對話框”。
在打開的“屬性對話框”中將“Caption”設(shè)置為空,”BackStyle“設(shè)置為透明,邊框效果設(shè)置為0類型,完成后關(guān)閉”屬性對話框“。
有個(gè)c#的例子,你參考一下把
Below is now the code for the main page used to upload multiple images.
Default.aspx
This is the code inside the form tag
div
asp:Label ID="Label1" runat="server" Text="Locate File:" /
asp:FileUpload ID="fileUp" runat="server" /
br /
asp:Label ID="Description" runat="server" Text="Description:"/asp:Label
asp:TextBox ID="txtDesc" runat="server" Width="349px"/asp:TextBox
asp:Button ID="btnAddFile" runat="server" Text="Add File To Upload List"
onclick="btnAddFile_Click" /
/div
div
asp:Label ID="lblCurrentFileCount" runat="server"/asp:Label
br /
asp:DataList ID="dlPhotoFiles" runat="server" RepeatColumns="10" RepeatDirection="Horizontal"
ItemTemplate
asp:Image ID="Image1" runat="server" ImageUrl='%# string.Format("~/getImage.aspx?id={0}", Eval("id")) %'
Width="50" AlternateText='%# Eval("fileDesc") %' /
br /
asp:LinkButton ID="lnkBtnRemovePhoto" runat="server"
CommandArgument='%# Eval("id") %' OnCommand="lnkBtnRemovePhoto_Command"Remove/asp:LinkButton
/ItemTemplate
/asp:DataList
br /
/div
br /
div
asp:Button ID="btnUploadFiles" runat="server" Text="Upload File(s)"
onclick="btnUploadFiles_Click" /
/div
Default.aspx.cs
This is all of the code behind:
DataSet dsPhotosFiles = new DataSet();
protected void Page_Init(object sender, EventArgs e)
{
if (Session["dsPhotoFiles"] == null)
{
this.initPhotoDS();
Session.Add("dsPhotoFiles", dsPhotosFiles);
}
else
{
dsPhotosFiles = (DataSet)Session["dsPhotoFiles"];
}
}
protected void btnAddFile_Click(object sender, EventArgs e)
{
if (fileUp.PostedFile.ContentLength 0)
{
//TODO: logic for file extension check
DataRow dr = dsPhotosFiles.Tables[0].NewRow();
string fileExt = System.IO.Path.GetExtension(fileUp.PostedFile.FileName);
byte[] imageBytes = new byte[fileUp.PostedFile.InputStream.Length];
fileUp.PostedFile.InputStream.Read(imageBytes, 0, imageBytes.Length);
dr["fileBytes"] = imageBytes;
dr["filePath"] = fileUp.PostedFile.FileName;
dr["fileDesc"] = txtDesc.Text;
dr["id"] = System.Guid.NewGuid().ToString();
dsPhotosFiles.Tables[0].Rows.Add(dr);
}
this.bindDataList();
txtDesc.Text = "";
lblCurrentFileCount.Text = "Current Files To Upload: " + dsPhotosFiles.Tables[0].Rows.Count;
}
protected void btnUploadFiles_Click(object sender, EventArgs e)
{
try
{
for (int i = 0; i dsPhotosFiles.Tables[0].Rows.Count; i++)
{
//TODO:logic to save image path and description to database
string fileName = System.IO.Path.GetFileName(dsPhotosFiles.Tables[0].Rows[i]["filePath"].ToString());
byte[] imageBytes;
imageBytes = (byte[])dsPhotosFiles.Tables[0].Rows[i]["fileBytes"];
//their is no uploading..just writing out the bytes to the directory on the web server.
System.IO.File.WriteAllBytes(Server.MapPath(string.Format("~/documents/{0}", fileName)), imageBytes);
}
//TODO: show success message logic
//clear out rows of dataset not the whole dataset
dsPhotosFiles.Tables[0].Rows.Clear();
this.bindDataList();
lblCurrentFileCount.Text = "Current Files To Upload: " + "0";
}
catch (Exception ex)
{
//TODO: show error message of which file did not get uploaded
throw new Exception(ex.Message);
}
}
private void initPhotoDS()
{
dsPhotosFiles.Tables.Add("Photos");
dsPhotosFiles.Tables[0].Columns.Add("fileBytes", Type.GetType("System.Byte[]"));
dsPhotosFiles.Tables[0].Columns.Add("filePath");
dsPhotosFiles.Tables[0].Columns.Add("fileDesc");
dsPhotosFiles.Tables[0].Columns.Add("id");
}
private void bindDataList()
{
dlPhotoFiles.DataSource = dsPhotosFiles;
dlPhotoFiles.DataKeyField = "id";
dlPhotoFiles.DataBind();
}
protected void lnkBtnRemovePhoto_Command(object sender, CommandEventArgs e)
{
foreach(DataRow dr in dsPhotosFiles.Tables[0].Rows)
{
if (dr["id"].ToString() == e.CommandArgument.ToString())
{
dsPhotosFiles.Tables[0].Rows.Remove(dr);
break;
}
}
this.bindDataList();
lblCurrentFileCount.Text = "Current Files To Upload: " + dsPhotosFiles.Tables[0].Rows.Count;
}
選擇文件夾??在工具箱?-?對話框?里選擇?FolderBrowserDialog?添加?到設(shè)計(jì)器中
然后?代碼寫在??按鈕事件里
FolderBrowserDialog1.ShowDialog()
textbox1.text?=FolderBrowserDialog1.SelectedPath
選擇文件?在工具箱?-?對話框?里選擇?OpenFileDialog
把?OpenFileDialog1.ShowDialog()
TextBox1.Text?=?OpenFileDialog1.FileName
寫到按鈕事件下
如圖
點(diǎn)擊按鈕會彈出?通用對話框??選擇好路徑后?確定?,編輯框里就會顯示選擇的路徑