|
The problem is that I have a lot of spinners, and I don't think it's very efficient to create a variable for every single one of them...
|
|
|
|
|
You'd be storing an integer variable for each of them. Unless you have thousands of numeric up down controls, the performance hit would be negligible.
|
|
|
|
|
hi ..
this is my code to set ImageIndex of my button :
ImageList list = new ImageList();
System.Drawing.Icon _icon = new Icon("PRINTERS11.ico");
list.Images.Add(_icon);
button1.ImageList = list;
button1.ImageIndex = 0;
but my Icon is very small in button and i can not resize :
button1.ImageList.Images[0].Size
because it's readonly . How to set size of My icon in button ??
thanks
|
|
|
|
|
You need to copy it onto a bitmap that is bigger, of course this will make it jagged in appearance.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Dear all,
I made a custom control (a type of thumbnail with labels, buttons, ..) and I would like them to be in a list(box). Is this possible? And if yes (please do), how can I do this? Can I add it as some "item object", and add that to the list?
Thank you,
Michael
www.code.ae
|
|
|
|
|
With Windows Forms, you can, but the list box won't show them; it'll just show the .ToString version of the custom control. Note that with the WPF toolkit this is possible.
AFAIK, in order to do that, you'll probably need to inherit a control from ListView and draw your items manually in the list. Not fun.
|
|
|
|
|
I am having great difficulty in marshalling from VB6 to C#. What I need to be able to do is marshall a VB6 Type aka UDT holding a number of fields into C#. Is this possible? If not then I will need to change the legacy code to use a class rather than a UDT.
|
|
|
|
|
Further to my first post above. I went the route of instantiating an object in VB6 that has a number of public fields of type Currency. Successfully created a .NET TypeLib with TLBIMP and can marshall my VB6 object accross to C# but when I tried to access the field value I got an invalid cast exception. Does this mean that I will have to write the ODL information within my C# class rather than use the TLBIMP tool so that I can then marshall the field data from unmanaged type 'Currency' to Decimal?
Or is there an easier way to marshall accross from VB6 to C# and back? Any help will be much appreciated.
|
|
|
|
|
Greetings!
I have been using the System.Management object in a Visual Studio 2003 C# application to access Microsoft DNSS entries. The problem I have encountered is with TXT records which have multiple string entries ("A DNS TXT record can be up to 65535 (0xFFFF) bytes long"). Microsoft supports this just fine, for example, I have a TXT record with the following string values:
KeyA=ValueA
KeyB=ValueB
KeyC=ValueC
KeyD=ValueD
KeyE=ValueE
KeyF=ValueF
KeyG=ValueG
KeyH=ValueH
Microsoft DDNS has no problem with this. But when I retrieve the TXT record with:
(ObjectQuery oQ = new ObjectQuery("select * from MicrosoftDNS_TXTType where OwnerName=...");
the WMI query returns in the following:
OwnerName: aaatesttxtrec.domain.com
RecordData: "KeyA=ValueA" "KeyB=ValueB"
DescriptiveText: KeyA=ValueA
TextRepresentation: aaatesttxtrec.domain.com IN TXT "KeyA=ValueA" "KeyB=ValueB"
(changing the domain name to protect the guilty)
Now, I would be a whole lot less confused if the WMI query had only returned the first value string (or, if the total length of the returned values was less than 64, the maximum length for a single TXT value string).
So why am I only getting the first two (of eight) data strings from the TXT record? Is this a bug in the .NET WMI interface, or am I doing something horribly wrong?
Thank you'all for any help you may be able to offer!
Grant V. Morse
|
|
|
|
|
Hi
i have a made an app where you can draw things like lines graphics etc.,the problem is that when i save it there are no lines in bitmap, though all the physiacal controls like labels are there , but no lines or graphics why?
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
How do you keep the information about the graphics, and what do you do to save it?
---
b { font-weight: normal; }
|
|
|
|
|
Acrually only lines disappear as they are drawn using GDI, i have saved the start and end point of the line in an rraList, the lines are not coming rest evrything is there, they are redrawn on page invalidation,sohelp if any solution out
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
Ok, but what do you do to save it, then?
---
b { font-weight: normal; }
|
|
|
|
|
Bitmap bp = new Bitmap(900, 800);
MainPanel.DrawToBitmap (bp,new Rectangle(0,0,900,800));
bp.Save(filename + ".bmp");
Mainpanel is the panel where al work is done and 900*80 is the size
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
If you would have used the Paint event to draw the lines, as I told you in the previous thread, the lines would have been drawn to the bitmap. As you say that they aren't, you can't be doing that.
I don't mean to sound harsh, but if you don't follow advice, what would be the point of giving any further advice?
---
b { font-weight: normal; }
|
|
|
|
|
hi
I am doing it in OnPaint event and i even redraw them on invalidation, the problem has been solved by christian's suggestion,actually the lines are drawn on screen pixels and objects lie on the panel, so you need to make a bitmap in memory and draw those line son to the bitmap and save it
thanks and regards
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
What control's paint event is it that you use, then?
Are you using the graphics object that is supplied to you in the event attributes, or are you creating a completely new graphics object? If you don't use the graphics object that is supplied, you will always be drawing to the screen, even when the DrawToBitmap is trying to make you draw to the bitmap.
If you do it correctly, there is no need to draw the lines to the bitmap separately.
---
b { font-weight: normal; }
|
|
|
|
|
ssoffline wrote: but no lines or graphics why?
Because they are not on the bitmap, you must be drawing them on top of the bitmap, direct to the screen.
That seems obvious, but beyond that, it's impossible to answer without seeing the code ( and the code you posted doesn't count, it doesn't show how/where the lines are being drawn )
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Point ps = new Point(l1.Source.X - 110, l1.Source.Y - 50);
Point pd = new Point(l1.Destination.X - 110, l1.Destination.Y - 50);
Graphics graph = this.MainPanel.CreateGraphics();
Pen penCurrent = new Pen(Color.Red,4);
penCurrent.EndCap = LineCap.ArrowAnchor;
graph.DrawLine(penCurrent, ps, pd);
penCurrent.Dispose();
This is the code for line drawing, these are drawn no a panel which is located at 110,50 hence the adjustments, or u mean to save here that i should save the form, i tried saving the whole form but then also i have no lines
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
ssoffline wrote: these are drawn no a panel which is located at 110,50
OK, why are you using a Panel ? Surely you should be creating a bitmap in memory, drawing it in your paint method, and drawing onto that bitmap. If you're not drawing onto a Bitmap, how are you hoping to save it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
i am using a panel because my app is used for making diagrams, so al objects other than lines are user controls, and secondly how to do that in memory,Do you mean that i shoul draw lines manually on the bitmap i am gonna save?
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
ssoffline wrote: so al objects other than lines are user controls
No, they should be different classes with a common base class, which are used to draw the objects on your main control.
ssoffline wrote: Do you mean that i shoul draw lines manually on the bitmap i am gonna save?
Yes, obviously. If you don't draw lines on the bitmap, when you save the bitmap, they aren't going to be there, are they ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
ok thanks i 'll try and tell
also i posted earlier today how to make lines resizable?
i mean i should be able to select them like controls and resize with mouse?
i can move them but how to resize?
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|
|
ssoffline wrote: i mean i should be able to select them like controls and resize with mouse?
The way to do this is to create a struct that defines each item. Then keep them in a list, and render them from that list. when the user clicks, you iterate over the list and see if an item was selected. If so, you change the attributes of that object in the list when the user drags or whatever.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
hi
thanks for previous suggestions, i am already doing the same only, in fact i can save and compile my diagram and even reopen it using XML, my problem is how to show those selected points as are shown in windows form editor around that graphics object, of course if it becomes selectable like other controls then resizing is no big thing.
Sameer Sood
Microsoft Student partner
NIT Durgapur,india
|
|
|
|