|
I am displaying all members of class Test:
Type ClassType = typeof(Test);
MemberInfo[] Members = ClassType.GetMembers();
foreach(MemberInfo Member in Members)
{
Writer.WriteLine("<" + Member.Name + ">" + <big>???</big>));
}
and I would like also to display in the same foreach loop values of these members of given object Test. How to make it?
|
|
|
|
|
Make the function recursive, and keep calling it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I cannot see a difference... I must display a value of a member, but this member is different each time.
|
|
|
|
|
Because you don't know how deep you need to go, the program decides for you, by calling itself until there are no more properties to display.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
but how this function should know which member is to be showned?
|
|
|
|
|
It needs to change from it's current signature to take an object and use reflection to work out what the properties are on the object, and what the object is.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
hmm... but still, I don`t know how to display the value of the member after using reflection...
Maybe could you support your post with code/pseudo-code of that function?
anyway, tnx for your time
|
|
|
|
|
Oh, sorry. I thought you wanted to walk objects that were properties and had properties. You want to walk the objects you're walking now, and get their values. Try this[^] article for info.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
use recursive function function which call its self
MCAD
-- modified at 18:03 Monday 5th September, 2005
|
|
|
|
|
Hi,
I'm trying to find a way to do something like CustomDraw in a Windows.Forms.ListView.
What I want to do is: reuse the scrolling, selection, and column resizing, but draw each "cell" manually.
I found references to Owner/CustomDraw only in .NET 2.0 (that's VS8, right? )
Is this possible?
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
The only way I know of with 1.1 is to subclass ListView and override the WndProc method and listen for the relevant messages (like you would with a non .Net app). This article[^] is a pretty good example.
"I think I speak on behalf of everyone here when I say huh?" - Buffy
|
|
|
|
|
Hello All,
I am tring to redrew the button to be a Circleur button. but affte i did it there is a rectangle apper when i click the button.
How can i remove this rectangle or disable it?
Regards
Hay
|
|
|
|
|
Hello Hay,
I think you just have to change the Property "FlatStyle" from "Flat" to "Popup", "Standard" or "System".
Good luck
Martin
|
|
|
|
|
Thanks Martin
I did it but there is still doted rectangle apper when i click to the button.
Regards
Hay
|
|
|
|
|
this is a focus rectangle which appear when buttn have Focused if you make your button circular by set its region
the focus rectangle will still appear
Do You Inherit youe control from button ?if yes you need to handle focus staff in your painting functions like draw circle instead rectangle when your control have the focus orany thing else
MCAD
|
|
|
|
|
Hello everybody!
In my VS2003 Windows application, I created an instance of a Form during runtime.
I then whant to use it with the ShowDialog method.
everything worked fine, until I whanted to set the Witdh of the Form smaller then 112 pixel.
Can I block this limitation?
Thank you for your time.
Martin
|
|
|
|
|
There are minimum and maximum size properties, perhaps they are set ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How can I change the Frame color of a textbox?
|
|
|
|
|
I was wondering the same thing myself, and ended up just changing the BorderStyle to None, and drawing a simple border myself in the parent form/user control with a function like:
private void DrawTextBoxBorder(Graphics g)
{
Rectangle rectClient = myTextBox.ClientRectangle;
Rectangle rect = myTextBox.RectangleToScreen(rectClient);
rect.Offset(-1,-1);
rect.Width += 1;
rect.Height += 1;
Point ptClient = new Point(0,0);
Point ptScreen = PointToScreen(ptClient);
rect.Offset(-ptScreen.X, -ptScreen.Y);
g.DrawRectangle(Pens.SlateGray, rect);
}
|
|
|
|
|
Inherit your class from TextBox Overrid OnPaint and set
ControlStyle to UserPaint use The Following Class as start
public class TextBoxEx :TextBox
{
private Color borderColor;
public TextBoxEx()
{
this.SetStyle(ControlStyles.UserPaint,true);
this.BorderStyle=BorderStyle.FixedSingle;
borderColor=Color.Red;
}
public Color BorderColor
{
get
{
return borderColor;
}
set
{
borderColor=value;
}
}
protected override void OnBorderStyleChanged(EventArgs e)
{
this.BorderStyle=BorderStyle.FixedSingle;
base.OnBorderStyleChanged (e);
}
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint (e);
ControlPaint.DrawBorder
(e.Graphics,e.ClipRectangle,borderColor,ButtonBorderStyle.Solid);
}
MCAD
|
|
|
|
|
void DrawComplexNumber(double re_, double im_)
{
//What code in here creates a Graphics obj?
}
thanks
|
|
|
|
|
Al drawing should be done in an OnPaint Handler. OnPaint gets called when the form/control needs to be painted again (ew.g. another window was moved above it)
If you call DrawComplexNumer from an OnPaint handler, simply pass the Graphics object as additional parameter.
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
Where you want to draw form,PictudeBox?
MCAD
|
|
|
|
|
|
i mean the surface you want to draw on it?
MCAD
|
|
|
|