When opening Dialog form using Form.ShowDialog() I want to dim the rest of application with a shade of gray.
From my own research it seems that the way to do it is
I'm not sure what you mean by dimming the "rest of the application" but I will show you how to colour the application with a shade of gray with an opacity less than 100%.
Code (I'm assuming you're using c#):
Graphics g = this.CreateGraphics(); // Creating graphics for this form.
g.FillRectangle(Color.FromArgb(80, 102, 90, 95), 0, 0, this.Width, this.Height);
// Draws a gray rectangle with an opacity of 30% over the whole form.
Then to get rid of the gray rectangle you can use:
this.Invalidate();
Which will redraw the form, all the controls will stay the same but the gray will go away.
Hope this Helps!