史萊姆論壇

返回   史萊姆論壇 > 綜合討論二區 > 生活話題、日常閒聊、喇勒唬爛灌水區
忘記密碼?
論壇說明

歡迎您來到『史萊姆論壇』 ^___^

您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的!

請點擊這裡:『註冊成為我們的一份子!』


發文 回覆
 
主題工具 顯示模式
舊 2017-06-29, 03:34 PM   #1 (permalink)
管理版主
 
mini 的頭像
榮譽勳章
UID - 4144
在線等級: 級別:98 | 在線時長:10188小時 | 升級還需:9小時級別:98 | 在線時長:10188小時 | 升級還需:9小時級別:98 | 在線時長:10188小時 | 升級還需:9小時級別:98 | 在線時長:10188小時 | 升級還需:9小時級別:98 | 在線時長:10188小時 | 升級還需:9小時級別:98 | 在線時長:10188小時 | 升級還需:9小時級別:98 | 在線時長:10188小時 | 升級還需:9小時級別:98 | 在線時長:10188小時 | 升級還需:9小時
註冊日期: 2002-12-07
文章: 13515
精華: 0
現金: 26917 金幣
資產: 3024847 金幣
預設

如果將BitBlt 改成 StretchBlt
就可以翻轉 與 縮放

Declare Function StretchBlt Lib "gdi32" Alias "StretchBlt" (ByVal hdc As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal hSrcDC As Long, ByVal xSrc As Long, ByVal ySrc As Long, ByVal nSrcWidth As Long, ByVal nSrcHeight As Long, ByVal dwRop As Long) As Long

以下是將WinAPI與.NET的畫布概念之混和修改

PHP 語法:
   Private Declare Function GetDC Lib "user32" (ByVal hWnd As Integer) As Integer
   
Private Declare Function ReleaseDC Lib "user32" (ByVal hWnd As IntegerByVal hDC As Integer) As Integer
   
Private Declare Function StretchBlt Lib "gdi32" Alias "StretchBlt" (ByVal hdc As IntegerByVal x As IntegerByVal y As IntegerByVal nWidth As IntegerByVal nHeight As IntegerByVal hSrcDC As IntegerByVal xSrc As IntegerByVal ySrc As IntegerByVal nSrcWidth As IntegerByVal nSrcHeight As IntegerByVal dwRop As Integer) As Integer

Private Enum TernaryRasterOperations As UInteger
        
''' <summary>dest = source</summary>
        SRCCOPY = &HCC0020
        ''' 
<summary>dest source OR dest</summary>
        
SRCPAINT = &HEE0086
        
''' <summary>dest = source AND dest</summary>
        SRCAND = &H8800C6
        ''' 
<summary>dest source XOR dest</summary>
        
SRCINVERT = &H660046
        
''' <summary>dest = source AND (NOT dest)</summary>
        SRCERASE = &H440328
        ''' 
<summary>dest = (NOT source)</summary>
        
NOTSRCCOPY = &H330008
        
''' <summary>dest = (NOT src) AND (NOT dest)</summary>
        NOTSRCERASE = &H1100A6
        ''' 
<summary>dest = (source AND pattern)</summary>
        
MERGECOPY = &HC000CA
        
''' <summary>dest = (NOT source) OR dest</summary>
        MERGEPAINT = &HBB0226
        ''' 
<summary>dest pattern</summary>
        
PATCOPY = &HF00021
        
''' <summary>dest = DPSnoo</summary>
        PATPAINT = &HFB0A09
        ''' 
<summary>dest pattern XOR dest</summary>
        
PATINVERT = &H5A0049
        
''' <summary>dest = (NOT dest)</summary>
        DSTINVERT = &H550009
        ''' 
<summary>dest BLACK</summary>
        
BLACKNESS = &H42
        
''' <summary>dest = WHITE</summary>
        WHITENESS = &HFF0062
    End Enum

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim hDC As Integer, sx As Integer, sy As Integer

        Me.Hide()

        PictureBox1.Width = My.Computer.Screen.WorkingArea.Width
        PictureBox1.Height = My.Computer.Screen.WorkingArea.Height

        hDC = GetDC(0) ' 
取得螢幕DC
        sx 
PictureBox1.Width
        sy 
PictureBox1.Height

        Dim g 
As Graphics PictureBox1.CreateGraphics
        Dim bmp 
As Bitmap = New Bitmap(My.Computer.Screen.Bounds.WidthMy.Computer.Screen.Bounds.Height'記憶體圖空間
        g = Graphics.FromImage(bmp) '
畫布

        
' 將螢幕DC的圖像轉移到PictureBox1
        StretchBlt(g.GetHdc, 0, 0, sx, sy, hDC, 0, 0, sx, sy, TernaryRasterOperations.SRCCOPY) '
PictureBox1.CreateGraphics.GetHdc
        PictureBox1
.Image bmp
        PictureBox1
.Update() '不更新就不會顯示出來
        '
釋放資源
        ReleaseDC
(0hDC)
        
g.ReleaseHdc()

        
Me.Show()

    
End Sub 
mini 目前離線  
送花文章: 2058, 收花文章: 8081 篇, 收花: 26936 次
回覆時引用此帖
向 mini 送花的會員:
魔術王子 (2017-06-29)
感謝您發表一篇好文章
發文 回覆



發表規則
不可以發文
不可以回覆主題
不可以上傳附加檔案
不可以編輯您的文章

論壇啟用 BB 語法
論壇啟用 表情符號
論壇啟用 [IMG] 語法
論壇禁用 HTML 語法
Trackbacks are 禁用
Pingbacks are 禁用
Refbacks are 禁用

相似的主題
主題 主題作者 討論區 回覆 最後發表
請問有能介紹一下電腦硬體裝修"乙級技術士內容 editer0246 硬體疑難使用問題討論區 7 2003-09-02 05:00 PM
有沒有辦法"網路"控制 vincent3358 一般電腦疑難討論區 0 2003-08-30 02:36 PM
求助一台"完全能破防烤"的燒錄器 geneming 硬體疑難使用問題討論區 8 2003-08-30 01:13 PM


所有時間均為台北時間。現在的時間是 01:16 PM


Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2025, Jelsoft Enterprises Ltd.


SEO by vBSEO 3.6.1