简体   繁体   English

C#位图图像

[英]C# Bitmap Image

I created an image with bitmap: 我用位图创建了一个图像:

Graphics GFX = CreateGraphics();
Bitmap bitmap = new Bitmap(@"C:\C#\slideplace.png");
GFX.DrawImage(bitmap, 319, 69, 149, 20);

I have two questions: 我有两个问题:

  • How can I get GFX location because I want to make it movable (like picturebox.location). 我如何获得GFX位置,因为我想让它可移动(如picturebox.location)。
  • Which is the image's event when the mouse is over it, clicked and hold, like a picturebox event (mousedown and also for mouseup). 鼠标悬停在图像上的事件是什么,点击并按住,就像一个图片框事件(mousedown,也用于mouseup)。

Graphics and Bitmap have no UI component so they have no Location property. GraphicsBitmap没有UI组件,因此它们没有Location属性。 You need to use a PictureBox or some other UI control to render your Bitmap 您需要使用PictureBox或其他一些UI控件来渲染您的位图

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM