|
I'm adding items to a listbox, and want to keep the most recently added (bottom) items visible, but with nothing selected. I'm currently doing it my selecting the last item and immediately clearing the selection, occasionally the two operations happen on oposite sides of a screen refresh and the blue bar flickers momentarily. Is there a better way to do this?
lb.SelectedIndex = lb.Items.Count -1;<br />
lb.SelectedIndex = -1;
|
|
|
|
|
This should be what you need:
this.listBox1.TopIndex = this.listBox1.Items.Add( "FOO!" );
Josh
|
|
|
|
|
Thanks. That property could be named better though, looking at it I'd assume it was an alias for the first element in the list, and not something to control what elements were visible.
|
|
|
|
|
At least it works
|
|
|
|
|
I need a method of capturing as a gif the screen on a WM5.0 device using C#, VS2005. I have done the capture as a bmp however it is very large in size (!40K). I need to be able to send the image over a cell network that charges by the byte so I need a small image.
If there is a tool to convert bmp to gif on the mobile device that would also work for me.
Thanks,
Nick Price
nickprice@canada.com
|
|
|
|
|
In Compact Framework 2.0 you can save a bitmap in different file formats.
---
b { font-weight: normal; }
|
|
|
|
|
Guffa,
Thanks for the response. I'll bet this is an easy process. However, between my thick head and relative newness to C# I have not been able to figure it out and I have been trying for several weeks now.
A few more details, pointers, clues etc would be most helpful!
nickprice@canada.com
|
|
|
|
|
Look at the Bitmap.Save(string, ImageFormat) or Bitmap.Save(Stream, ImageFormat) methods.
---
b { font-weight: normal; }
|
|
|
|
|
Bitmap.Save is not supported in the Compact Framework
|
|
|
|
|
As I wrote in my forst post, it's supported in compact framework 2.0.
---
b { font-weight: normal; }
|
|
|
|
|
When I try to add Bitmap the only options I get are Equals, FromHbitmap and ReferenceEquals.
I have added 'using System.Drawing' and have added a reference to it. Am I still missing a reference?
|
|
|
|
|
No, that is the reference to use.
According to MSDN[^] it's supported.
---
b { font-weight: normal; }
|
|
|
|
|
Thanks Guffa, That's what I needed!
|
|
|
|
|
What makes you think 40k is "very large"?
considering even a (by todays standards) small desktop screen is 640x480x16bpp an uncompressed screen would take up 614k. If your screen is larger then the uncompressed data is even larger.
I realize you are trying to stuff things through a small pipe and trying hard to be economical, but you have to realize that you are already getting some pretty darned good compression. I'm guessing you are already getting about 9:1 compression as it is, changing to GIF may not do much better dependong on how complex your screen is, what resolution you are running bit depth etc.
You may want to take your bmp and convert it over to an LZW compressed GIF by hand once to see if you will get the results you expect or need before going through too much trouble.
You may very well need to come up with a different way of transferring data than just the entire screen if GIF isn't good enough.
FWIW...good luck
|
|
|
|
|
The 40K was a typo, the bmp is actually 140K. When I convert it to a gif on the desktop the gif is only about 4k. What I am doing now is zipping on the handheld then sending it. Zipped it is again about 4k. My customer needs the file on the PC in a format that can be displayed on their web site. I have offered to write a PC app that will check a directory every minute or so for any zip files, unzip what it finds, convert any bmp to gifs and then remove the zip. However, a more elegant approach would be to have the file in a gif format on the handheld to start with. That's what I need help with.
nickprice@canada.com
|
|
|
|
|
Hey,
I have a usercontrol which I have written as a custom button control.
However, everytime my project is rebuilt, the properties for my UserControl are reset to their default values:
<br />
using System.Drawing;<br />
using System.Drawing.Drawing2D;<br />
using System.Data;<br />
using System.Windows.Forms;<br />
<br />
namespace MyControl<br />
{<br />
public class MyControl: System.Windows.Forms.UserControl<br />
{<br />
private Font _font;<br />
<br />
public MyControl()<br />
{<br />
InitializeComponent();<br />
<br />
_font = new Font("Arial", 12);<br />
}<br />
<br />
public override Font Font<br />
{<br />
get<br />
{ <br />
return _font; <br />
}<br />
set<br />
{ <br />
_font = value;<br />
}<br />
}<br />
}<br />
} <br />
Any ideas?
I change the Font in design time, but everytime I rebuild my project, the Font is reset to Arial, 10.
help
MK
"imagine how stupid the average person is ...
now imagine that half the planet is more stupid than that!"
|
|
|
|
|
Try not setting the control's properties in the constructor (especially not after the call to InitComp). That will blow away any user settings every time the control is created. If you want a control's property to have a default value, either use the DefaultValue attribute (for properties of simple types) or use the ShouldSerializeXXX/ResetXXX pattern so that VS.NET knows how to reset the property.
Josh
|
|
|
|
|
hi
i need to read all public methods from an assembly and read the code inside that public method, then i need to write something to that code. is it possible, plz help me
coolsweety
|
|
|
|
|
Look at the PERWAPI from Mono.
|
|
|
|
|
|
can u explain me how this tool can be used
coolsweety
|
|
|
|
|
Hi,
I have two grids and a text box on a form. One grid is the parent & other is the child and two grids are related to each other through a DataRelation object. Whereas the text box is bound to one of the columns of the parent. The only thing that we can add in the parent grid is in its only single column through text box. The problem is that when i try to add new row to the parent grid, the text box does not become blank which it should. Moreover any recors which we add to the child grid dont get updated to the data sources.
Any suggestions, solutions etc...
Regards,
Wasif Ehsan.
|
|
|
|
|
Hi
i have done browser application in winforms its navigates fine,but the problem is popups and new browser window creation.
how to block the popups. if you have experience with this problem plz share with me
Best Regards.,
ranandbe
|
|
|
|
|
|
hai i have work with frameword 1.1 and "AxSHDocVw.AxWebBrowser" this componand so that app., does not work
with Regards.,
ranandbe
-- modified at 8:04 Tuesday 9th May, 2006
|
|
|
|