-
Recent Posts
- Perform set operations on enumerable lists in C#
- Draw a Sierpinski pentagon in C#
- The most popular posts at C# Helper over the last 12 months
- Determine whether two lists contain the same sequences of objects in different orders in C#
- Determine whether two lists contain the same sequences of objects in C#
-
Recent Comments
- The most popular posts at C# Helper over the last 12 months - C# HelperC# Helper on Read Excel data in C#
- The most popular posts at C# Helper over the last 12 months - C# HelperC# Helper on Read a CSV file into an array in C#
- Determine whether two lists contain the same sequences of objects in different orders in C# - C# HelperC# Helper on Determine whether two lists contain the same sequences of objects in C#
- RodStephens on Use a control array in C#
- GodlessGeek on Use a control array in C#
Archives
- April 2018
- March 2018
- February 2018
- January 2018
- December 2017
- November 2017
- October 2017
- September 2017
- August 2017
- July 2017
- June 2017
- May 2017
- April 2017
- March 2017
- February 2017
- January 2017
- December 2016
- November 2016
- October 2016
- September 2016
- August 2016
- July 2016
- June 2016
- May 2016
- April 2016
- March 2016
- February 2016
- January 2016
- December 2015
- November 2015
- October 2015
- September 2015
- August 2015
- July 2015
- June 2015
- May 2015
- April 2015
- March 2015
- February 2015
- January 2015
- December 2014
- November 2014
- October 2014
- September 2014
- August 2014
- July 2014
- June 2014
- May 2014
- March 2014
- February 2014
- January 2014
- December 2013
- October 2013
- August 2013
- June 2013
- December 2012
- September 2012
- August 2012
- July 2012
- June 2012
- May 2012
- April 2012
- January 2012
- December 2011
- November 2011
- May 2011
- April 2011
- February 2011
- December 2010
Categories
- .NET
- 3D
- 3D graphics
- ADO.NET
- algorithms
- animation
- API
- arrays
- attributes
- audio
- books
- C#
- C# programming
- calculations
- challenges
- classes
- clipboard
- coding
- combinatorics
- console
- controls
- cryptography
- curve fitting
- database
- debugging
- dialogs
- directories
- Drag and Drop
- drawing
- drawings
- enums
- Event
- events
- example program
- Excel
- extension methods
- extensions
- files
- finance
- fonts
- formatting
- forms
- fractals
- ftp
- games
- GDI+
- generic
- geometry
- globalization
- graphics
- html
- IDE
- image processing
- inheritance
- interfaces
- internationalization
- internet
- interoperability
- LINQ
- lists
- localization
- mathematics
- memory
- menus
- MessageBox
- methods
- miscellany
- multimedia
- network
- Office
- OOP
- operators
- parsing
- performance
- phone
- PowerPoint
- printers
- printing
- productivity
- programs
- puzzles
- recursion
- reflection
- registry
- regular expressions
- serialization
- settings
- SQL
- stories
- strings
- syntax
- system
- threading
- tips
- tools
- transformations
- Uncategorized
- user interface
- variables
- VBA
- web
- Windows Forms programming
- WMI
- Word
- wpf
- XAML
- XML
Meta
How can I modify a vertex position in MeshGeometry at Run-time ?
Is there a way to add interactively a triangle to Mesh?
Another question concern: is there a way to modify a model lighting WPF from Phong Shading to Gouraud Shanding since WPF implement only Phong .I think that a class Material need to be overriden .How to override this class ?
Thanks in advance !!!
I haven’t worked on this stuff lately, so I’m not completely sure of these answers.
If the program keeps a reference to the mesh in a global variable, I think you can just modify it and the program will update the picture. For example, this post shows how to change a model’s material at run time.
Let the user select and deselect 3D objects using WPF and C
That should work, too. If you keep a reference to the mesh in a global variable, you should be able to add triangles to it at run time. (Of course you’ll have to write the code to do it. There’s no interactive tool to do it in Visual Studio.)
WPF is pretty easy going about these sorts of changes. You build an object model and it displays the model. If you make changes, it updates the display.
Isn’t it the other way around? I think WPF uses Gouraud shading, but Phong shading works better if you have specular highlights in a large polygon.
I’m not sure about this one. You might look at geometry shaders, but I’m not sure they’re supported by WPF 3D. You would think this would be an option provided by the Direct3D library or even the hardware.
For now I just use more polygons. Not an ideal solution but simple.
Hi Stephan,
I was Referring your Book “C# 5.0 Programmer’s Reference” from last 1 Months.So, the Content and the Examples are good enough to make me understand the deep knowledge in C# Programming.
As, From Lat 2 to 3 weeks i am facing some Issues in Solving the exercise content. As not able to check whether my solution is right or wrong. So i Just Need to know is there is any solution book available for the exercises part???
Please, Do reply ASAP as i can’t stop myself to go forward without clearing exorcises. 🙂
Thanks,
Nitin Tyagi
Hi Nitin,
I’m glad you’re finding the book useful. PLEASE post a review (preferably here) when you have a chance!
You can download the solutions to all of the exercises on the book’s web page.
If you have trouble with it or have other questions, please let me know either by posting or via email.
Best wishes,
Rod
Hi Mister stephens first of all i would like to say thak’s for your book Essentiel Algorithm . I would like to ask you if you can help me i want to solve the towers of hanoi problem iteratively but it’s too difficult.
I’m glad you’re finding the book interesting. Post a review when you have a chance.
This is a naturally recursive problem so a recursive solution will be easier to understand, debug, and maintain. If you just want to remove the recursion to avoid deep levels of recursion and using up stack space, you could add a Stack to the program and simulate the recursion yourself.
But if you really want a purely iterative solution, see this GeeksforGeeks post:
Iterative Tower of Hanoi
I try to use stack class for paint bucket function ,but when running and clicking on selected area in picture box to be filled with selected color,nothing happens and cpu usage goes up to %100 and system hangs! here is the code,first, picture box code for selecting this function and call fill function after clicking:
private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
{
if (act == “color”)
{
fill(bmp ,e.X, e.Y, bmp.GetPixel(e.X, e.Y));
pictureBox1.Image = bmp;
}
}
============================and fill fuction which deosn’t work!
private void fill(Bitmap picture, int x, int y, Color bcolor)
{
if (x > 0 && x 0 && y < picture.Height)
{
Point p = new Point(x, y);
Stack s = new Stack();
s.Push(p);
while (s.Count != 0)
{
p = s.Pop();
Color currentcolor = picture.GetPixel(p.X, p.Y);
if (currentcolor == bcolor)
{
picture.SetPixel(p.X, p.Y, currentcolor);
s.Push(new Point(p.X – 1, p.Y));
s.Push(new Point(p.X + 1, p.Y));
s.Push(new Point(p.X, p.Y – 1));
s.Push(new Point(p.X, p.Y + 1));
}
}
}
}
any idea to fix this issue?
— So ,any other suggestions or a better code for paint bucket?
thanks
When the system hangs and nothing seems to happen, that’s often a symptom of an infinite loop.
In this example the code gets the pixel’s current color and then compares it to the target color. If they match, it sets the pixel’s color to its current color so it isn’t changed. It then adds the neighbors to the stack and continues. Because the target pixel’s color wasn’t changed, when the code later look at it again it again thinks it needs to color that pixel. What you get is the same pixels being added to the stack again and again.
You can fix it by changing this statement:
so it sets the pixel to the desired fill color. For example, add a new fill_color parameter to the method and set the pixel’s color to that. When the method starts, you might also check that the target color bcolor and fill_color are different. Otherwise you’ll get the same sort of infinite loop.
You can also see this post for an example:
Write a graphical floodfill method in C#
Hi Rod
I am following your Learning Data Structures and Algorithms video series. First I must say it is one of the simplest explanation of hardest stuff in comp science.
Unfortunately I dont see any working files after lesson 6, here http://examples.oreilly.com/0636920039884/
Is there any other place where I should look? Thanks and keep up the great stuff publishing.
I’m so sorry about that! I think I failed to upload all of the examples correctly so it’s my fault not O’Reilly’s. I’ve told them about it and they will hopefully fix it quickly.
Meanwhile if you email me at RodStephens@CSharpHelper.com I’ll send you the missing files or put them somewhere so you can download them.
Hi Rod,
Can you please create a example desktop application or console to extract youtube video data from URL or keyword like a tag and description?
I am playing using HtmlAgilityPack, but i only able to extract URL from keyword, i don’t really understand how to extract description and tags of youtube videos. Hope you can help me Rod,
Thank you in advance
Sorry but I haven’t done this. Take a look at these links:
Google APIs Client Library for .NET overview
Google APIs Client Library for .NET
Google API for YouTube
C# examples at github
I hope that helps.
Hi,
A new comer from java to C-sharp i just had a simple form that have save,update, delete, clear button how than will i display it on data-grid on a separate form and it make program accessible on the network.
Thanks.
Best Regard,
MrJay.
You should look at ASP.NET if you want it accessible on the internet.
If you want it to run locally on multiple machines on an internal network, you could use SQL Server or some other database product that runs across a network.
Thanks for this MIND BLOWING BOOK TITLE “Beginning Software Engineering” By Mr Rod Steve.
Dear RodStephens 🙂
how to access form controls from other class
help me
i think
control’s Modifier property is Public
but it is not work
i want to
That should work if Modifiers is set to Public.
What’s happening? Does the code compile? If so, then you probably have Modifiers set correctly. Make sure you’re displaying and looking at the right instance of the form. Maybe you’re setting the properties on one form and looking at another form.
Hello, Rob. I like your website so much, it helps me a lot in education. Now I’m studying graphical abilities of c#. Could you send me some examples of using graphics? Some imagines made by you?
If you search the site for “graphics,” you’ll find lots of posts.
Dear sir,
I am working professional.Your Articles on 3D models in WPF helped me a lot.I am new to WPF Graphics.Right now I am struggling a lot in drawing Arc using MeshGeometry3D
I tried doing it using path geometry and it worked as well but I want to perform hit test as well, so want to know how to draw Arc in WPF(MeshGeometry3D).Please guide me it will be great help.
thank you in advance
pranoti
Depending on the type of arc, it’s probably a Bezier curve. If you google those, you should find some information.
This post may also help:
See if the mouse is over a curve in C#
It’s for Windows Forms, but I think it uses the same math to draw the curve, so it may help.
thank you for the reply sir but this is in Windows Form and i want to draw Arc in WPF.My Problem is that after drawing Arc I want to perform hit test as well which I don’t know much and not even getting any information regarding it.
so please help me and if possible provide respective links.
thanks
pranoti
Yes, I know you want WPF, but I don’t have an example like that. You’ll need to use the equations in the other example. Or maybe theresomeone else has an example somewhere that can help.