Click here to Skip to main content
15,890,579 members
Home / Discussions / C#
   

C#

 
GeneralRe: checkbox Pin
EliottA10-Nov-09 4:09
EliottA10-Nov-09 4:09 
AnswerRe: checkbox Pin
Shameel10-Nov-09 4:47
professionalShameel10-Nov-09 4:47 
GeneralRe: checkbox Pin
farokhian10-Nov-09 4:49
farokhian10-Nov-09 4:49 
GeneralRe: checkbox Pin
EliottA10-Nov-09 4:58
EliottA10-Nov-09 4:58 
GeneralRe: checkbox Pin
Md. Marufuzzaman10-Nov-09 5:48
professionalMd. Marufuzzaman10-Nov-09 5:48 
AnswerRe: checkbox Pin
Christian Graus10-Nov-09 8:56
protectorChristian Graus10-Nov-09 8:56 
GeneralRe: checkbox Pin
EliottA11-Nov-09 8:48
EliottA11-Nov-09 8:48 
QuestionGraphics in C# versus Graphics in Java Pin
dbstudio10-Nov-09 3:41
dbstudio10-Nov-09 3:41 
Hello guys and girls

I'm recently started on C# but as I know abit programming (Coming from Java) it should be easy to do this, but as I have experienced from Microsoft its never easy on customizing or subclassing their components (I've tried in Win32/C Old school, but thats many years ago)

The question is:

I want to draw a dropshadowborder on a panel and/or take it further to draw all components with a dropshadow when they are added to the panel

I started on subclassing Panel to override OnPaint, but as I cannot do the following code (atleast not yet) in C# I would like to have an explanation if you guys/girls are up for it or willing to help me out so I learn abit more this day

// Sample code working in Java

@Override
    public void paint(Graphics g) {
        if (shadow == null) {
            BufferedImage buffer = new BufferedImage(getWidth(),
                                                     getHeight(),
                                                     BufferedImage.TYPE_INT_ARGB);
            Graphics2D g2 = buffer.createGraphics();
            super.paint(g2);
            shadow = factory.createShadow(buffer);
            g2.dispose();
            g.drawImage(shadow, distance_x, distance_y, null);
            g.drawImage(buffer, 0, 0, null);
        } else if (isVisible()) {
            g.drawImage(shadow, distance_x, distance_y, null);
            super.paint(g);
        }
    }

// End of sample snippet

My snippet in C#:

//Snippet from C#

protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
      {
          Image buffer = new Bitmap(Width, Height);
          Graphics g2 = Graphics.FromImage(buffer); // Here I want to take a "snapshot" of the panel it self or the components added to the panel but cant quite see where I shall steal the "image" I know atm this is "white"
          g2.FillRectangle(new SolidBrush(Color.Black), new Rectangle(5, 5, Width, Height));
          e.Graphics.DrawImage(buffer, 0, 0);
      }


I know the code convertion isnt exact the same but it was to point out my problem
I hope you can see what I want to do, and I hope someone is willing to spend some minutes answering me with some theory.

My Best Regards and Wishes

David Bundgaard
AnswerRe: Graphics in C# versus Graphics in Java Pin
Christian Graus10-Nov-09 8:59
protectorChristian Graus10-Nov-09 8:59 
Questionclearing up oledb command Pin
Chazzysb10-Nov-09 2:54
Chazzysb10-Nov-09 2:54 
AnswerRe: clearing up oledb command Pin
PIEBALDconsult10-Nov-09 2:59
mvePIEBALDconsult10-Nov-09 2:59 
GeneralRe: clearing up oledb command Pin
Chazzysb10-Nov-09 3:01
Chazzysb10-Nov-09 3:01 
GeneralRe: clearing up oledb command Pin
PIEBALDconsult10-Nov-09 4:13
mvePIEBALDconsult10-Nov-09 4:13 
AnswerRe: clearing up oledb command Pin
Covean10-Nov-09 3:22
Covean10-Nov-09 3:22 
GeneralRe: clearing up oledb command Pin
Md. Marufuzzaman10-Nov-09 5:44
professionalMd. Marufuzzaman10-Nov-09 5:44 
AnswerRe: clearing up oledb command Pin
Andrew Rissing10-Nov-09 3:27
Andrew Rissing10-Nov-09 3:27 
GeneralRe: clearing up oledb command Pin
Andrew Rissing10-Nov-09 3:31
Andrew Rissing10-Nov-09 3:31 
GeneralRe: clearing up oledb command Pin
Md. Marufuzzaman10-Nov-09 5:46
professionalMd. Marufuzzaman10-Nov-09 5:46 
GeneralRe: clearing up oledb command Pin
PIEBALDconsult10-Nov-09 5:53
mvePIEBALDconsult10-Nov-09 5:53 
GeneralRe: clearing up oledb command Pin
Md. Marufuzzaman10-Nov-09 6:34
professionalMd. Marufuzzaman10-Nov-09 6:34 
GeneralRe: clearing up oledb command Pin
Md. Marufuzzaman10-Nov-09 6:36
professionalMd. Marufuzzaman10-Nov-09 6:36 
GeneralRe: clearing up oledb command Pin
PIEBALDconsult10-Nov-09 9:31
mvePIEBALDconsult10-Nov-09 9:31 
GeneralRe: clearing up oledb command Pin
Covean10-Nov-09 22:12
Covean10-Nov-09 22:12 
QuestionNUnit execution from a share? Pin
Alaric_10-Nov-09 2:53
professionalAlaric_10-Nov-09 2:53 
QuestionHow to get the Left,Top and Height,Width of perticular region within an running application? Pin
ritz123410-Nov-09 2:50
ritz123410-Nov-09 2:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.