包含vb.net设备单位的词条
vb.net DrawString 座标单位是什么
单位是像素,跟控件的位置(location)的类型是一样的,控件的location就是它左上角的位置,同理,drawstring的坐标 ,即表示要绘制的第一个字的左上角的位置
我们提供的服务有:成都网站设计、做网站、成都外贸网站建设公司、微信公众号开发、网站优化、网站认证、钦州ssl等。为上1000家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的钦州网站制作公司
用VB.NET设计一个以秒为基本单位的表,并且显示在窗体上的步骤,并且给出关键代码
是我以前自己设计的用来测试自己点钞速度用的,希望是你需要的
以下是窗体的全部代码
Public Class Form1
Dim StartFlag As Boolean = False
Dim secon As Integer
Dim minut As Integer
'空格
Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
If e.KeyCode = Keys.Space Then
If StartFlag Then
StartFlag = False
Timer1.Enabled = False
If Val(Strings.Right(Label1.Text, 2)) 10 And Val(Strings.Right(Label1.Text, 2)) = 0 Then secon = 0 : minut = 0 : Label1.Text = "00:00" : Exit Sub
ListBox1.Items.Add(Label1.Text.ToString)
ListBox1.SelectedItem = ListBox1.Items.Count - 1
Label1.Focus()
Button1.Enabled = True
Label1.Text = "00:00"
secon = 0
minut = 0
Else
StartFlag = True
Timer1.Enabled = True
End If
End If
End Sub
'加载
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
ListBox1.Items.Clear()
Label1.Text = "00:00"
Button1.Enabled = False
secon = 0
minut = 0
Label1.Focus()
End Sub
'清空
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Button1.Enabled = False
ListBox1.Items.Clear()
Label1.Focus()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
secon += 1
If secon = 60 Then
secon = 0
minut += 1
End If
Dim seconStr As String = secon
If seconStr.Length = 1 Then seconStr = "0" + seconStr
Dim minutStr As String = minut
If minutStr.Length = 1 Then minutStr = "0" + minutStr
Label1.Text = minutStr + ":" + seconStr
Label1.Focus()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SeconSun As Integer
If ListBox1.Items.Count 0 Then
For i = 0 To ListBox1.Items.Count - 1
Dim TemStr As String = ListBox1.Items.Item(i).ToString
Dim TemInt1 As Integer = Val(Strings.Right(TemStr, 2))
Dim TemInt2 As Integer = Val(Strings.Left(TemStr, 2))
Debug.Print(TemInt1.ToString)
Debug.Print(TemInt2.ToString)
SeconSun += TemInt1 + TemInt2 * 60
Debug.Print(SeconSun.ToString)
Next
TextBox1.Text = (SeconSun / ListBox1.Items.Count).ToString + "秒"
End If
Label1.Focus()
End Sub
End Class
用VB.Net 编程时如何获得打印机的物理边距
网络上找到这个比较全面,你试一下,我记得以前也是这么设置的。
int GetDeviceCaps( HDC hdc, int nIndex);
其中,hdc用来指定设备环境句柄,nIndex用来指定要获取的参量索引,对于打印机而言,它常常需要下列的预定义值:
LOGPIXELSX 打印机水平分辨率
LOGPIXELSY 打印机垂直分辨率
PHYSICALWIDTH 打印纸的实际宽度
PHYSICALHEIGHT 打印纸的实际高度
PHYSICALOFFSETX 实际可打印区域的物理左边距
PHYSICALOFFSETY 实际可打印区域的物理上边距
下面的函数代码就是用来设置页边距,并且还计算页面的物理边距:
void CEx_Prn1View::SetPageMargin(CDC *pDC, CPrintInfo *pInfo, int l, int t, int r, int b)
// l, t, r, b分别表示左上右下边距, 单位为0.1mm
{
int nOldMode = pDC- GetMapMode();
pDC- SetMapMode(MM_LOMETRIC);
// 计算一个设备单位等于多少0.1mm
double scaleX = 254.0 / (double)GetDeviceCaps(
pDC- m_hAttribDC, LOGPIXELSX);
double scaleY = 254.0 / (double)GetDeviceCaps(
pDC- m_hAttribDC, LOGPIXELSY);
int x = GetDeviceCaps(pDC- m_hAttribDC,
PHYSICALOFFSETX);
int y = GetDeviceCaps(pDC- m_hAttribDC,
PHYSICALOFFSETY);
int w = GetDeviceCaps(pDC- m_hAttribDC,
PHYSICALWIDTH);
int h = GetDeviceCaps(pDC- m_hAttribDC,
PHYSICALHEIGHT);
int nPageWidth = (int)((double)w*scaleX + 0.5);
// 纸宽,单位0.1mm
int nPageHeight = (int)((double)h*scaleY + 0.5);
// 纸高,单位0.1mm
m_nPhyLeft = (int)((double)x*scaleX + 0.5);
// 物理左边距,单位0.1mm
m_nPhyTop = (int)((double)y*scaleY + 0.5);
// 物理上边距,单位0.1mm
pDC- DPtoLP(pInfo- m_rectDraw);
CRect rcTemp = pInfo- m_rectDraw;
rcTemp.NormalizeRect();
m_nPhyRight = nPageWidth - rcTemp.Width() -
m_nPhyLeft; // 物理右边距,单位0.1mm
m_nPhyBottom = nPageHeight - rcTemp.Height() -
m_nPhyTop; // 物理下边距,单位0.1mm
// 若边距小于物理边距,则调整它们
if (l m_nPhyLeft) l = m_nPhyLeft;
if (t m_nPhyTop) t = m_nPhyTop;
if (r m_nPhyRight) r = m_nPhyRight;
if (b m_nPhyBottom) b = m_nPhyBottom;
// 计算并调整pInfo- m_rectDraw的大小
pInfo- m_rectDraw.left = l - m_nPhyLeft;
pInfo- m_rectDraw.top = - t + m_nPhyTop;
pInfo- m_rectDraw.right -= r - m_nPhyRight;
pInfo- m_rectDraw.bottom += b - m_nPhyBottom;
pDC- LPtoDP(pInfo- m_rectDraw);
pDC- SetMapMode(nOldMode);
// 恢复原来的映射模式
}
VB.NET form中 height是什么单位
360问答
VB中.Move Form1.Width / 2 - 100, Form1.Height / 2 - 200, 800, 400这条语句具体是什么意思啊。详细点
8230LT LV13
2014-02-10
满意答案
dgwlw123
LV12
2014-02-10
.move是对窗体,过控件移动到指定位置 以下参考MSDN: 语法 object.Move left, top, width, height Move 方法的语法包含下列部分: 部分描述object可选的。一个对象表达式,其值为“应用于”列表中的一个对象。如果省略 object,带有焦点的窗体缺省为 object。left必需的。单精度值,指示 object 左边的水平坐标 (x-轴)。top可选的。单精度值,指示 object 顶边的垂直坐标 (y-轴)。width可选的。单精度值,指示 object 新的宽度。height可选的。单精度值,指示 object 新的高度。
基于VBNET的GDI坐标系统如何设置坐标单位
123456789101112Dim picX, picY, x1, y1, x2, y2, a href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPhmknAcvPjNhnvRYPAF90ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHb3rjbkrjc3rHc4nHn1rj0vPs" target="_blank" class="baidu-highlight"gdi/aX, a href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPhmknAcvPjNhnvRYPAF90ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHb3rjbkrjc3rHc4nHn1rj0vPs" target="_blank" class="baidu-highlight"gdi/aYpicX = 0 '要转换的Picture1坐标XpicY = 0 '要转换的Picture1坐标Yx1 = Picture1.ScaleLefty1 = Picture1.ScaleTopx2 = Picture1.ScaleLeft + Picture1.ScaleWidthy2 = Picture1.ScaleTop + Picture1.ScaleHeight '记录原先的坐标系统Picture1.ScaleMode = 3 '坐标系统设为像素a href=";tn=44039180_cprfenlei=mv6quAkxTZn0IZRqIHckPjm4nH00T1YLPhmknAcvPjNhnvRYPAF90ZwV5Hcvrjm3rH6sPfKWUMw85HfYnjn4nH6sgvPsT6KdThsqpZwYTjCEQLGCpyw9Uz4Bmy-bIi4WUvYETgN-TLwGUv3EnHb3rjbkrjc3rHc4nHn1rj0vPs" target="_blank" class="baidu-highlight"gdi/aX = Round((picX - x1) / (x2 - x1) * Picture1.ScaleWidth)gdiY = Round((picY - y1) / (y2 - y1) * Picture1.ScaleHeight)MsgBox "Picture1的坐标(" picX "," picY ")转为GDI坐标是(" gdiX "," gdiY ")"Picture1.Scale (x1, y1)-(x2, y2) '改回原先的坐标系统
vb.net屏幕分辨率的单位是什么?
默认单位是像素
96是系统的一种设定,每英寸的点数,是系统界面用小字体时的设置
用像素数除以DPI没有意义
当前题目:包含vb.net设备单位的词条
URL网址:http://azwzsj.com/article/hcesde.html