
aewarnick
Avatar/Signature-
Posts
1052 -
Joined
-
Last visited
Content Type
Profiles
Forums
Blogs
Events
Articles
Resources
Downloads
Gallery
Everything posted by aewarnick
-
Can you post the code?
-
My MB (custom messageBox) never shows! protected override void AddItemsCore(object[] o) { a.MB.ShowDialog(o.GetType()); if(o.GetType() == typeof(FileLBItem)) this.Items.Add(o); return; } protected override void SetItemsCore(IList o) { a.MB.ShowDialog(o.GetType()); if(o.GetType() == typeof(FileLBItem)) this.Items.Add(o); return; } protected override void SetItemCore(int i, object o) { a.MB.ShowDialog(o.GetType()); if(o.GetType() == typeof(FileLBItem)) this.Items.Add(o); return; } I am trying to check if the Item that is added to the listbox is of a certain type before I add it. But none of these methods do anything at all. I know I didn't call the base methods in the code above but I do have it in my code here at home. Is there any way to check the items BEFORE they are added to the ListBox?
-
another Transparent Controls question :/
aewarnick replied to NeOBz's topic in Graphics and Multimedia
"an animating bitmap, and I want text to appear in front of that" Every time the image in the picturebox changes you must redraw the text. -
To convert any variable to a string either put +"" after it or ToString() To limit the amout of times a user inputs data, use a couple global variables along with the TextChanged event. When the user starts typing set a bool variable to true and then in a buttonClick event or whatever you are using for the user to submit one box check if the bool variable is true, set it back to false, then increment a global counter variable: ++count.
-
The only way I can think of is to handle KeyDown and add an extra space when e.KeyCode==(int)Keys.SpaceBar.
-
Correct.
-
You're right! I had no idea. I saw something on CodeProject about making gif animation but they didn't mention the picturebox.
-
another Transparent Controls question :/
aewarnick replied to NeOBz's topic in Graphics and Multimedia
this.LL.BackColor= Color.FromArgb(0,0,0,0); You don't need to inherit or use SetStyle. -
Cannot save custom ListBox to disk.
aewarnick replied to aewarnick's topic in Directory / File IO / Registry
What was I thinking! All I have to do is save the Items property to disk! That is all I need! Thanks VolteFace. Although that does not work unless I first put the items into my own Array and save them. No problem though. -
how to Invalidate Tab Control when the Form is Maximize ?
aewarnick replied to loyal's topic in Windows Forms
When you override, you must call the base class. You are also overriding the Form's OnResize not the TabControls. You must make a custom TabControl inheriting form TabControl. public class TB : TabControl { } Remember to check for an empty Rectangle. One with (anything, anything, 0, 0). -
Cannot save custom ListBox to disk.
aewarnick replied to aewarnick's topic in Directory / File IO / Registry
You're saying I need to take it apart and put it back together? A small explanation of how to strip it and put it back together would be helpful. Just so I have some direction. If you would, VolteFace. -
how to Invalidate Tab Control when the Form is Maximize ?
aewarnick replied to loyal's topic in Windows Forms
It's in my code above. In Resize call Invalidate(); -
how to Invalidate Tab Control when the Form is Maximize ?
aewarnick replied to loyal's topic in Windows Forms
I just saw your title more closely. Take a look at this Form class it probably does what you want and more. Ignore all the junk. At the bottom you will probably see the answer to your problem. /// <summary> /// Inherits from Form and has additional features including the ability to center an image on the form at all times with transparency if you want. You can also paint the background with any brush you want. /// </summary> public class aForm : Form { /*public class FormBrush { public FormBrush(){} FormBrush FB=new FormBrush(); public FormBrush Brush { get{return FB;} set{FB=value;} } } /// <summary> /// Colors the BackGround of the Form. /// </summary> [ TypeConverter(typeof(ExpandableObjectConverter)) ] public class brush { Color c1= a.Colors.aControl; Color c2= a.Colors.aControl; Rectangle fiStartEndArea=new Rectangle(0,0,100,100); int rot=20; //----------------------------- public brush(Color color1, Color color2, Rectangle fillStartEndArea, int rotation) { Color1= color1; Color2= color2; FillStartEndArea= fillStartEndArea; Rotation= rotation; } public brush(Color color1) { Color1= color1; Color2= color1; } public brush() { } //----------------------------- public Color Color1 { get{return c1;} set{c1=value;} } //----------------------------- public Color Color2 { get{return c2;} set{c2=value;} } //----------------------------- public Rectangle FillStartEndArea { get{return fiStartEndArea;} set{fiStartEndArea=value;} } //----------------------------- public int Rotation { get{return rot;} set{rot=value;} } } //end class FormBrush //----------------------------*/ Brush backgrdBrush=null; Image backgrdImage=null; int backgrdImageTransp=100; bool controlsTransp=true; bool controlsTranspInclBut=false; /// <summary> /// If some controls are not being colored right you may be able to figure out why. /// </summary> public string Errors="Check to see if the FormBorderStyle is set to 3D.\n\n"; /// <summary> /// A brush to paint the background any color you want. Will always be behind the image. /// </summary> public Brush BackgrdBrush { get{return backgrdBrush;} set{backgrdBrush=value; this.Invalidate();} } /// <summary> /// Places an image in the center of the form keeping its proportions. /// </summary> public Image BackgrdIm { get{return backgrdImage;} set{backgrdImage=value; this.Invalidate();} } /// <summary> /// Sets the transparency percent to the backgrdImage. 0 is clear. If the image is not transparent at all the painting will draw faster: 100. /// </summary> public int BackgrdImTransp { get{return backgrdImageTransp;} set{backgrdImageTransp=value; this.Invalidate();} } /// <summary> /// Set to false if you want the controls on the form to take on the BackColor of the form. /// </summary> public bool ControlsTransp { get{return this.controlsTransp;} set{this.controlsTransp=value; this.Invalidate();} } /// <summary> /// You want your buttons to be transparent too. /// </summary> public bool ControlsTranspInclBut { get{return this.controlsTranspInclBut;} set{this.controlsTranspInclBut=value; this.Invalidate();} } //------------------------ public aForm() { this.SetStyle(ControlStyles.DoubleBuffer, true); this.SetStyle(ControlStyles.AllPaintingInWmPaint, true); this.SetStyle(ControlStyles.UserPaint, true); this.BackColor= a.Colors.aControl; } //------------------------ protected override void OnPaint(PaintEventArgs e) { e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic; base.OnPaint(e); if( (controlsTransp || controlsTranspInclBut) && (this.backgrdBrush != null || this.backgrdImage != null) ) { if(controlsTranspInclBut) { foreach(Control c in this.Controls) { try { if(c is Label || c is GroupBox || c is Panel || c is LinkLabel || c is Button || c is CheckBox || c is RadioButton) ((Control)c).BackColor= Color.FromArgb(0,0,0,0); /*else if(c is TabControl) { foreach(TabPage tp in ((TabControl)c).TabPages) tp.BackColor= Color.FromArgb(0,0,0,0); }*/ } catch(Exception er) { this.Errors+= er+"\n\n"+c+"\n\n"; } } } else { ArrayList buttonsList= new ArrayList(2); ArrayList buttonsColorList= new ArrayList(2); foreach(Control c in this.Controls) { try { if(c is Label || c is GroupBox || c is Panel || c is LinkLabel || c is CheckBox || c is RadioButton) ((Control)c).BackColor= Color.FromArgb(0,0,0,0); else if(c is TabControl) { foreach(TabPage tp in ((TabControl)c).TabPages) { foreach(Control tc in tp.Controls) { if(tc is Button) { buttonsList.Add(tc); buttonsColorList.Add(tc.BackColor); } } tp.BackColor= Color.FromArgb(0,0,0,0); for(int i=0; i<buttonsList.Count; i++) { ((Button)buttonsList[i]).BackColor= ((Color)buttonsColorList[i]); } } } } catch(Exception er) { this.Errors+= er+"\n\n"+c+"\n\n"; } } } } try { if(this.backgrdBrush != null) { //LinearGradientBrush LGB=new LinearGradientBrush(this.backgrdBrush.FillStartEndArea, this.backgrdBrush.Color1, this.backgrdBrush.Color2, this.backgrdBrush.Rotation); e.Graphics.FillRectangle(this.backgrdBrush, this.ClientRectangle); } if(this.backgrdImage != null) { Size ImSize= a.graphics.ProportionalSize(backgrdImage.Size, new Size(this.ClientRectangle.Width, this.ClientRectangle.Height)); Rectangle centerR= a.graphics.CenterRect(this.ClientRectangle, ImSize); if(this.backgrdImageTransp != 100) { ImageAttributes IA = a.graphics.TrasparentImage(backgrdImageTransp); e.Graphics.DrawImage(backgrdImage, centerR, 0, 0, backgrdImage.Size.Width, backgrdImage.Size.Height, GraphicsUnit.Pixel, IA); } else e.Graphics.DrawImage(backgrdImage, centerR, 0, 0, backgrdImage.Size.Width, backgrdImage.Size.Height, GraphicsUnit.Pixel); } } catch(Exception er) { this.Errors += er+"\n\n"; } } //------------------- protected override void OnResize(EventArgs e) { base.OnResize(e); if(this.backgrdBrush != null || this.backgrdImage != null) this.Invalidate(); } } -
how to Invalidate Tab Control when the Form is Maximize ?
aewarnick replied to loyal's topic in Windows Forms
Are you changing the size of the Brush on Form_Resized? If you are, just prevent the Brush from being created with a 0 Rectangle. All Invalidate does is tell the Window or control to redraw itself. I myself have never used Refresh, but I'm sure it has it's purpose. -
Retrieve active control, check if it is a textbox and insert text.
aewarnick replied to Spyru's topic in Windows Forms
Me.Width and Me.Height Me.ClientWidth and Me.ClientHeight - without title bar. When you get that type of exception it means that one of your variables is nothing. It has been declared but has no value at all. -
Retrieve active control, check if it is a textbox and insert text.
aewarnick replied to Spyru's topic in Windows Forms
.net languages are very similar. You can probably translate to make your own code. -
Retrieve active control, check if it is a textbox and insert text.
aewarnick replied to Spyru's topic in Windows Forms
this.Text.Insert(10, "Insert this at index 10"); -
Retrieve active control, check if it is a textbox and insert text.
aewarnick replied to Spyru's topic in Windows Forms
Here is one snippet: foreach(Control c in this.Controls) { try { if(c is Label || c is GroupBox || c is Panel || c is LinkLabel || c is CheckBox || c is RadioButton) ((Control)c).BackColor= Color.FromArgb(0,0,0,0); Here is a full method: /// <summary> /// Returns the focused control on a form. If you want only the focused control of a panel or tab page ext. /// Just make f null and send a control to the method otherwise make c null and send a whole form. Returns /// null if no control is focused. /// </summary> public static Control GetFocusedControl(Form f, Control c) { if(f != null) { foreach(Control d in f.Controls) { if(d.Focused) { FocusedControl= d; } else { GetFocusedControl(null, d); } } } else if(c != null) { foreach(Control d in c.Controls) { if(d.Focused) { FocusedControl= d; } else { GetFocusedControl(null, d); } } } return FocusedControl; } -
Cannot save custom ListBox to disk.
aewarnick replied to aewarnick's topic in Directory / File IO / Registry
With some more testing I am guessing that everything within the class must be Serializable. So what I am trying to do is not possible. If not correct post back. -
[serializable] public class ImageLB : ListBox {} That is my custom ListBox class. When I create a new instance of it and try to save it using the BinaryWriter it says ListBox is not serializable. I want to save my entire ListBox (ImageLB) to disk with all it's items and properties. Is this possible?
-
You may want to post this question in the asp section. I know nothing about it yet.
-
How to avoid image Flickering in VB.NET?
aewarnick replied to Juliano's topic in Graphics and Multimedia
That makes sense...only becasue when using SetStyle you have the choice of whether you want it set or not using the bool value. I am pretty sure then that you can switch DoubleBuffing on and off any time you want. -
How to avoid image Flickering in VB.NET?
aewarnick replied to Juliano's topic in Graphics and Multimedia
Store your tick value and Box size Rectangle value in global variables at the top of the Form, below the Form class. -
You'll get better results just using google and looking it up.