基本信息
源码名称:C# 放大镜 示例源码(图片放大)
源码大小:0.03M
文件格式:.zip
开发语言:C#
更新时间:2018-05-29
   友情提示:(无需注册或充值,赞助后即可获取资源下载链接)

     嘿,亲!知识可是无价之宝呢,但咱这精心整理的资料也耗费了不少心血呀。小小地破费一下,绝对物超所值哦!如有下载和支付问题,请联系我们QQ(微信同号):78630559

本次赞助数额为: 2 元 
   源码介绍

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MagPanelTest
{
    public partial class PartialMagPicPanel : UserControl
    {
        public PartialMagPicPanel()
        {
            InitializeComponent();
        }

        private void PartialMagPicPanel_Load(object sender, EventArgs e)
        {
            IntPtr dc;
            IntPtr region;
            IntPtr hpen2;
            IntPtr holdpen;
            dc = GetDC(this.Handle);
            BeginPath(dc);
            hpen2 = CreatePen(5, 5, ColorTranslator.ToWin32(Color.Red));
            holdpen = (IntPtr)SelectObject(dc, hpen2);
            Ellipse(dc, 0, 0, this.Width, this.Height);
            DeleteObject(hpen2);
            EndPath(dc);
            region = PathToRegion(dc);
            SetWindowRgn(this.Handle, region, true);
        }

        [System.Runtime.InteropServices.DllImport("gdi32")]
        private static extern IntPtr BeginPath(IntPtr hdc);

        [System.Runtime.InteropServices.DllImport("gdi32")]
        private static extern int SetBkMode(IntPtr hdc,int nBkMode);
        const int TRANSPARENT = 1;

        [System.Runtime.InteropServices.DllImport("gdi32")]
        private static extern IntPtr EndPath(IntPtr hdc);

        [System.Runtime.InteropServices.DllImport("gdi32")]
        private static extern IntPtr PathToRegion(IntPtr hdc);

        [System.Runtime.InteropServices.DllImport("gdi32")]
        private static extern IntPtr CreatePen(int fnPenStyle,int nWidth,int COLORREF);

        [System.Runtime.InteropServices.DllImport("gdi32")]
        public static extern IntPtr CreateSolidBrush(Int32 crColor);

        [System.Runtime.InteropServices.DllImport("gdi32")]
        private static extern IntPtr SelectObject(IntPtr hdc, IntPtr hpen);

        [System.Runtime.InteropServices.DllImport("gdi32")]
        private static extern IntPtr DeleteObject(IntPtr hpen);

        [System.Runtime.InteropServices.DllImport("gdi32")]
        private static extern int Ellipse(IntPtr hdc, int X1, int Y1, int X2, int Y2);

        [System.Runtime.InteropServices.DllImport("user32")]
        private static extern int SetWindowRgn(IntPtr hwnd, IntPtr hRgn, bool bReDraw);

        [System.Runtime.InteropServices.DllImport("user32")]
        private static extern IntPtr GetDC(IntPtr hwnd);

        [System.Runtime.InteropServices.DllImport("gdi32")]

        static extern int SetROP2(System.IntPtr hdc, int rop);

        [System.Runtime.InteropServices.DllImport("gdi32")]

        static extern int MoveToEx(IntPtr hdc, int x, int y, IntPtr lppoint);

        [System.Runtime.InteropServices.DllImport("gdi32")]

        static extern int LineTo(IntPtr hdc, int X, int Y);
    }
}