|
Hello Luc, I review some points you remarks and:
1. I found the property CanRaiseEvents, but i don’t get using it, it’s a private property and if I put “SerialPort.” I don’t recover it. How can I using it?
2. The HandShake is set to compone
3. I’m using a real serial port, of my PC's motherboard. But how I Developer for smart devices, I’m using the Visual Studio’ emulator, through the activesync
I try to probe others points what you remarks and I'll tell you
Thanks for all
|
|
|
|
|
Hi Experts,
In one of my project functionality I had a requirement of needing a list of all the sections in my app.config file. I was wondering if there is a class (or anything for that matter) inbuilt in .net which would return a collection of sections present in a app.config configuration file.
For example if my app.config is having two sections say "appSettings" and "ConnectionString" then that class should return me a List<string> with 2 values "appSettings" and "ConnectionString".
If anyone is aware of anything regarding this then please let me know.
Thanks in advance!
Regards,
Samar
|
|
|
|
|
|
Thanks Richard for the quick response. It really helped a lot!
Regards,
Samar
|
|
|
|
|
I'm working with DevExpress' XtraReports, and I'm noticing that the ORDER in which tables are added to the DataSet adversely affects a master-detail report. The master table must be added first. I would think that the table order would be irrelevant, having correctly established the relationships between tables.
Anyone else experience this issue with .NET? Or does this seem to be a DevExpress bug?
Marc
|
|
|
|
|
I can't recall ever coming across this issue. I would lean toward it being an issue with DevExpress.
I know the language. I've read a book. - _Madmatt
|
|
|
|
|
Dear Friends.
I want to resize a monochrome bitmap (every pixel can only contains 0 or 1) to another size (like 32*32 to 30*50).
I can do it with GDI+ but I want to do it WITHOUT USING ANY CLASS LIKE GDI+. (only loop , for , if , etc.)
How can I do it?
Regards.
Mehdi Ghiasi
|
|
|
|
|
You can't run anything under .NET without using some .NET classes, so I'll assume the classes you want to avoid are the graphical ones only. Then this is the recipe:
1. study the specification of your input image format, maybe it is a BMP file;
2. read the input, probably into a byte array;
3. now turn it into some in-memory representation that you feel comfortable with;
4. perform the resize, i.e. create a new bitmap in memory
5. study the specification of your output image format, maybe it is a PNG file;
6. generate your output image by converting it into the output format.
You probably could combine some of the steps. You will need a lot of bit manipulations, so make sure you are fluent in masking, shifting, and the like. For the resizing itself, you may choose a nearest-neighbor approach, or alternatively you may want to study different interpolation algorithms, bi-cubic is popular.
If you need an extra challenge, you may implement compression, e.g. the one used in the JPEG file format.
The alternative to all of the above is less than 10 lines of code, based on the Bitmap class.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
No! I have a monochrome bitmap in an integer array table and I want to resize it into a new array WITHOUT GDI+ or any Class that Resizes the image For me. I want to know How It Works!
Regards.
Mehdi Ghiasi
|
|
|
|
|
The result probably won't look very good under these conditions; here are two examples (data in binary):
1.
an image with a width of 8 pixels, one row containing
00101110
scaled up by a factor of 2, it becomes
0000110011111100
0000110011111100
So the result is a "pixelated" image, bits just got replicated, as there is no extra information available.
2.
the reverse operation: an image with a width of 16 pixels, two rows containing
0x0x1x0x1x1x1x0x
xxxxxxxxxxxxxxxx
(you can put a 0 or 1 at any of the 'x' positions) scaled down by a factor of 2 it could become
00101110
which again does not look anywhere near the same as the original as 75% of the information got thrown away.
And that was only the very simple case of a scale by 1/2 or 2/1.
As I said before, you will need a lot of bit manipulations, so make sure you are fluent in masking, shifting, and the like. For the resizing itself, you may choose a nearest-neighbor approach.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
So how can I scale a 100x100 image into 150x150 ?
Regards.
Mehdi Ghiasi
|
|
|
|
|
only double even OR odd bits ...
|
|
|
|
|
I want to answer you, but I want to do it without using any words or code. If you get my telepathic message you should be all set.
|
|
|
|
|
Hi,
I'm trying to figure out how to accept a rejected character in a masked text box. I am using a "Masked Textbox" for the person's last name and to ensure all alpha characters, I'm using "L?????????????????", however if the person's last name has a quote in it, the masked text box is rejecting it but in code I want to accept it. I see I can where I can check the character in the Reject event, however I can not cancel the reject.
Any suggestions how to do this, other than using a Keydown event and accepting only the characters I want?
Thank you,
Glenn
|
|
|
|
|
|
Hi,
I am looking for advanced .NET cources. Cources in architecture, performance and debug difficult problems (using WinDbg, Adplus) and similar cources. Do you know a good course center?
Best Regards
Mac
|
|
|
|
|
You could have looked here[^] first.
It's time for a new signature.
|
|
|
|
|
Thanks for that brilliant answer. Obviously you don't have participate at a good course that you can recommended.
Thanks for your help Ruchard MecCutchan!
|
|
|
|
|
marca292 wrote: Thanks for your help Ruchard MecCutchan!
Maybe you should start with the advanced copy & paste, followed by the introduction to spelling.
It's time for a new signature.
|
|
|
|
|
These may or may not paas your "good course" criterium:
MSDN: the Beginner Developer Learning Center
http://msdn.microsoft.com/en-us/beginner/default.aspx
MSDN Channel 9
http://channel9.msdn.com/learn/
100 courses
http://www.onlinecourses.org/2009/10/28/100-incredible-open-courses-for-the-ultimate-tech-geek/
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Hi, i am programming a CAD like application (2D) and i am wondering about how to do the rendering. I have a canvas for the drawing. My intention was to use the ZIndex from the canvas for multi layer support. For lines, rectangles and so on i have created custom shapes.
But now to the problems. If any shape is overlapping another one the overlapped region appears darker (when opacity < 1). This effect i would like to prevent. The shapes of an whole layer should be a homogenous drawing without visible overlapping.
I tried using Pathgeometry instead, but in this case every LineSegment or PathFigure is rendered equal and i can't set different brushes or dashes for example. How could i solve this?
The other Problem: I want to put visual objects on the Canvas which persists of several other lines, rectangles and so on. Each of this geometries should have its on brush and ZIndex. How could i represent such an object? A shape is not working due to the fact i can't set different brushes, as well as different ZIndices doesn't work.
Ok i could add the geometries of that objects directly to the Canvas, but it would be nicer to have them stored as an object. Any ideas to achieve this?
|
|
|
|
|
this is what I would do:
- define a base class, "DrawingShape"; it has some properties including a Z-order (or a Layer) and some methods, including a Draw() method.
- define specialized shape classes, deriving from DrawingShape; they each override the Draw() method.
- for a drawing, define a List<DrawingShape>
- order that list according to Z-order (back to front).
- to paint the drawing (e.g. in the Paint handler of your canvas Panel), do a foreach over the ordered list of shapes, and call their Draw() method.
A lot of extras are possible; one would be a ShapeGroup, which itself is a DrawingShape, and holds a list of DrawingShapes; so it gets added as one item to the drawing, and its Draw() method would call the Draw() method of all its internal DrawingShapes.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I have thought about that solution too, but doing it this way raises some new problems. E.g. Hittesting.
Can you go a bit deeper on how to render exactly, especially on the ShapeGroup Drawing-Method. Shall i use the Shape, Path or StreamGeometry class for rendering? And i don't see how to apply for example different DashStyles to the Lines inside the ShapeGroup Drawing-Method.
|
|
|
|
|
Hi,
1. rendering
depends on your environment. in WinForms, use Graphics.DrawLine() and the like. In other environments, use whatever is appropriate.
2. hit testing
in my view hit testing takes a method, maybe an int HitTest(Point p) , which exists in the base class, and needs to be overridden by the specialized shapes. There are many ways to implement it, it depends on what you want to call a hit. Here is one I like a lot, although it isn't the easiest one:
- it basically calculates the distance from the mouse position (the Point parameter) to the nearest segment of the shape, and returns that.
- it gets called for all shapes, and the closest one wins, with an upper bound on the distance.
This works very comfortably for the user, as there is no need to exactly hit a line, and it allows to "see through" hollow shapes, so you can hit a small circle overlayed by a large hollow (i.e. unfilled) rectangle.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Ok, but remember, i wanted to avoid overlapping effects. For example look at the following code:
Path path = new Path();<br />
path.Stroke = Brushes.IndianRed;<br />
path.StrokeThickness = 0.05;<br />
path.Opacity = 0.5;<br />
GeometryGroup geometryGroup = new GeometryGroup();<br />
<br />
for (int i = 0; i < 5000; i++)<br />
{<br />
PathGeometry pathGeometry = new PathGeometry();<br />
PathFigure pathFigure = new PathFigure();<br />
pathFigure.StartPoint = new Point(rand.Next(0, 50), rand.Next(0, 50));<br />
pathFigure.Segments.Add(new LineSegment(new Point(rand.Next(0, 50), rand.Next(0, 50)), true));<br />
pathGeometry.Figures.Add(pathFigure);<br />
geometryGroup.Children.Add(pathGeometry);<br />
}<br />
<br />
path.Data = geometryGroup;<br />
Children.Add(path);
I can't set the brush or dashstyles individually to a Line. Only setting the "global" path values is possible, so that each Line is rendered equal. Thats my problem. I can take all the code inside the for loop, but then i have the overlapping effekt again.
|
|
|
|
|