為什么 BitBlt 第二第三參數(shù)是200,這是繪制到位圖上的坐標(biāo)起點(diǎn),一般是0。如果繪制寬度和坐標(biāo)起點(diǎn)不能使位圖全覆蓋上,留出的空白部分自然為黑色的。
網(wǎng)站設(shè)計(jì)制作過程拒絕使用模板建站;使用PHP+MYSQL原生開發(fā)可交付網(wǎng)站源代碼;符合網(wǎng)站優(yōu)化排名的后臺(tái)管理系統(tǒng);成都網(wǎng)站建設(shè)、網(wǎng)站設(shè)計(jì)收費(fèi)合理;免費(fèi)進(jìn)行網(wǎng)站備案等企業(yè)網(wǎng)站建設(shè)一條龍服務(wù).我們是一家持續(xù)穩(wěn)定運(yùn)營了十多年的創(chuàng)新互聯(lián)網(wǎng)站建設(shè)公司。
假如下面那樣,沒見有黑邊:
hBMP = CreateCompatibleBitmap(hDC, 500,600)
hBMPOld = SelectObject(hMDC, hBMP)
BitBlt(hMDC,0,0, 500, 600, hDC, 0, 0, HCC0020)
hBMP = SelectObject(hMDC, hBMPOld)
要么重寫這個(gè)控件的 OnPaint 事件,判斷 BorderStyle 屬性為 FixedSingle 的時(shí)候自繪其他顏色。
要么不重寫,把 BorderStyle 設(shè)為 None,直接在這個(gè)控件的 Paint 事件里自繪邊框,例如:
Private?Sub?Label1_Paint(sender?As?Object,?e?As?PaintEventArgs)?Handles?Label1.Paint
e.Graphics.DrawRectangle(Pens.Red,?New?Rectangle(Label1.DisplayRectangle.X,?Label1.DisplayRectangle.Y,?Label1.DisplayRectangle.Width?-?1,?Label1.DisplayRectangle.Height?-?1))
End?Sub
運(yùn)行效果:
調(diào)用系統(tǒng)API使窗體下?lián)碛嘘幱靶Ч?/p>
using System.Runtime.InteropServices;
然后再窗口類的隨便哪個(gè)地方加上:
const int CS_DROPSHADOW = 0x20000;
const int GCL_STYLE = (-26);
//聲明Win32 API
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int SetClassLong(IntPtr hwnd,int nIndex,int dwNewLong);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern int GetClassLong(IntPtr hwnd, int nIndex);
最后在窗體的構(gòu)造函數(shù)中加上:
SetClassLong(this.Handle, GCL_STYLE, GetClassLong(this.Handle, GCL_STYLE) | CS_DROPSHADOW);
分享文章:vb.net圖像黑邊 vb怎么設(shè)置圖片框背景顏色
當(dāng)前鏈接:http://www.chinadenli.net/article48/dohieep.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、企業(yè)建站、定制網(wǎng)站、企業(yè)網(wǎng)站制作、網(wǎng)站設(shè)計(jì)、手機(jī)網(wǎng)站建設(shè)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)