Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
L

Li kai Liu Angus

@Li kai Liu Angus
About
Posts
31
Topics
12
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Equivalent Win32 API to Control.InvokePaint?
    L Li kai Liu Angus

    Well, maybe still not very clear in my previous reply. I included a picture of the button control I've been writing for fun. http://www.ykliu.com/problem.png[^] It's a small button that draw everything from scratch. I plan a few features for this button: - support theme automatically. done! (Thanks for help from James T. Johnson) - support shadowed text. done! (Thanks for great tutorials from Christian Graus) - to able to draw underlying control, so it looks like transparent background is supported. Well, that's why I come up with this question. Though, I am able to use InvokePaint, InvokePaintBackground to redraw the underlying parent control. Suddenly this question comes to my mind. If I want to write another custom control that use this feature by using InvokePaint. There is no way but inheriting it from Control Class. Wouldn't it be better if I can write a static function, passing the caller control and caller's parent control as parameter, then the function will repaint caller control with the underlying parent's background. Thanks in advance... P.S. there's also another painting problem I found. illustrated in the included image. Li-kai Liu

    C# json question learning

  • Equivalent Win32 API to Control.InvokePaint?
    L Li kai Liu Angus

    That's what I don't want it to be at the moment...:(( I know I have to inherit the control class in order to use it (because it's protected method...) Currently, I'm writing many custom controls that each of them requires this functionality. Therefore, I think it's a good idea to "extract" this method as an external one so that every control I've written could use it by calling this external function, something like: public static void DrawParentBackground(Graphic g, Control parent, Control callerControl) No inheritance is involved in order to use these protected method... Thanks again:)

    C# json question learning

  • Equivalent Win32 API to Control.InvokePaint?
    L Li kai Liu Angus

    Hi, Does anyone know the equivalent APIs or mechanisms of doing InvokePaint or InvokePaintBackground in Controls? I want to tell a parent control to redraw itself inside the control's client area, so it looks like a control can be have "transparent" background (of course, not real transparent). However InvokePaint is a protected method. There is no chance for me to use these methods if I'm not inheriting the control class. Thanks:) Li-kai Liu

    C# json question learning

  • problem on drawing theme background on a bitmap
    L Li kai Liu Angus

    Hi, Just wondered if anyone has tried this already? I'm trying to write a button control that use APIs in uxtheme.dll to draw its background image. I also want to have an alpha blend option for the button. My solution is to draw the theme background on a temporary bitmap, do the alpha blending, and then, copy it to the screen. But here comes a problem. If theme background already contains some pixels which are semi-transparent, these pixels are drawn in black color on the target bitmap. While there isn't any problem if I want the theme background image to be drawn on the screen (alpha pixels are rendered correctly on the screen, perfectly drawn on top of whatever sits there.) Does anyone know the solution to draw a theme background correctly onto a bitmap? Thanks:) Li-kai Liu

    C# graphics help question

  • I need to get mouse events anywhere on the screen
    L Li kai Liu Angus

    just tested it. It looks the scope is rather limited. Even you set it true, you still can't capture mouse events outside its top parent control...

    C# question

  • I need to get mouse events anywhere on the screen
    L Li kai Liu Angus

    I don't if it works or not. Because I've never used this feature Correct me if I am wrong:) There is a property called Capture in Control Class. It can be set to true if you wish to capture all mouse events, even outside the control's borders. The following text is copied from MSDN: --- When a control has captured the mouse, it receives mouse input whether or not the cursor is within its borders. The mouse is typically only captured during drag operations. Only the foreground window can capture the mouse. When a background window attempts to do so, the window receives messages only for mouse events that occur when the mouse cursor is within the visible portion of the window. Also, even if the foreground window has captured the mouse, the user can still click another window, bringing it to the foreground. When the mouse is captured, shortcut keys do not work. --- Hope this would help:-O

    C# question

  • Does anyone know how to capture screen in C#?
    L Li kai Liu Angus

    BTW, is that possible to include the cursor in the captured image??

    C# csharp graphics tutorial question

  • Does anyone know how to capture screen in C#?
    L Li kai Liu Angus

    are you saying we can re-write this [System.Runtime.InteropServices.DllImportAttribute("User32.dll")] private static extern int GetWindowRgnBox( IntPtr hWnd, // handle to window ref RECT rect // rectangle ); to [System.Runtime.InteropServices.DllImportAttribute("User32.dll")] private static extern int GetWindowRgnBox( IntPtr hWnd, // handle to window ref Rectangle rect // rectangle ); But wouldn't it be relatively confusing because the last two field actually mean different things (width, height in Rectangle, but right, bottom in RECT)...

    C# csharp graphics tutorial question

  • Does anyone know how to capture screen in C#?
    L Li kai Liu Angus

    Thanks your guys:) I'm playing around with philips's code now. looks pretty nice. When I tried to spot out the location of Win32windows.zip on gotdotnet.com, I got lost... not well organized as codeproject So, leppie, would you mind sending it to my mailbox at ykliu@email-home.com? Thanks again:) Li-kai Liu

    C# csharp graphics tutorial question

  • Does anyone know how to capture screen in C#?
    L Li kai Liu Angus

    Hi, I'm thinking of capturing some regions of my screen into a Bitmap object. Does anyone have any ideas? Thanks:) Li-kai Liu

    C# csharp graphics tutorial question

  • Am I doing it right?
    L Li kai Liu Angus

    Hi, Well, I guess it's a design quesiton. I try to write a layout engine with two classes in it. The LayoutPanel class acts as a container for either LayoutPanel or LayoutItem, where LayoutItem is simply an object that stores the width and height of a visible item. and here is my solution: class LayoutPanel: Component, IContainer class LayoutItem: Component is this ok? or better to have an abstract class on top of both (because both of them have widths and heights as attributes). Thanks:)

    C# design docker question

  • Can anyone recommend a book for writing custom control in C#?
    L Li kai Liu Angus

    I have one at hand. I agree with you that this one is a comprehensive guide on GDI+ and how to use these controls. But not in depth when it comes to writing our own controls.

    C# csharp winforms graphics question learning

  • Can anyone recommend a book for writing custom control in C#?
    L Li kai Liu Angus

    Any good ideas of what to buy in regard to writing custom control? I'm looking for a book that explains the ins and outs of Control class, like when to override createParams, WndProc. I also saw a few books: .NET Windows Forms Custom Controls by Richard L. Weeks, Richard L Weeks GDI+ Programming: Creating Custom Controls Using C# by Eric White, Chris Garrett (Contributor) are they good??

    C# csharp winforms graphics question learning

  • Drawing on the Screen
    L Li kai Liu Angus

    Hi, I read AK's article and experimented with his second solution. It did throw an exception. And I modify it as follow and now it works: IntPtr hdc = GetDC(IntPtr.Zero); // get hdc for the screen Graphics g = Graphics.FromHdc(hdc); g.DrawLine(new Pen(Color.Blue), 0,0,500,500); // draw a line for testing. g.Dispose(); // <- I don't know if I should use g.Dispose or g.ReleaseHdc here... ReleaseDC(IntPtr.Zero,hdc); GetDC & ReleaseDC are Win32 API in user32.dll Hope this could help you:)

    C# graphics css winforms question learning

  • How to use uxtheme APIs in custom control?
    L Li kai Liu Angus

    Thanks a lot!! You've been always helpful:)

    C# help question tutorial discussion learning

  • How to use uxtheme APIs in custom control?
    L Li kai Liu Angus

    I put a copy at http://www.ykliu.com/ThemeExplorer.zip if you wish to have a look. Maybe a bit slow when downloading:) Li-kai

    C# help question tutorial discussion learning

  • How to use uxtheme APIs in custom control?
    L Li kai Liu Angus

    have tired "BUTTON" & "Button". still the same:(( sample app? Do you mean ThemeExplore?? Li-kai

    C# help question tutorial discussion learning

  • How to use uxtheme APIs in custom control?
    L Li kai Liu Angus

    Hi, James The thing you addressed in the second part using P/Inovoke is what I've done in my program. But it's still not working. I've already had my unmanaged function declared as you did in the post. And it looks to me that OpenThemeData doesn't work as it should do. I had another uxtheme API static public extern bool IsThemeActive(); It works very well. But just don't know why OpenThemeData always return Null whenever I call it. Part of the code in my control is as follow: protected override void OnPaint(PaintEventArgs pe) { IntPtr hTheme = OpenThemeData(this.Handle , "button"); if (hTheme != IntPtr.Zero) { // draw themed control } else { // draw normal control } } However, OpenThemeData always return Null... Am I doing right with this? Thanks!

    C# help question tutorial discussion learning

  • How to use uxtheme APIs in custom control?
    L Li kai Liu Angus

    Hi, I'm wrting a custom control that will use theme library to draw my control. But whenever I call OpenThemeData, all that I get is a NULL theme handle. Is there any trick to do before calling this function? I saw one guy posting the same question a couple months ago and sought no answer. I also read James T. Johnson & akr0's discussion on this issue. However, not quite understand what James mean by using P/Invoke. What's P/Invoke? (I know it may be a dump question, but I'm a beginner...) Any help will be appreciated. It would be better if you can provide a code snippet to illustrate. Thanks:)

    C# help question tutorial discussion learning

  • Question about Control
    L Li kai Liu Angus

    Is it possible to draw a control outside of its parent's client area, say, somewhere on the desktop?

    C# question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups