|
I am trying to implement a blinking listbox that can display individual items in different colors. I have worked out the different colors due to existing samples on this site. However, I am stumped regarding the blink.
I know I will utilize a timer, but I can't figure out how to redraw the individual items that need to blink every time the timer expires.
I am working off the DrawItem event currently to draw the items in the color I want. Is there a way to force this event for a given item (i.e. listbox.item[0].redraw)?
Any help would be greatly appreciated.
Darryl Borden
Principal IT Analyst
darryl.borden@elpaso.com
|
|
|
|
|
You could force OnDrawItem by creating a new event :
this.OnDrawItem(new DrawItemEventArgs(local3, this.Font, local4, local0.itemID, local0.itemState, this.ForeColor, this.BackColor));
(however, because OnDrawItem is protected, you'll have to derive the class).
Or you may go the softer way, by invalidating a region with a Control.Invalidate(...) + Control.Update() (by analogy with WIN32).
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
Thank you for taking the time to reply. I'll try your suggestion!
dpb
Darryl Borden
Principal IT Analyst
darryl.borden@elpaso.com
|
|
|
|
|
I tried the easier of the two methods (invalidate control) and it works great - thanks!.
Is there a way to get the bounds of a specified item in the list box? I am invalidating the whole control, but I would rather not have to redraw everything - just the items that need to blink.
Darryl Borden
Principal IT Analyst
darryl.borden@elpaso.com
|
|
|
|
|
Returns the bounding rectangle for an item in the ListBox.
Rectangle rect = myListBox.GetItemRectangle( nItemIndex );
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
Hi,
I have a Image object as a private member of a class. I then have a tree view file browser which enables the user to browse for an image. I then use Image.FromFile to load the selected image into the member Image class. Once this has completed I have many refresh problems with the rest of the app. The tree view doesn't display correctly, slider bars dont show, etc...
If i change the code to load the Image.FromFile into a local variable then the app works fine.
Anybody seen this before
|
|
|
|
|
Can anyone suggest?
I have C# Standard edition, which under new projects does not provide the ability to start an assembly project. Can it be done without? That is the compiler must be capable of generating the Assembly?
If the answer is yes what I am trying to do is just add some forms to an assembly. Then I want to load that assembly into my application and display the forms the assembly contains. Can anyone point me to a good article on how to do this??
I have the Wrox press Pro C# book but the Assembly section doesn't make it clear how to achieve this.
TIA
Luke
|
|
|
|
|
I can't figure out why you couldn't do things such like :
csc /out:myAssembly.exe myCode.cs
csc /out:myCodeLibrary.dll /t:library myCode.cs
Using such assembly in your code depends on the environment :
- from the IDE, you just add a reference
- from code, you dynamically load the assembly thanks to the *.Assembly namespace
- from configuration, you may create either a manifest file (versioning), or a config file (targetting specific outside assemblies), depending on what you intend to do.
I would suggest these two links : appdomain[^], assemblies[^].
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
Jinwah wrote:
I have C# Standard edition, which under new projects does not provide the ability to start an assembly project.
Assembly = class library
So either chose 1. class library or 2. windows control library.
Cheers
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
I am totally new to the VS IDE, I have always used the Borland IDE's.
Under New > Projects I have 4 options
Windows App
Web App
Web Service
Console App
Under New > File
There are several options not one called Class Library.
I know this is a lame question but I'm just not used to the VS IDE. So how do I start my new class library just add a new Text file and code there?
There is no visible option I can find for 1. class library or 2. windows control library.
TIA (I know I sound really green, but unfamiliarity is the problem, coding is no trouble)
Luke
|
|
|
|
|
Jinwah wrote:
There are several options not one called Class Library.
O ^%^% Thats pretty lame.
Jinwah wrote:
I know this is a lame question but I'm just not used to the VS IDE. So how do I start my new class library just add a new Text file and code there?
Basically start an empty project, then add a class, by rightclicking in the solution explorer. Now, rightclick the project in solution explorer, goto properties. Select output type as class library, once you click apply, you will see the extension becomes ".dll" and you can now reference that assembly, once compiled
Hope this helps
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Hanging head with embarassment...
Thanks for that, still have a problem though.
The project properties sheet does not have an Output Type field. I found the help article but VS isn't displaying as the help file describes.
Are you sure this isn't a limitation because I have the standard edition?
TIA
Luke
|
|
|
|
|
Jinwah wrote:
Are you sure this isn't a limitation because I have the standard edition?
Thats exactly why you don't have that option. That is the limitation of Visual C# Standard (since they can't actually cripple the compiler since it is used by ASP.NET)
James
Sig code stolen from David Wulff
|
|
|
|
|
James T. Johnson wrote:
Thats exactly why you don't have that option. That is the limitation of Visual C# Standard (since they can't actually cripple the compiler since it is used by ASP.NET)
Thats a bit stupid
Can you actually compile a project on the Learning edition?
Cheers
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Are you suggesting that it is still possible, i.e. the IDE doesn't provide the option but the good ole compiler will still compile it, if I go the long way and write the assembly source code.
I'm just trying to learn I don't want to fork out for the Pro edition just to create an assembly. Especially as my assembly is just going to contain some forms, nothing fancy.
Thanks Once Again To All
|
|
|
|
|
I have the standard addition as well and ran into the same problems you have. However the ide is fairly customizable and I was able to add new wizards to create both a class library and the application config files (which are not present in the standard edition). In other words, when I select "add new item" from solution explorer a template is their for the creation of a class library. It's pretty simple. Checkout the following article. Just modify the template for your needs.
http://softwaredev.earthweb.com/msnet/article/0,,10839_1463201_2,00.html
If you need additional help, send me an email. I've got templates already created.
|
|
|
|
|
I thought someone would have come up with something Probably as easy as copying the wizards probably. Not that I ever use any!
Give them a chance! Do it for the kittens, dear God, the kittens!
As seen on MS File Transfer: Please enter an integer between 1 and 2.
|
|
|
|
|
Please, explain how do I use
<br />
ToolBox.ToolBoxTabs.Item(...).ToolBoxItems.Add(..., ... ,vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent) <br />
method in order to add my components into ToolBox.
Thank you in advance,
Pavel
|
|
|
|
|
Sub ToolBoxAddExample()
' This adds a Text item to the first tab of the Toolbox.
' Define the variables and create an object reference to the IDE's
' ToolBox object.
Dim win As Window = DTE.Windows.Item(Constants.vsWindowKindToolbox)
Dim objToolbox As ToolBox = win.Object
Dim colTbxTabs As ToolBoxTabs
' Create an object reference to the ToolBoxTabs object.
colTbxTabs = objToolbox.ToolBoxTabs
' Add a new Text item to the first tab in the Toolbox.
colTbxTabs.Item(1).ToolBoxItems.Add("New Text Item", "Some text to add to the document.", vsToolBoxItemFormat.vsToolBoxItemFormatText)
End Sub
MSDN link[^]
if you start putting in too manay features, it no longer remains useful for beginners
quote in a CP article comment, shiraz baig
|
|
|
|
|
Aaaaaaaaaah! VB.NET in the C# forum! What has the world come to?!?!?! I never thought I'd live to see the day! Run for the hills! Goodbye cruel world....(Just kidding though, I realize that for anyone developing macros that we must use VB.NET )
Norm Almond: I seen some GUI's in my life but WTF is this mess
Leppie: I made an app for my sister and she wouldnt use it till it was colorful enough
Norm:good point leppie, from that statement I can only deduce that this GUI must be aimed at children
Leppie:My sister is 25
-Norm on the MailMagic GUI
|
|
|
|
|
can you give me an idea if there is a way to draw a line with net and then when I click on it to be able to change it?
I want to use the image classes in .NET.
|
|
|
|
|
I think the best method is to draw your cad data with OpenGL, because you can implement zooming, moving, ... very easy and use some click events on some objects, like lines, points and so on.
--
Nice greets, Daniel.
|
|
|
|
|
Maybe with a metafile?? the only problem would be hit testing for the elements...
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
Luis Alonso Ramos wrote:
the only problem would be hit testing for the elements...
OpenGL supports hit testing very good.
--
Nice greets, Daniel.
|
|
|
|
|
this line of code
IFormatter formatter = new BinaryFormatter();Stream stream = new FileStream("MyFile.bin", FileMode.Create, FileAccess.Write, FileShare.None);formatter.Serialize(stream, obj);stream.Close();
alwas write data at the end of file or not ?
i mean there are alot of Objects .
where it write in the file?
this line of code
object obj = formatter.Deserialize(stream);
alwas read data from the begining of file or not ?
i mean there are alot of Objects.
where it read from the file?
r00d0034@yahoo.com
|
|
|
|