I strongly believe that it should be less rigid and more flexible and who don’t want to have a const signature if you are not changing the value, I feel the it’s more due to the fact of junior developers fresh out of school believing we are building a kernel or cathedral if you wish.
dbstudio
Posts
-
Development today -
Development today👋 all Do you find yourself in a PR battle where you discuss if you should use const or const ref, or otherwise discuss why you use using to reduce the name of certain types, I can get so frustrated sometimes when I develop a feature or new code, I have it tested and all work and then you have this colleague who wants everything to be how he or she is seeing it and in the end it doesn’t matter as you spent more time discussing or changing it for their joy, code wise it would end up as the same code for the compiler.
-
Graphics in C# versus Graphics in JavaHello 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