|
|
Hi,
First of all I found lot of article about this. Iam trying to solve it about few days without results.
I work on aplication, which should be something like report editor for printing.
I have a form with two scroll bars, grid and two rulers. Rulers and grid are User Controls.
For both controls I call:
Me.SetStyle(ControlStyles.AllPaintingInWmPaint + ControlStyles.UserPaint + ControlStyles.Opaque _
+ ControlStyles.OptimizedDoubleBuffer, True)
UpdateStyles() befor drawing.
The grid drawing function:
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
Dim rcPaper = New Rectangle(nGrid * nPaperOffset, nGrid * nPaperOffset, _
nPaperWidth, _
nPaperHeight)
Dim bmp As New Bitmap(Me.ClientSize.Width, Me.ClientSize.Height)
Dim graph As Graphics
graph = Graphics.FromImage(bmp)
' Draw paper
rcPaper.Location = rcPaper.Location + ptScrollOffset
graph.Clear(Color.DarkGray)
graph.FillRectangle(Brushes.White, rcPaper)
graph.DrawRectangle(Pens.Black, rcPaper)
' Draw the grid.
If bShowGrid Then
For x As Integer = 0 To bmp.Width Step nGrid
For y As Integer = 0 To bmp.Height Step nGrid
graph.DrawLine(m_PenGrid, x, y, x + 0.5F, y + 0.5F)
Next y
Next x
End If
e.Graphics.DrawImage(bmp, 0, 0)
' Free object added
bmp.Dispose()
graph.Dispose()
Debug.Print("Grid:OnPaint")
End Sub Ruler draw function:
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
'MyBase.OnPaint(e)
Dim bmp As New Bitmap(Me.Width, Me.Height)
Dim graph As Graphics
graph = Graphics.FromImage(bmp)
graph.Clear(Color.White)
Dim rStRect As SizeF
Dim pOrigin As New PointF
Dim string_format As New StringFormat
If eStyle = ERulerStyle.rHorizontal Then
' Horizontal ruler
Dim y1 As Integer = Me.ClientSize.Height
Dim y2 As Integer = (2 * Me.ClientSize.Height) \ 3
Dim y3 As Integer = Me.ClientSize.Height \ 3
Dim y4 As Integer = 0
Dim x As Integer = 0
For i As Integer = 0 To Me.ClientSize.Width \ nGrid
If (i + nPaperOffset) Mod nStepsPerUnit = 0 Then
'If i > 0 Then
pOrigin.X = x
pOrigin.Y = y4
string_format.Alignment = StringAlignment.Center
rStRect = graph.MeasureString(CStr((i - nPaperOffset) / nStepsPerUnit), dFont, pOrigin, string_format)
graph.DrawString(CStr((i - nPaperOffset) / nStepsPerUnit), dFont, dBrush, _
x - rStRect.Width / 2 + 1 + ptScrollOffset.X, _
y4 + ptScrollOffset.Y)
ElseIf (i + nPaperOffset) Mod (nStepsPerUnit / 2) = 0 Then
graph.DrawLine(m_PenGrid, x + ptScrollOffset.X, y1 + ptScrollOffset.Y, _
x + ptScrollOffset.X, y3 + ptScrollOffset.Y)
ElseIf (i + nPaperOffset) Mod (nStepsPerUnit / nTicksNum) = 0 Then
graph.DrawLine(m_PenGrid, x + ptScrollOffset.X, y1 + ptScrollOffset.Y, _
x + ptScrollOffset.X, y2 + ptScrollOffset.Y)
End If
x += nGrid
Next i
' Show the mouse position.
If bSelecting Then
graph.DrawLine(m_PenRulerDrawing, nX, y1, nX, 0)
Else
graph.DrawLine(m_PenRulerNormal, nX, y1, nX, 0)
End If
Else
' Vertical ruler
Dim x1 As Integer = Me.ClientSize.Width
Dim x2 As Integer = (2 * Me.ClientSize.Width) \ 3
Dim x3 As Integer = Me.ClientSize.Width \ 3
Dim x4 As Integer = 0
Dim y As Integer = 0
For i As Integer = 0 To Me.ClientSize.Height \ nGrid
If (i + nPaperOffset) Mod nStepsPerUnit = 0 Then
If i > 0 Then
pOrigin.X = x4
pOrigin.Y = y
string_format.Alignment = StringAlignment.Center
rStRect = graph.MeasureString(CStr((i - nPaperOffset) / nStepsPerUnit), dFont, pOrigin, string_format)
graph.DrawString(CStr((i - nPaperOffset) / nStepsPerUnit), dFont, _
dBrush, x4 + (nWidth - rStRect.Width) / 2 - 2 + ptScrollOffset.X, _
y - rStRect.Height / 2 + ptScrollOffset.Y)
'e.Graphics.DrawLine(m_PenGrid, x1, y, x4, y)
End If
ElseIf (i + nPaperOffset) Mod (nStepsPerUnit / 2) = 0 Then
graph.DrawLine(m_PenGrid, x1 + ptScrollOffset.X, y + ptScrollOffset.Y, _
x3 + ptScrollOffset.X, y + ptScrollOffset.Y)
ElseIf (i + nPaperOffset) Mod (nStepsPerUnit / nTicksNum) = 0 Then
graph.DrawLine(m_PenGrid, x1 + ptScrollOffset.X, y + ptScrollOffset.Y, _
x2 + ptScrollOffset.X, y + ptScrollOffset.Y)
End If
y += nGrid
Next i
' Show the mouse position.
If bSelecting Then
graph.DrawLine(m_PenRulerDrawing, x1, nY, x4, nY)
Else
graph.DrawLine(m_PenRulerNormal, x1, nY, x4, nY)
End If
End If
e.Graphics.DrawImage(bmp, 0, 0, Me.ClientSize.Width, Me.ClientSize.Height)
' Free object added
bmp.Dispose()
graph.Dispose()
Debug.Print("Scroll:OnPaint")
End Sub I handle scroll event like this:
Private Sub OnVScroll(ByVal sender As Object, ByVal e As ScrollEventArgs) Handles VScrollBar1.Scroll
ctrlVRuler.ScrollRuller(, e.NewValue)
'Debug.Print("Call ctrlVRuler.Invalidate")
'ctrlVRuler.Invalidate()
ctrlMyGrid.ScrollPaper(, e.NewValue)
'Debug.Print("Call ctrlMyGrid.Invalidate")
'ctrlMyGrid.Invalidate()
' Invalidate "parent" control
Invalidate(true)
End Sub
Then while I am running appliation and scrolling I get this text in Inmediate window:
Grid:OnPaint
Scroll:OnPaint
Grid:OnPaint
Scroll:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Scroll:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Grid:OnPaint
Scroll:OnPaint
The candency of Grid repaint is rapidly bigger.
I am quit sure I call redraw (invalidate) just from scroll event during scrolling.
What do you think about this? How can I tell GDI+ to finish one controls re-drawing and then start other?
modified on Wednesday, October 28, 2009 4:10 AM
|
|
|
|
|
I probably wouldn't be able to answer your problem even if I could read your code but I'll never know because I can't read it.
Please, please, please edit your post, highlight the code part and then click the '
code block ' widget just above the Text: box. Then apply some indentation and spacing to make the code more readable. Alternatively delete the code hit the code block widget and then cut the code from your editor and paste it between the tags added when you clicked the widget.
You are far more likely to get an answer if you do that.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
|
|
|
|
|
Yes I see. I removed it from another thread copy/past and that causes that it lost formating.
|
|
|
|
|
cheers,
first of all i'm wondering why you create your own graphics object at each run of OnPaint, beware because you need to destroy your created object with graph.Dispose().. and the PaintEventArgs already gives you the Graphic object!! graph = e.Graphics!!
second the OnPaint Method will run if your Form or Control you are overriding the OnPaint will repaint.
To draw an image of the Grid do not use the OnPaint method on the Form! here you would paint something for the grid and not for subcontrols.. Create a Function GetGridImage() or some like.. that you will call if you want to get an net image of the grid..
third in the Scroll.OnPaint you can call Invalidate for the Owner Control to force the re-draw, please take a look at some usercontrols created from other users here to understand how to use the OnPaint methods.. in your Case the OnPaint will nothing paint on the grid so this is nesty! the function will be called every time you move your mouse or the owner control will be repainted.
hope i could help!
bless
|
|
|
|
|
So I will answer also in points.
For first:
I tried to draw with double buffer method. I found on internet something like this. I added dispose for bmp and grap objects. Doesn't help.
For second:
I am not sure if I understand what did you write. I try to explain it one more time. I have grid control (with its own drawing function). Later grid control will also draw some other objects, like text boxes, etc... So the main form uses its own OnPaint (without overwriting or handling, ruler and grid have its own overwritten OnPaint method).
For third:
I replaced two Invalidate (for each control) with one invalidate(true) for owner form. Doesn't help. Can you give me some good example of how to use overwriting of usercontrol OnPaint ?
From my point of view it looks like ctrGrid control receive an event to repaint itself. Meanwhile (lets say in same time) ctrlRuler receive an event to repaint itself.
Re-painting of grid (due drawing huge rectangles) takes longer time. During this time will come another request to repaint both controls. And it happens that, the only grid control is repainted.
I don't know why grid control has bigger cadence of of re-painting, maybe it was added to owner form first.
I also hope you will help.
|
|
|
|
|
aaalllriiiight i did not see the dispose in your code sorry
now i can read it much better ^^
in case your paper has a size of 2000x1000 but your controlsize is only 200x100 you draw the created bitmap on the control, so every time the OnPaint is called you will draw the hole paper (2000x1000) instead of only a region of the hole paper (size of 200x100, at Location.Y=1200, Location.X=1500) this needs a lot of time and the result will not be displayed..
i would need to see the hole project to understand your code logic and to face out why paint events will be raised too much..
|
|
|
|
|
In fact repainting is slow just when I call
graph.Clear(Color.DarkGray)
Grid size: 803x442
Parent size: 853x508
Where can I send an email ?
|
|
|
|
|
hmm i would apprechiate if you would upload to codeproject or some else and send me a link to download the file..
try to use FillRectanlge(graph rect, color.darkgray) instead of clear this might be a lot faster. your graphic object is empty and i think clear performs more than setting the color..
greetz
|
|
|
|
|
I think to upload code here, I need to create an article.
So I created another simple example.
I have Form1.vb and UserControl1.vb.
Form1 size is 980x700.
On Form1 are two UserControl1 Picture1 (300x600) and Picture2(600x600).
Code for Form1:
Public Class Form1
'Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
' Invalidate(True)
'End Sub
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
HScrollBar1.Minimum = 1
HScrollBar1.Maximum = Me.ClientSize.Width
HScrollBar1.LargeChange = 100
End Sub
Private Sub MyScroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
'Static t_start As DateTime = Now
'Dim t_span As TimeSpan
'Debug.Print("Elapsed time: " && t_span.Milliseconds)
't_start = Now
Invalidate(True)
End Sub
End Class
For usercontrol1
Public Class UserControl1
Private Sub OnPaintPic1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim rcPaper = Me.ClientRectangle
Dim time_start As DateTime = Now
Dim t_span As TimeSpan
Dim bmp As New Bitmap(Me.ClientSize.Width, Me.ClientSize.Height)
Dim graph As Graphics
graph = Graphics.FromImage(bmp)
'Graphics* graph = Graphics::FromImage(&bmp);
' Draw paper
rcPaper.Location = rcPaper.Location '+ ptScrollOffset
graph.Clear(Color.DarkGray)
'Debug.Print("Grid size: " & Me.ClientSize.Width & "x" & Me.ClientSize.Height)
'Debug.Print("Parent size: " & Parent.ClientSize.Width & "x" & Parent.ClientSize.Height)
'graph.FillRectangle(Brushes.White, rcPaper)
graph.DrawRectangle(Pens.Black, rcPaper)
' Draw the grid.
' If bShowGrid Then
For x As Integer = 0 To bmp.Width Step 10
For y As Integer = 0 To bmp.Height Step 10
graph.DrawLine(Pens.Azure, x, y, x + 0.5F, y + 0.5F)
Next y
Next x
'End If
e.Graphics.DrawImage(bmp, 0, 0)
t_span = Now - time_start
bmp.Dispose()
graph.Dispose()
Debug.Print("OnPaint: " && Me.Name && " elapsed time: " && t_span.Milliseconds)
End Sub
End Class
From this example I know this:
Elapsed time for scroll message is about 0 milliseconds.
Elapsed time for draw usercontrol is about 30 ms.
When I call invalidate from timer with 100ms period immediate window shows something like this:
OnPaint: Picture1 elapsed time: 15
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture1 elapsed time: 15
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture1 elapsed time: 15
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture1 elapsed time: 15
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture1 elapsed time: 15
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture1 elapsed time: 15
When I disable timer and repaint from scroll event it looks like this:
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture1 elapsed time: 15
OnPaint: Picture2 elapsed time: 46
OnPaint: Picture1 elapsed time: 31
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture1 elapsed time: 15
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture2 elapsed time: 15
From these results I think I need somehow to reduce OnScroll events or call another set of repaints after previous set of repaint has finished.
|
|
|
|
|
hi,
now try to add a Panel to the Form1 with Property AutoScroll to true.
than dock you Usercontrol1 into the Panel with DockStyle.Fill;
in your Usercontrol1 i don't understand why you are creating a bitmap to show the result on the usercontrol instead of painting directly to the usercontrol.
try this example do not print debugger output because this could be an indicator why its a slowly painting..
Private Sub OnPaintPic1(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
Dim rcPaper = Me.ClientRectangle
Dim time_start As DateTime = Now
Dim t_span As TimeSpan
e.Graphics.FillRectangle(Brushes.DarkGray, rcPaper)
e.Graphics.DrawRectangle(Pens.Black, rcPaper)
' Draw the grid.
' If bShowGrid Then
For x As Integer = 0 To rcPaper.Width Step 10
For y As Integer = 0 To rcPaper.Height Step 10
e.Graphics.DrawLine(Pens.Azure, x, y, x + 0.5F, y + 0.5F)
Next y
Next x
'End If
t_span = Now - time_start
End Sub
|
|
|
|
|
Just for an information how have I deal with this issue. I don't know if it is much clever, but it seems to work.
I added declaration of event into UserControl1:
Public Event DrawFinished(ByVal sControlName As String)
In Form1.vb code I added counter for items to draw nDrawItems, I added handling of DrawFinished event for both events and I modify Scroll event.
It looks something like this:
Public Class Form1
Private nDrawItems As Integer = 0
...
Private Sub Picture1_DrawFinished(ByVal sName As String) Handles Picture1.DrawFinished
If nDrawItems = 0 Then Exit Sub
nDrawItems = nDrawItems - 1
End Sub
Private Sub Picture2_DrawFinished(ByVal sName As String) Handles Picture2.DrawFinished
If nDrawItems = 0 Then Exit Sub
nDrawItems = nDrawItems - 1
End Sub
...
Private Sub MyScroll(ByVal sender As Object, ByVal e As System.EventArgs) Handles HScrollBar1.ValueChanged
If nDrawItems > 0 Then Exit Sub
nDrawItems = 2
Invalidate(True)
While nDrawItems > 0
'Threading.Thread.Sleep(5)
Application.DoEvents()
End While
End Sub
Now I have in Immediate window text like this:
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture1 elapsed time: 15
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture1 elapsed time: 15
OnPaint: Picture2 elapsed time: 15
OnPaint: Picture1 elapsed time: 15
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture1 elapsed time: 15
OnPaint: Picture2 elapsed time: 31
OnPaint: Picture1 elapsed time: 15
|
|
|
|
|
I have made a login form in c#.net in windows based application.
An error comes "instance failure" when i run and login info...
|
|
|
|
|
Please post your code and the compiler/runtime error messages.
|
|
|
|
|
When i run tje application, it executes successfully but after entering the login info..there generates an error "Instance Failure"
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Configuration;
using System.Data.SqlClient;
namespace Ads_Sertrack_System
{
public partial class frmLogin : Form
{
public frmLogin()
{
InitializeComponent();
this.MaximizeBox = false;
this.MinimizeBox = false;
this.StartPosition = FormStartPosition.CenterScreen;
this.WindowState = FormWindowState.Normal;
this.AutoSizeMode = AutoSizeMode.GrowOnly;
this.AutoSize = true;
}
SqlConnection conAdSertrack = new SqlConnection();
string strQry;
SqlCommand cmdLogin;
SqlDataReader dtrLogin;
public static int intLogInId;
public static string strUserName;
public static string strUserRole;
private void frmLogin_Load(object sender, EventArgs e)
{
try
{
conAdSertrack.ConnectionString = ConfigurationManager.ConnectionStrings["con"].ToString();
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnLogin_Click(object sender, EventArgs e)
{
try
{
errProvider.Clear();
if (txtUserName.Text == "")
{
errProvider.SetError(txtUserName, "Please Enter User Name");
MessageBox.Show("Please Enter User Name", "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtUserName.Focus();
}
else if (txtPassword.Text == "")
{
errProvider.SetError(txtPassword, "Please Enter Password");
MessageBox.Show("Please Enter Password", "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtPassword.Focus();
}
else
{
strQry = "select userid,username,userrole" +
" from tblusermaster where username = @paramUNm and pwd = @paramPwd";
cmdLogin = new SqlCommand(strQry, conAdSertrack);
cmdLogin.Parameters.Add("@paramUNm", SqlDbType.VarChar, 30).Value = txtUserName.Text;
cmdLogin.Parameters.Add("@paramPwd", SqlDbType.VarChar, 30).Value = txtPassword.Text;
if (conAdSertrack.State == ConnectionState.Closed)
{
conAdSertrack.Open();
}
dtrLogin = cmdLogin.ExecuteReader();
if (dtrLogin.HasRows)
{
dtrLogin.Read();
intLogInId = Convert.ToInt32(dtrLogin[0].ToString().Trim());
strUserName = Convert.ToString(dtrLogin[1].ToString().Trim());
strUserRole = Convert.ToString(dtrLogin[2].ToString().Trim());
frmMDI formMdi = new frmMDI();
formMdi.Show();
this.txtPassword.Text = "";
this.txtUserName.Text = "";
this.Hide();
}
else
{
MessageBox.Show("InValid User Name & Password", "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
txtUserName.Text = "";
txtPassword.Text = "";
txtUserName.Focus();
}
dtrLogin.Close();
conAdSertrack.Close();
}
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Innor Solutions Pvt. Ltd", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
try
{
Application.Exit();
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void frmLogin_FormClosing(object sender, FormClosingEventArgs e)
{
try
{
Application.Exit();
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void txtUserName_TextChanged(object sender, EventArgs e)
{
try
{
errProvider.Clear();
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void txtPassword_TextChanged(object sender, EventArgs e)
{
try
{
errProvider.Clear();
}
catch (Exception expMsg)
{
MessageBox.Show(expMsg.Message.ToString(), "Alpha Net Technologies Pvt. Ltd: Message Service", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
}
}
|
|
|
|
|
Can you please post your connectionstring and what database do you use (maybe SQL-Server Express 2005?).
|
|
|
|
|
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<connectionStrings>
<add name="con" connectionString="Server=.\\sqlexpress;Integrated Security=true; Initial Catalog=AdSertrack_WinPrj;User Instance=false;"/>
</connectionStrings>
</configuration>
|
|
|
|
|
Try server=.\SQLExpress. (only one \)
|
|
|
|
|
|
No problem.
And if I may say so, its not the best way to execute sql-queries directly in your UI.
|
|
|
|
|
I am trying to create a Tabbed List Box in a web page. I have done it in a windows application and it worked perfectly, but I can't find one little tiny piece of information and need some help.
I am trying to use SendMessage with the ListBox and all the examples I see say to use this:
SendMessage(List1.hWnd, LB_SETTABSTOPS, ListBoxTabs.Length, ref ListBoxTabs[0]);
However! There is no hWnd property for the ListBox control. In the windows app it's List1.Handle, however, there is no such property for that in the web control either! Can someone explain to me how to find the hWnd property of a web ListBox?
Thanks in advance for any help you can give.
|
|
|
|
|
MarkyMark1961 wrote: Can someone explain to me how to find the hWnd property of a web ListBox?
There isn't one. You need to spend some time reading up on how to create server controls for ASP.NET before proceeding.
only two letters away from being an asset
|
|
|
|
|
Then why are there examples showing that there is?
|
|
|
|
|
You are most likely confused. Show these sources.
only two letters away from being an asset
|
|
|
|
|
try this one it shows exactly what I was saying among others...
http://www.vb-helper.com/howto_listbox_tabs.html
|
|
|
|
|