howto add solid line to border of a panel

  • Thread starter Thread starter rocio
  • Start date Start date
R

rocio

I'm using a panel as a pop up dialog...but it displays the pop up without a
border...I can't figure out how to add a nice solid border to it.
 
go there
http://www.ihook.cc

then open source.
in this library there a PocketDialog class which is in fact a Panel.
but has a title & is dragable !
Alex: whynot a Dialog ?
or a Form with ShowDialog() ?

simply because sometimes and for some undetermined reason it cause my
application to go background, and then I found noway whatsoever to bring to
front again automatically !
(and yest I did try some win32 calls ....)
 
Alex: whynot a Dialog ?
or a Form with ShowDialog() ?

simply because sometimes and for some undetermined reason it cause my
application to go background, and then I found noway whatsoever to bring to
front again automatically !
(and yest I did try some win32 calls ....)

Speaking of which... Care to try something new?

IntPtr hWnd = FindWindow("#NETCF_AGL_PARK_",
System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQuali
fiedName);
if ( hWnd != IntPtr.Zero )
SendMessage( hWnd, 0x8001, 0, 0);

This is supposed to bring the application to foreground reliably.
 
try to understand....
Speaking of which... Care to try something new?

IntPtr hWnd = FindWindow("#NETCF_AGL_PARK_",
System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQuali
fiedName);
this return the 1st window in the windows list own by my app, doesn't it ?
if ( hWnd != IntPtr.Zero )
SendMessage( hWnd, 0x8001, 0, 0);
what is 0x8001 ?
which MSG I mean ....
This is supposed to bring the application to foreground reliably.
thanks for this great tip !
 
ho.................
thanks Alex for this........ dazzling peace of code.
I'll try that !

Alex Feinman said:
or a Form with ShowDialog() ?

simply because sometimes and for some undetermined reason it cause my
application to go background, and then I found noway whatsoever to bring to
front again automatically !
(and yest I did try some win32 calls ....)

Speaking of which... Care to try something new?

IntPtr hWnd = FindWindow("#NETCF_AGL_PARK_",
System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQuali
fiedName);
if ( hWnd != IntPtr.Zero )
SendMessage( hWnd, 0x8001, 0, 0);

This is supposed to bring the application to foreground reliably.
 
rocio,

Use two panels:
The first backcolour = black
The second on top of the first at 1,1 and 2 pixels smaller on both
dimensions and white or whatever color you want.
Adjust the above to get whatever thickness/border colour you want.

Paul K.
 
Try this custom frame class that has a BorderStyle...

Cheers,

Chris


public class I8Frame : System.Windows.Forms.Panel

{

private BorderStyle _BorderStyle;

public I8Frame()

{

_BorderStyle = BorderStyle.FixedSingle;

}

public BorderStyle BStyle

{

get {return this._BorderStyle;}

set {this._BorderStyle = value; Invalidate();}

}

protected override void OnPaint(PaintEventArgs pea)

{

base.OnPaint(pea);

using (Pen pe = new Pen(Color.Black))

{

switch (this.BStyle)

{

case BorderStyle.FixedSingle:

pea.Graphics.DrawRectangle(pe,0,0,this.Width-1,this.Height-1);

break;

case BorderStyle.Fixed3D:

pea.Graphics.DrawRectangle(pe,this.ClientRectangle);

break;

case BorderStyle.None:

break;

}

}

}

protected override void Dispose(bool disposing)

{

base.Dispose (disposing);

}



}
 
Alex:

Thanks for the cool post. This rocks!
Alex Feinman said:
or a Form with ShowDialog() ?

simply because sometimes and for some undetermined reason it cause my
application to go background, and then I found noway whatsoever to bring to
front again automatically !
(and yest I did try some win32 calls ....)

Speaking of which... Care to try something new?

IntPtr hWnd = FindWindow("#NETCF_AGL_PARK_",
System.Reflection.Assembly.GetExecutingAssembly().GetModules()[0].FullyQuali
fiedName);
if ( hWnd != IntPtr.Zero )
SendMessage( hWnd, 0x8001, 0, 0);

This is supposed to bring the application to foreground reliably.
 
Back
Top