|
I'm trying to use the FolderNameEditor in a property grid. Like this:
[Editor(typeof(System.Windows.Forms.Design.FolderNameEditor), typeof(System.Drawing.Design.UITypeEditor))]
But it seems that FolderNameEditor is not in that namespace. Although all the documentation that I've seen says that it is. I'm using VS2005 and the 2.0 framework.
Can someone tell me where this editor is?
|
|
|
|
|
hi
add a reference to:
System.Design.dll and System.Drawing.Design.dll
regards
|
|
|
|
|
Hi,
Thanks, that's it.
I had System.Design and System.Drawing (which should have been System.Drawing.Design).
RS
|
|
|
|
|
For the project I am working on, if I cannot find an image, I am going to write the image name to the picturebox instead. However, there doesn't seem to be a straightforward property (like "Text") that I can use. Is there an easy way to do this?
|
|
|
|
|
Andrew Stampor wrote: Is there an easy way to do this?
Define easy
One way would be to replace, at run time, the picture box with another control, like label, that has a text property.
To keep the picture box you would need to create an image and write the text on to it, then assign it to the picture box. There numerous examples of how to do this.
only two letters away from being an asset
|
|
|
|
|
You can place a label over a picturebox and change its visibility according to existence of picture
|
|
|
|
|
picturebox.visible = false;
label.visible = true;
This essentially replaces the picturebox with the label control.
only two letters away from being an asset
|
|
|
|
|
I only have access to the picturebox itself. Using a label would be a good way, but I cannot rely on it.
I think I will try to override the OnPaint, but it seems like more trouble than it should be.
|
|
|
|
|
Andrew Stampor wrote: I only have access to the picturebox itself.
You can override the OnPaint event but you can't place a label control on the form?
only two letters away from being an asset
|
|
|
|
|
The picturebox is inherited from and extended. I do not know which form(s) it will necessarily be on. I was able to take care of it with OnPaint. Thanks for your help, guys.
|
|
|
|
|
you can use a label as a pictureBox so catch two birds in one hand
|
|
|
|
|
Yes, create a bitmap, draw the string onto it, and put it in the picturebox.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Bitmap bm = new Bitmap(@"C:\YourPicture.bmp");
Graphics gr = Graphics.FromImage(bm);
gr.DrawString(""test", new Font("Verdana", (float)10, FontStyle.Bold, GraphicsUnit.Pixel), new SolidBrush(Color.Red),(float)20, (float)20);
gr.Dispose();
pictureBox1.Image = bm;
Smile: A curve that can set a lot of things straight!
(\ /)
(O.o)
(><)
|
|
|
|
|
Hello All,
I have good knowledge of Visual Basic, but coming project is in C#. If anybody can give some urls for tutorials or samples it will be helpful.
Thanks in advance.
Thanks & Regards,
Kumar
|
|
|
|
|
|
If you already have a background in VB then try just reading the spec at:
CSharpSpecStart
As far as book, I liked Apress' Pro C# 2005 and the .NET 2.0 Platform. I think it is a great book for those who already know programming but don't know the C# lanagauge.
|
|
|
|
|
Hope this[^] link will be more Useful when you wnat to learn C#.
Regards,
Satips.
|
|
|
|
|
Hello All,
Thank you very much for providing some useful urls.
Thanks & Regards,
Kumar
|
|
|
|
|
I decided to make my life much harder than it is and convert some C++ code I have to C# (and possibly Java some day).
Please - no "Why do that you dummy" responses, that serves no purpose. Also, with NO EXCEPTIONS there isno single tool to take a C++ code set, reverse it to a complete UML model and re-engineer it into C# (there are numerous tools that kinda do parts, but still leave too much work. I figured out that a combination of 6(six) yes 6 tools will provide that process at a total cost to myself of too much (money and effort).
Lastly, C++ has too much complexity and I refuse to pander to it anymore than I must - AND I DO NOT WANT TO WRITE MY OWN PARSER for all the crap that's snuck into it.
Actually I'm answering some personal questions I have about development and processes in general and this seemed like a good test. Also I have a large body of "real" C++ code I'd like to rebuild in C# and I'm working on a methodology and VS tools to do it.
I selected this specific code for specific reasons and is quite large and complex (its the source code to a windows based RTS game from a few years back), and I think I have a handle on most issues.
However ....
I would like suggestions as to how to gracefully handle the following situations:
(what I'm currently doing in parens)
- TYPEDEF's (So far I've punted and done a global Search and Replace)
- Macros (Utility functions)
- Unions (distinct structs, remodelled use)
- const (removed and ignored)
Any physiologically possible solutions gratefully received and considered. If you have any additional problems in this (such as struct inheritance) please let me know.
If I get the time I'll post an article on this subject (with attributions) - I can't be the only person wishing for a NET/C# alternative to some of the s****y C++ code out there. Nor the only person who wants tools to make it more efficient.
Nothing is impossible, we just don't know the way of it yet.
|
|
|
|
|
"- TYPEDEF's (So far I've punted and done a global Search and Replace)"
- I think this is the only practical way to handle typedef. You can replace certain simple cases with the C# alias syntax "using Foo = x.y.z".
"- Macros (Utility functions)"
- We handle it with search/replace combined with replacement with the simple C# flag type #define (the flag #define allows the converted #ifdef FOO directives to continue to be useful). One problem is that macros are type-less, so it's problematic to refactor these to static methods.
"- const (removed and ignored)"
- Yes, they must be removed, but they provide information for a C++ to C# conversions (especially for parameters).
C++ to C# (or to any other language) is indeed no picnic (we've recently released 'C++ to C# Converter', which eases the task somewhat, but there's just too much complexity in the C++ language to allow a high conversion rate).
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB to C# converter
Instant VB: C# to VB converter
C++ to C# Converter: converts C++ to C#
C++ to VB Converter: converts C++ to VB
Instant C++: converts C# to C++/CLI and VB to C++/CLI
Instant Python: converts C# to IronPython and VB to IronPython
|
|
|
|
|
Valid point regarding the const - the information IS important to C++ but can be dealt with at the C# model level (remove the need).
I looked at the demo - fairly nice tool but addresses pure conversion only.
A very real secondary need (almost at the same level as pure translation) is the ability to place the C++ code into a UML model - not just the class diagrams, but sequence etc diagrams too. Then I can "Fix" some issues of the basic model, perform package management, remodel the design, etc, and regenerate/test.
I would suggest you look at CodeVizualizer (http://www.codedrawer.com/ - $50) which is a great tool for learning individual code segments but doesn't have the ability to generate all documentation I require/need for analysis, nor does it provide the big picture.
I would highly recommend it for a utility tool for a C++ maintenance/enhancement project, but it falls short of being a "corporate" architect tool.
Nothing is impossible, we just don't know the way of it yet.
|
|
|
|
|
I have a class that handles encryption of passwords, and there is one part where I want to fill a structure with the following:
struct RoleValue
{
public string szRoleName;
public string szDialog;
public string szAdd;
public string szView;
public string szEdit;
public string szDel;
public string szDialogDescr;
}
public ArrayList RoleDialogAccess = new ArrayList();
//Fill the structure with data from the SQL query...
while (sqlRdr.Read())
{
rm.szRoleName = sqlRdr.GetString(0);
rm.szDialog = sqlRdr.GetString(1);
rm.szView = sqlRdr.GetString(2);
rm.szAdd = sqlRdr.GetString(3);
rm.szEdit = sqlRdr.GetString(4);
rm.szDel = sqlRdr.GetString(5);
rm.szDialogDescr = sqlRdr.GetString(6);
this.RoleDialogAccess.Add(rm);
}
This is all good.
When I get to VB is where the problem occurs.
For VB.NET to be able to access the data, I have to do the following:
Dim AEG as New AESClass
rw(0) = CStr(Me.AEG.RoleDialogAccess.Item(iCnt).szDialog)
rw(1) = CStr(Me.AEG.RoleDialogAccess.Item(iCnt).szDialogDescr)
rw(2) = CStr(Me.AEG.RoleDialogAccess.Item(iCnt).szAdd)
rw(3) = CStr(Me.AEG.RoleDialogAccess.Item(iCnt).szView)
rw(4) = CStr(Me.AEG.RoleDialogAccess.Item(iCnt).szEdit)
rw(5) = CStr(Me.AEG.RoleDialogAccess.Item(iCnt).szDel)
Now, in when done in Visual Studio 2005 there is no problem, but when I place the C# DLL into a VB Project in migrated (from VS 2003)
on XP the compiler crashes and on NT 2000 I get errors. Nothing specific about the errors, ones that must be sent to Microsoft.
What am I doing wrong?
"I know not with what weapons World War III will be fought, but World War IV will be fought with sticks and stones."
Einstein
|
|
|
|
|
Not enough info. to really diagnose the problem, but ..
Looking at the VB code I can see strict isn't on. I'm guessing explicit isn't on either given the state of the code
If both projects are in VS2005 then perhaps you could declare RoleDialogAccess as List<rolevalue> instead? The VB class could then consume it such:
( where Me.AEG.RoleDialogAccess is List(Of RoleValue) )
AEG.RoleDialogAccess(iCnt).szDialog
.
.
.
Might help.
------------------------------------------------
I'm largely language agnostic -
After a while they all bug me
------------------------------------------------
|
|
|
|
|
I have the situation where Form A is hidden when Form C is displayed and then when Form C is closed, Form A is displayed again. Almost all of the time it works as expected. Occasionally, though, both forms are seen displayed at the same time. For the most part, no one can tell me the steps they went through when it happens. It has been witnessed mostly in debug mode. The one time it happened in release mode was also the one time we knew the steps that led it to happen - a test procedure was being run. However, when the test procedure was repeated at a later date the 2 windows were correctly mutually exclusive. Any ideas?
Description of the code:
When ClassB is instantiated, it sets the member variable m_FormCOpen = false. Later, upon user selection, FormA will call method1 in ClassB. method1 instantiates FormC, subscribes to the closed event for FormC, sets m_FormCOpen = true, displays FormC, does some database updating, and returns. The method in FormA checks the property for m_FormCOpen and if it is true, hides FormA. The method in ClassB that is executed when FormC closes, triggers an event to which FormA has subscribed, and FormA is displayed.
public class FormA
{
public FormA (ClassB)
{
m_ClassB = ClassB;
}
private void ClassA_Load ()
{
subscribe to ClassB ClosedFormC – routine to call: ClassB_ClosedFormC.
}
private void UserSelection_Click()
{
m_ClassB.method1();
If FormCIsOpen
{
Hide();
}
}
ClassB_ClosedFormC()
{
Show();
}
}
public class ClassB
{
public void ClassB()
{
m_FormCOpen = false;
}
public void method1()
{
FormC m_FormC = new FormC();
subscribe to FormC.Closed – method to call FormC_Closed
m_FormCOpen = true;
m_FormC.Show();
do some stuff
}
private void FormC_Closed
{
trigger ClosedFormC
m_FormCOpen = false;
}
bool FormCIsOpen
{
get
{
return m_FormCOpen;
}
}
}
|
|
|
|
|
Hi,
I am not surprised it behaves strangely:
the "code" shown is a complete mess; it is not valid C# code, and it is convoluted.
Why have variables m_FormC, m_FormCOpen and FormCIsOpen all side-by-side ?
It would be much better to have just one m_FormC somewhere, and one method to determine
whether this m_FormC is open or not, rather than having several bools that try to keep
track...
|
|
|
|