gdi+

Paint event of panel not called when shrinking Form from right to left?

我们两清 提交于 2019-12-11 22:04:26
问题 I have a Form which has got a parent panel and it had got a child panel where I am drawing items using the drawing mechanism it works good as expected, but when I shrink my form from right to left it doesn't call child panels paint event while if I shrink a little from left to right and again spread it then it calls the paint event, how should I fix it? Below is my code. private void canvas_Paint(object sender, PaintEventArgs e) { drawString(e); this.Invalidate(); //this.Refresh(); //this

How to let gdi/gid+ object (pen\brush\rect\region etc.) semi-transparent?

纵然是瞬间 提交于 2019-12-11 21:48:42
问题 I want draw multi layer in DC. each layer have some gdi/gdi+ object and semi-transparent with the underlayer. 回答1: you need to use the ARGB system for coloring. A represents transparency, it takes a value between 0 and 255. a value of 125 is semi transparant 回答2: Using the function SetROP2 with the argument R2_MASKPEN is a very simple way to get a transparent pen effect. 来源: https://stackoverflow.com/questions/4261536/how-to-let-gdi-gid-object-pen-brush-rect-region-etc-semi-transparent

Generic Error in GDI+ when calling Bitmap.getHBitmap()

让人想犯罪 __ 提交于 2019-12-11 19:17:31
问题 I'm writing an application which as part of it draws an image on a Logitech G15v2 keyboard's LCD. For the most part the function works fine, but after a while of running, one of the lines throws a " Generic Error in GDI+ " The problem, according to a stack trace, is in Bitmap.GetHbitmap() : at System.Drawing.Bitmap.GetHbitmap(Color background) at System.Drawing.Bitmap.GetHbitmap() at CSCI171_TermProject.G15.Tick(Single Interval) in C:\Users\Sukasa\CSCI171\Term Project\CSCI171-TermProject\G15

Save Bitmap to ICO file, with transparency

断了今生、忘了曾经 提交于 2019-12-11 18:59:21
问题 I'm trying to save a bitmap to a ico file format, but the result file is a PNG image with the extension changed to "ico". Why the ImageFormat Class is saving my Bitmap as PNG format if I choosed Icon format? and then how to save the ico file? PS: I need to save the ICO with transparency This is how I call the proc: Save_Icon(Resize_Image(Bitmap.FromFile(PictureBox_Regedit.Tag), 24, 24), "Regedit.ico") And this is the res of the code Private Sub Save_Icon(ByVal Source As Bitmap, ByVal Filename

Searching a rectangle on the screen for and comparing to an image? Imagesearching

末鹿安然 提交于 2019-12-11 18:31:59
问题 I am wondering how I could search a set rectangle on the screen and have it compare to an image that I specify to see if it matches? Lets say it could Search x1 y1 to x2 y2 and compare against an image? and return the boolean? I know Auto-it has a similar function seen here: http://www.autohotkey.com/docs/commands/ImageSearch.htm Has anyone done this that they could reference? I am using vb.net. EDIT: Abdias, I have put your code into a class instead and I am calling it like this: Dim bm As

C# GDI+ curve drawing issue

别等时光非礼了梦想. 提交于 2019-12-11 18:23:04
问题 I'm trying to draw a series of connected segments, but the curved segments seem to produce an artifact, whereby the outer side of the curve is not smooth at all, but very jagged. This is part of a GIS program I am making. For these lines, the line itself needs to be quite wide, as this represents the range of data that can be collected on this line for the GIS data. There also has to be an area directly under the line where no data is collected. This also can be wide, but not as wide as the

Gif is flickering

帅比萌擦擦* 提交于 2019-12-11 18:07:18
问题 I'm making a window in c++win32 api. And I'm showing gif using gdi+. And this gif is loaded from resource and making IStream*. But when I used not path to gif, and used IStream for creating GDIPlus::Image, and showed it, the gif started to flick. P.S. The window is SW_SHOWMAXIMIZED I have tried to return 1 in WM_ERASEBKGND message, making NULL WNDCLASSEX.hbrBackGround, use InvalidateRect(hwnd,&rc, FALSE) P.S. rc is RECT rc; GetWindowRect(hwnd,&rc); But it didn't worked; case WM_TIMER: if

Getting hwnd for uxtheme.dll DrawThemeParentBackground from a Graphics object

廉价感情. 提交于 2019-12-11 17:30:52
问题 I am dealing with some old drawing code used to draw parts of styled system controls in a WinFroms app. One of the core routines that does this work looks like the following: private bool DrawTheme(Graphics graphics, XPThemeClasses themeClass, int themePart, int themeState, int x, int y, int width, int height) { bool myResult; IntPtr myHdc = graphics.GetHdc(); try { NativeMethods.RECT myRect = new NativeMethods.RECT(x, y, width, height); IntPtr myThemeData = GetThemeData(themeClass); if

System.OutOfMemoryException when creating brush from image byte array

穿精又带淫゛_ 提交于 2019-12-11 15:30:11
问题 I sometimes need to load an image from a byte array like this: Bitmap image = null; using (var ms = new MemoryStream(File.ReadAllBytes(sourceImagePath))) { image = (Bitmap)Image.FromStream(ms); } Now I need to create a TextureBrush from that image, so I use the following approach: using (var b = new TextureBrush(image)) { } It throws System.OutOfMemoryException: 'Out of memory.' . After a while of experimenting, I've found that I can create the brush if I use Image.FromFile like this: using

C# - Image can't be opened in Windows XP but same code works in Windows 7

白昼怎懂夜的黑 提交于 2019-12-11 13:58:19
问题 I have two tiff images, one is black and white, the other is grayscale8. I need to show them in picture box, when I try to open them: Image.FromFile("path"); The BW one opens with no issues, the grayscale one give me an exception: "out of memory" That only happens when I execute the code in a WinXP SP3 machine, a colleague with a Windows 7 has no problems in both cases Any ideas? More info: MS Paint and standard Microsoft Image Viewer can't open the grayscale image, while Office Picture