Custom Drawn Controls
-
Hi, Using VB.NET. I'm a beginner so please be gentle.. I am trying to overdraw A ListBox control, among others, so that they have a solid 3 pixel border. Currently I am doing this by creating a customcontrol inheriting from the specific windows control i.e. CustomListBox, inherits ListBox... then handling the WndProc and looking for the WM_Paint message. I am then calling the MyBase.OnPaint.. this is to handle all of the item drawing, and on TextBox the text drawing stuff etc... then drawing over the 3DBorder with a solid border of the required colour. However when I do this and the control is resized it flickers quite badly and I want to stop the flickering. I have tried overriding the NC_PAINT message, which works very nicely, until the list box needs scroll bars.. then I am getting very strange results.. I've also tried setting the styles property to DoubleBuffer.. but that didn't seem to make a difference. I'm not even sure that I'm going about this in the right way. Does anyone know of a way to do this sort of thing correctly, or a way to stop the flickering. Any help at all would be appreciated. Even if it's to point me in the direction of a guide or documentation to custom drawing controls Regards and thanks in advance, Rig.
-
Hi, Using VB.NET. I'm a beginner so please be gentle.. I am trying to overdraw A ListBox control, among others, so that they have a solid 3 pixel border. Currently I am doing this by creating a customcontrol inheriting from the specific windows control i.e. CustomListBox, inherits ListBox... then handling the WndProc and looking for the WM_Paint message. I am then calling the MyBase.OnPaint.. this is to handle all of the item drawing, and on TextBox the text drawing stuff etc... then drawing over the 3DBorder with a solid border of the required colour. However when I do this and the control is resized it flickers quite badly and I want to stop the flickering. I have tried overriding the NC_PAINT message, which works very nicely, until the list box needs scroll bars.. then I am getting very strange results.. I've also tried setting the styles property to DoubleBuffer.. but that didn't seem to make a difference. I'm not even sure that I'm going about this in the right way. Does anyone know of a way to do this sort of thing correctly, or a way to stop the flickering. Any help at all would be appreciated. Even if it's to point me in the direction of a guide or documentation to custom drawing controls Regards and thanks in advance, Rig.
I'm sorry that I cannot be of any help, but I would be very grateful for anything you may have learned in changing the border color of a textbox. Many thanks Matt:confused: