| |

VerySource

 Forgot password?
 Register
Search
Author: avenueqq

C # redraw control: how to remove all background color of FROM\BUTTON control ???

[Copy link]

3

Threads

11

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

 Author| Post time: 2020-1-22 17:54:01
| Show all posts
[DllImport ("User32.dll")]
private static extern IntPtr GetWindowDC (IntPtr hwnd);
[DllImport ("User32.dll")]
private static extern int ReleaseDC (IntPtr hwnd, IntPtr hdc);
[DllImport ("Kernel32.dll")]
private static extern int GetLastError ();

protected override void WndProc (ref Message m)
{
base.WndProc (ref m);
switch (m.Msg)
{
case 0x86: // WM_NCACTIVATE
goto case 0x85;
case 0x85: // WM_NCPAINT
{
IntPtr hDC = GetWindowDC (m.HWnd);
Graphics gs = Graphics.FromHdc (hDC);
Rectangle m_rect = new Rectangle (0, 0, 300, 300);
gs.FillRectangle (new LinearGradientBrush (m_ret, Color.Pink, Color.Pink, LinearGradientMode.BackwardDiagonal), m_rect);
StringFormat strFmt = new StringFormat ();
strFmt.Alignment = StringAlignment.Center;
strFmt.LineAlignment = StringAlignment.Center;
gs.DrawString ("√", this.Font, Brushes.BlanchedAlmond, m_rect, strFmt);
gs.Dispose ();
// Release GDI resources
ReleaseDC (m.HWnd, hDC);
break;
}
}

My code is probably like this. . You can try it out. I just want to get rid of the original colors. . . .
Reply

Use magic Report

0

Threads

10

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-7-30 09:15:01
| Show all posts
You can rewrite its method to achieve
Reply

Use magic Report

0

Threads

10

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-7-30 09:30:01
| Show all posts
Keep following
Reply

Use magic Report

3

Threads

11

Posts

12.00

Credits

Newbie

Rank: 1

Credits
12.00

 China

 Author| Post time: 2020-8-3 00:30:01
| Show all posts
I know this...

I know! When the MessageBox is opened in the form, the value of the system Message is 31 (0x001F), but I don't know how to handle this value. . .

Do you have any experience in this area? Please tell us your thoughts or provide source code. thank. . .
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list