我使用Button与MetroCircleButtonStyle用MetroUI在WPF.我怎样才能改变这个背景Button?
码:
<Button Background="Green"
Name="button2"
Style="{DynamicResource MetroCircleButtonStyle}"
Width="50" Height="50" />
Run Code Online (Sandbox Code Playgroud)
目前按钮看起来像这样,但我想要右边的那个:

我有以下OptionMenu:
self.textoprioridad = Label(self.frameTwo, text = "Prioridad: ", justify="center")
self.textoprioridad.grid(row=n, column=4)
var2 = StringVar()
menu2 = OptionMenu(self.frameTwo, var2, "Primera pieza", "Esta semana", "Normal", "Baja")
menu2.grid(row=n, column=5, ipadx=10)
var2.set("Primera pieza")
self.optionmenus_prioridad.append((menu2, var2))
Run Code Online (Sandbox Code Playgroud)
这显示了这样的事情:

问题是,如果我Normal从列表中选择,按钮会调整大小并使其变小:

我想知道是否有任何方法可以保持OptionMenu按钮的初始大小,如下所示:

提前致谢.
如何将焦点设置为按钮但不将setFocusableInTouchMode设置为true?
我第一次尝试这个:
button.requestFocus();
Run Code Online (Sandbox Code Playgroud)
这根本行不通.然后我尝试了这个:
button.setFocusableInTouchMode(true);
button.requestFocus();
Run Code Online (Sandbox Code Playgroud)
问题是,它突出了按钮.我不希望按钮在触摸模式下突出显示.我只想在用户点击回车键或Tab键时选择按钮.
为了澄清,我只是希望第一个按钮在不处于触摸模式时以焦点开始.
我发现IE 9及更低版本中的小x图标不会像我在IE 10中那样绑定到我的任何jquery事件(以及更好的浏览器,如chrome).这是我正在谈论的x图标:

有没有办法可以手动绑定这个小x图标?我已经看过很多关于如何使用css隐藏x按钮的帖子,如下所示:
<style type="text/css">
::-ms-clear {
display: none;
}
</style>
Run Code Online (Sandbox Code Playgroud)
但我实际上不会将点击事件绑定到这个东西.能做到吗?
在我的Android应用程序中,我在地球上有三个不规则形状,如下所示:

所以我将整个图像放在布局中.Globe is just an image .There is no role of globe here.现在我想在全球各个不规则形状的图像上放置一个按钮.
按钮总是长方形但是I want to get touch event for irregular shape,not for rectangular area.那么如何在这三个不规则形状上放三个按钮或者有任何解决方案?这样每个按钮的不同事件可以在活动中处理?
我不知道如何完成这项任务.请指导我这个.
有什么建议或意见吗?
任何帮助将不胜感激.
我的WPF项目使用了很多图像按钮,但由于我还没有找到正确的方法(我每次都必须编写相同的触发器和样式,只有差异是图像源),我的资源字典变得很长徒劳无功.有没有更好的方法呢?
这是我用于按钮的样式示例:
<Style x:Key="ButtonStyle" TargetType="{x:Type Button}">
<!-- Some setters -->
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type Button}">
<Grid>
<Image Source="Images.png" Stretch="Fill"/>
</Grid>
<ControlTemplate.Triggers>
<!-- Some triggers ( IsFocused, IsMouseOver, etc.) -->
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
Run Code Online (Sandbox Code Playgroud)
谢谢 :)
基本上,我想要8个单选按钮.如果选择了一个单选按钮,则下面显示一个div.如果选择另一个按钮,则显示另一个div.一次只显示一个div,如果没有选择按钮(最初),则不显示div.
这是我的HTML,这是相当标准的,我不是试图根据我的需要改进它.
<form id='group'>
<label><input type="radio" name="group1" class="sim-micro-btn"/></label>
<label><input type="radio" name="group1" class="sim-mini-btn"/></label>
<label><input type="radio" name="group1" class="sim-maxi-btn"/></label>
<label><input type="radio" name="group1" class="sim-mega-btn"/></label>
<label><input type="radio" name="group1" class="phone-smart-micro-btn"/></label>
<label><input type="radio" name="group1" class="phone-smart-mini-btn"/></label>
<label><input type="radio" name="group1" class="phone-smart-btn"/></label>
<label><input type="radio" name="group1" class="phone-smart-maxi-btn"/></label>
</form>
<div class="billpay-internet-add-ons">
<div class="sim-micro-desktop">sim-micro</div>
<div class="sim-mini-desktop">sim-mini</div>
<div class="sim-maxi-desktop">sim-maxi</div>
<div class="sim-mega-desktop">sim-mega</div>
<div class="phone-smart-micro-desktop">phone-smart-micro</div>
<div class="phone-smart-mini-desktop">phone-smart-mini</div>
<div class="phone-smart-desktop">phone-smart</div>
<div class="phone-smart-maxi-desktop">phone-smart-maxi</div>
</div>
Run Code Online (Sandbox Code Playgroud)
然而这是我的剧本,它似乎相当忙乱,我想知道在我继续前进是否有办法做到这一点更简单?
$(document).ready(function(){
$('.sim-micro-desktop').hide();
$('.sim-mini-desktop').hide();
$('.sim-maxi-desktop').hide();
$('.sim-mega-desktop').hide();
$('.phone-smart-micro-desktop').hide();
$('.phone-smart-mini-desktop').hide();
$('.phone-smart-desktop').hide();
$('.phone-smart-maxi-desktop').hide();
$('form#group').click(function(){
if($('.sim-micro-btn').is(":checked")){
$('.sim-micro-desktop').show();
} else {
$('.sim-micro-desktop').hide();
}
if($('.sim-mini-btn').is(":checked")){
$('.sim-mini-desktop').show();
} else {
$('.sim-mini-desktop').hide(); …Run Code Online (Sandbox Code Playgroud) 我在ASP.net MVC Web应用程序中使用JQgrid.
我能够通过使用添加名为edit的新按钮列 formatters
但是,问题是我无法获得单击按钮的行中的列值.
例如,如果我在第4行单击按钮编辑(新添加),我将需要获取该特定行的第一列的值.
我需要这个,因为我想重定向到具有该值的另一个页面并在那里进行编辑.
我无法获取该值并向其添加javascript.
请使用任何代码示例帮助解决此问题.
我能请求一点帮助吗?我创建了一个带有切换按钮的GUI,用于切换LED,LED熄灭.
我现在要做的是添加一些代码来更改按钮的文本,因为它在两个状态之间切换.
我查了一些例子但是我不太清楚如何或者在哪里添加代码来使按钮文本切换.
谢谢你的帮助.
我的代码......
# Idle 07_02_LED ON using GUI
from time import sleep
from Tkinter import *
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
Label(frame, text='Turn LED ON').grid(row=0, column=0)
Label(frame, text='Turn LED OFF').grid(row=1, column=0)
button = Button(frame, text='LED 0 ON', command=self.convert0)
button.grid(row=2, columnspan=2)
def convert0(self, tog=[0]):
tog[0] = not tog[0]
if tog[0]:
print('LED 0 OFF')
else:
print('LED 0 ON')
root = Tk()
root.wm_title('LED on & off program')
app = App(root)
root.mainloop()
Run Code Online (Sandbox Code Playgroud) 随着Android Studio我有一些Buttons,我想,当我点击他们,你可以看到一种运动是确认您已经点击的Button.有没有办法在没有创建新xml文件的情况下执行此操作selector?我想做那样的事情(我认为这是默认颜色):
什么时候是正常的
什么时候按下
我有这个,但它什么都没做:
Button b = (Button)findViewById(R.id.btn);
b.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN ) {
return true;
}
return false;
}
});
Run Code Online (Sandbox Code Playgroud)